diff --git a/config/example-config.php b/config/example-config.php index 4175c22e..4a4cccdd 100644 --- a/config/example-config.php +++ b/config/example-config.php @@ -704,7 +704,7 @@ $c->admin_email = 'calendar-admin@example.com'; // 'filterGroups' => 'objectClass=groupOfUniqueNames', /* /!\ "username" should be set and "modified" must be set * used to create the user based on their ldap properties */ -// 'mapping_field' => array( +// 'user_mapping_field' => array( // "username" => "uid", // "modified" => "modifyTimestamp", // "fullname" => "cn", diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index 05c4055a..b855fe21 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -643,6 +643,14 @@ function sync_LDAP_groups(){ if ( sizeof ( $groups_to_update ) ){ $c->messages[] = sprintf(i18n('- updating groups : %s'),join(', ',$groups_to_update)); + // Support the old name of user_mapping_field.. + $user_mapping = NULL; + if (isset($c->authenticate_hook['config']['user_mapping_field'])) { + $user_mapping = $c->authenticate_hook['config']['user_mapping_field']; + } else if (isset($c->authenticate_hook['config']['mapping_field'])) { + $user_mapping = $c->authenticate_hook['config']['mapping_field']; + } + foreach ( $groups_to_update as $group ){ $db_members = is_array( $db_group_members[$group] ) ? array_values( $db_group_members[$group] ) @@ -651,12 +659,10 @@ function sync_LDAP_groups(){ ? array_values ( $ldap_groups_info[$group][$member_field] ) : array(); - $mapping_field = $c->authenticate_hook['config']['mapping_field']; - if (isset($c->authenticate_hook['config']['group_match_username_attr']) - && isset($mapping_field['username'])) { + && isset($user_mapping['username'])) { $query = $ldapDriver->ldap_query_one; - $username_ldap_attribute = $mapping_field['username']; + $username_ldap_attribute = $user_mapping['username']; $filter = "(objectCategory=person)"; $ldap_members_tmp = array(); @@ -757,7 +763,14 @@ function sync_LDAP(){ $ldapDriver = getStaticLdap(); if ( ! $ldapDriver->valid ) return; - $mapping = $c->authenticate_hook['config']['mapping_field']; + // Support the old name of user_mapping_field. + $mapping = NULL; + if (isset($c->authenticate_hook['config']['user_mapping_field'])) { + $mapping = $c->authenticate_hook['config']['user_mapping_field']; + } else if (isset($c->authenticate_hook['config']['mapping_field'])) { + $mapping = $c->authenticate_hook['config']['mapping_field']; + } + $attributes = array_values_mapping($mapping); $ldap_users_tmp = $ldapDriver->getAllUsers($attributes); diff --git a/testing/regression-conf.php.example b/testing/regression-conf.php.example index d14c7b89..0e5cc921 100644 --- a/testing/regression-conf.php.example +++ b/testing/regression-conf.php.example @@ -32,6 +32,7 @@ //ldap 'protocolVersion' => 3, //ldap 'baseDNUsers' => 'ou=users,dc=example,dc=com', //ldap 'baseDNGroups' => 'ou=groups,dc=example,dc=com', + // Test with the old name, new name is "user_mapping_field". //ldap 'mapping_field' => array( //ldap "username" => "uid", //ldap "modified" => "modifyTimestamp",