Rename username to name in group mappings, drop unused fullname from example

Usinger "username" for the group name is confusing and misleading. Just
use name, but support our users who still have username.

We don't use fullname, drop it from the example.
This commit is contained in:
Andrew Ruthven 2024-02-03 20:03:49 +13:00 committed by Andrew Ruthven
parent bb713137fd
commit 13083b07e8
3 changed files with 12 additions and 5 deletions

View File

@ -712,9 +712,8 @@ $c->admin_email = 'calendar-admin@example.com';
// ),
/* used to create the group based on the ldap properties */
// 'group_mapping_field' => array(
// "username" => "cn",
// "name" => "cn",
// "modified" => "modifyTimestamp",
// "fullname" => "cn",
// "members" => "member"
// ),

View File

@ -498,6 +498,14 @@ function sync_LDAP_groups(){
if ( ! $ldapDriver->valid ) return;
$mapping = $c->authenticate_hook['config']['group_mapping_field'];
// Old config (pre 1.1.13) used "username" as the group name, if that is in
// use, copy it to the new name: name.
if ( ! isset($mapping['name']) && isset($mapping['username']) ) {
$mapping['name'] = $mapping['username'];
unset($mapping['username']);
}
$attributes = array_values_mapping($mapping);
$ldap_groups_tmp = $ldapDriver->getAllGroups($attributes);
@ -510,8 +518,8 @@ function sync_LDAP_groups(){
$dnfix = isset($c->authenticate_hook['config']['group_member_dnfix'])
&& $c->authenticate_hook['config']['group_member_dnfix'];
foreach($ldap_groups_tmp as $key => $ldap_group){
$group_mapping = $ldap_group[$mapping['username']];
foreach ($ldap_groups_tmp as $key => $ldap_group) {
$group_name = $ldap_group[$mapping['name']];
$ldap_groups_info[$group_mapping] = $ldap_group;
if ( isset($ldap_groups_info[$group_mapping][$member_field]) ) {

View File

@ -39,9 +39,9 @@
//ldap "email" => "mail"
//ldap ),
//ldap 'group_mapping_field' => array(
// Test with the old name, new name is "name""
//ldap "username" => "cn",
//ldap "modified" => "modifyTimestamp",
//ldap "fullname" => "cn" ,
//ldap "members" => "memberUid",
//ldap ),
//ldap 'format_updated' => array(