From 25b1469b54bcd6319468e91532d088f78c44f8b9 Mon Sep 17 00:00:00 2001
From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com>
Date: Fri, 5 Mar 2021 11:18:51 +0100
Subject: [PATCH] FIX: ldap group search test: bad key used + edit
label/comments + remove useless code
---
htdocs/admin/ldap_groups.php | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php
index 4b7acd2598c..d8d12a7e2d3 100644
--- a/htdocs/admin/ldap_groups.php
+++ b/htdocs/admin/ldap_groups.php
@@ -278,10 +278,6 @@ if (function_exists("ldap_connect")) {
}
if ($action == 'testsearchgroup') {
- // Creation objet
- $object = new UserGroup($db);
- $object->initAsSpecimen();
-
// TODO Mutualize code following with other ldap_xxxx.php pages
// Test synchro
@@ -301,13 +297,13 @@ if (function_exists("ldap_connect")) {
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
// Get from LDAP database an array of results
- $ldapgroups = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 'group');
- //$ldapgroups = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_USERS, '', 'group');
+ $ldapgroups = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, $required_fields, 'group');
+ //$ldapgroups = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, '', 'group');
if (is_array($ldapgroups)) {
$liste = array();
foreach ($ldapgroups as $key => $ldapgroup) {
- // Define the label string for this user
+ // Define the label string for this group
$label = '';
foreach ($required_fields as $value) {
if ($value) {
@@ -321,7 +317,7 @@ if (function_exists("ldap_connect")) {
}
print "
\n";
- print "LDAP search for user:
\n";
+ print "LDAP search for group:
\n";
print "search: *
\n";
print "userDN: ".$conf->global->LDAP_GROUP_DN."
\n";
print "useridentifier: ".$conf->global->LDAP_KEY_GROUPS."
\n";