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
$ldapresult = ldap_search($ldapconnection, $context, $filter, array ($this->config->group_attribute));
$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...