refactor: Updated ldap auth to allow configurable uidnumber field (#7302)

This commit is contained in:
Neil Lathwood
2017-09-08 18:04:59 +01:00
committed by Tony Murray
parent ec72eb2960
commit f97b0b87a3
3 changed files with 4 additions and 2 deletions

View File

@@ -96,6 +96,7 @@ $config['auth_ldap_groups']['admin']['level'] = 10;
$config['auth_ldap_groups']['pfy']['level'] = 7;
$config['auth_ldap_groups']['support']['level'] = 1;
$config['auth_ldap_groupmemberattr'] = "memberUid";
$config['auth_ldap_uid_attribute'] = 'uidnumber';
```
Typically auth_ldap_suffix, auth_ldap_group, auth_ldap_groupbase, auth_ldap_groups are what's required to be configured.

View File

@@ -139,7 +139,7 @@ function get_userid($username)
$entries = ldap_get_entries($ldap_connection, $search);
if ($entries['count']) {
return $entries[0]['uidnumber'][0];
return $entries[0][$config['auth_ldap_uid_attribute']][0];
}
return -1;
@@ -167,7 +167,7 @@ function get_userlist()
foreach ($entries as $entry) {
$username = $entry['uid'][0];
$realname = $entry['cn'][0];
$user_id = $entry['uidnumber'][0];
$user_id = $entry[$config['auth_ldap_uid_attribute']][0];
$email = $entry[$config['auth_ldap_emailattr']][0];
$ldap_groups = get_group_list();
foreach ($ldap_groups as $ldap_group) {

View File

@@ -620,6 +620,7 @@ $config['auth_ldap_port'] = 389;
$config['auth_ldap_prefix'] = 'uid=';
$config['auth_ldap_suffix'] = ',ou=People,dc=example,dc=com';
$config['auth_ldap_group'] = 'cn=groupname,ou=groups,dc=example,dc=com';
$config['auth_ldap_uid_attribute'] = 'uidnumber';
$config['auth_ldap_attr']['uid'] = "uid";
$config['auth_ldap_groupbase'] = 'ou=group,dc=example,dc=com';