Have some sane defaults for LDAP group mappings

This commit is contained in:
Andrew Ruthven 2024-02-03 20:06:38 +13:00
parent 13083b07e8
commit 2a30a9646c

View File

@ -506,14 +506,18 @@ function sync_LDAP_groups(){
unset($mapping['username']);
}
// Set sane defaults.
if (! isset($mapping['name']))
$mapping['name'] = 'cn';
if (! isset($mapping['members']))
$mapping['members'] = 'member';
$attributes = array_values_mapping($mapping);
$ldap_groups_tmp = $ldapDriver->getAllGroups($attributes);
if ( sizeof($ldap_groups_tmp) == 0 ) return;
$member_field = isset($mapping['members'])
? $mapping['members']
: 'member';
$member_field = $mapping['members'];
$dnfix = isset($c->authenticate_hook['config']['group_member_dnfix'])
&& $c->authenticate_hook['config']['group_member_dnfix'];