Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to choose cohort name #14

Open
GuybrushTreepwood opened this issue Nov 30, 2018 · 2 comments
Open

Add ability to choose cohort name #14

GuybrushTreepwood opened this issue Nov 30, 2018 · 2 comments
Assignees

Comments

@GuybrushTreepwood
Copy link

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.

@mackensen mackensen self-assigned this Nov 30, 2018
@mackensen
Copy link
Collaborator

This is a good idea and shouldn't be too hard to implement.

@GuybrushTreepwood
Copy link
Author

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants