Open GuybrushTreepwood opened 5 years ago
This is a good idea and shouldn't be too hard to implement.
as I wrote here,
here's how I managed the change in code to use the DisplayName (if set) of a group instead of the CN:
In locallib.php.
In function ldap_get_grouplist
line 148: $ldapresult = ldap_search($ldapconnection, $context, $filter, array ($this->config->group_attribute));
becomes $ldapresult = ldap_search($ldapconnection, $context, $filter, array ($this->config->group_attribute, "displayName"));
line 151:
$ldapresult = ldap_list($ldapconnection, $context, $filter, array ($this->config->group_attribute));
becomes
$ldapresult = ldap_list($ldapconnection, $context, $filter, array ($this->config->group_attribute, "displayName"));
line 162:
array_push($fresult, ($groups[$i][$this->config->group_attribute][0]));
becomes
array_push($fresult, ($groups[$i]));
in function sync_cohorts_by_group
replace line 639:
foreach ($ldapgroups as $groupname) {
with
foreach ($ldapgroups as $ldapgroup) { $groupname = $ldapgroup[$this->config->group_attribute][0]; if($ldapgroup["displayname"][0]===NULL){ $displayName = $groupname; } else{ $displayName = $ldapgroup["displayname"][0]; }
could be improved with the use of a variable for the displayname of the cohort...
The cohort name is the group name (CN). In our directory, group names are not user friendly. I changed a little bit the code to use the DisplayName attribute of the group to name the cohort.
We need a new setting to choose which attribute to use to name the cohort.