mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Updated ldap auth to allow configurable uidnumber field (#7302)
This commit is contained in:
committed by
Tony Murray
parent
ec72eb2960
commit
f97b0b87a3
@@ -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.
|
||||
|
@@ -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) {
|
||||
|
@@ -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';
|
||||
|
Reference in New Issue
Block a user