mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 03:51:25 +01:00
Clean code
This commit is contained in:
@@ -501,9 +501,9 @@ if (function_exists("ldap_connect")) {
|
|||||||
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
||||||
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
|
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
|
||||||
|
|
||||||
// Get from LDAP database an array of results
|
// Get from LDAP database an array of results by making a search on
|
||||||
|
// $filter = '('.ldap_escape(getDolGlobalString('LDAP_KEY_USERS'), '', LDAP_ESCAPE_FILTER).'=*)';
|
||||||
$ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1);
|
$ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1);
|
||||||
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
|
|
||||||
|
|
||||||
if (is_array($ldapusers)) {
|
if (is_array($ldapusers)) {
|
||||||
$liste = array();
|
$liste = array();
|
||||||
@@ -526,7 +526,7 @@ if (function_exists("ldap_connect")) {
|
|||||||
print "search: *<br>\n";
|
print "search: *<br>\n";
|
||||||
print "userDN: ".getDolGlobalString('LDAP_USER_DN')."<br>\n";
|
print "userDN: ".getDolGlobalString('LDAP_USER_DN')."<br>\n";
|
||||||
print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')."<br>\n";
|
print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')."<br>\n";
|
||||||
print "required_fields: ".implode(',', $required_fields)."<br>\n";
|
print "requested fields: ".implode(',', $required_fields)."<br>\n";
|
||||||
print "=> ".count($liste)." records<br>\n";
|
print "=> ".count($liste)." records<br>\n";
|
||||||
print "\n<br>";
|
print "\n<br>";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -998,12 +998,12 @@ class Ldap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array containing a details or list of LDAP record(s)
|
* Returns an array containing a details or list of LDAP record(s).
|
||||||
* ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
|
* ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
|
||||||
*
|
*
|
||||||
* @param string $search Value of field to search, '*' for all. Not used if $activefilter is set.
|
* @param string $search Value of field to search, '*' for all. Not used if $activefilter is set.
|
||||||
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
|
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
|
||||||
* @param string $useridentifier Name of key field (Ex: uid)
|
* @param string $useridentifier Name of key field (Ex: uid).
|
||||||
* @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword)
|
* @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword)
|
||||||
* @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'group'=use field this->filtergroup as filter, 'member'=use field this->filtermember as filter
|
* @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'group'=use field this->filtergroup as filter, 'member'=use field this->filtermember as filter
|
||||||
* @param array $attributeAsArray Array of fields wanted as an array not a string
|
* @param array $attributeAsArray Array of fields wanted as an array not a string
|
||||||
|
|||||||
Reference in New Issue
Block a user