When groups are synchronised with a big LDAP organisation many empty groups may end up in Tikiwiki.
This enhancement / patch adds an option to let the administrator of a tikiwiki instance decide whether during synchronisation of groups only the user assignments to existing groups will be done or if non-existent groups will be created in tikiwiki.
The default behaviour - as of now - is that when a LDAP user logs in all the groups he belongs to will be created in tikiwiki and he is being added as a member of these groups.
This enhancement adds the preference "ldap_create_groups_tiki" which is "y" by default - which corresponds to the current behaviour.
If "ldap_create_groups_tiki" is set to "n" and a LDAP user logs in the group synchronisation process will silently ignore groups that exist in LDAP but not in tikiwiki. Existing groups will be synced, though.
30c40 + 'ldap_create_group_tiki' => array( + 'name' => tra('If group does not exist in Tiki'), + 'type' => 'list', + 'perspective' => false, + 'options' => array( + 'y' => tra('Create the group'), + 'n' => tra('Ignore it'), + ), + 'default' => 'y', + ),
223c227 + <fieldset> + <legend>{tr}LDAP group synchronisation{/tr}</legend> + {preference name=ldap_create_group_tiki} + </fieldset>
@@ -1261,18 +1261,21 @@ } } - } else if (!$this->group_exists($gname)){ // create group - if (isset($group[$prefs['auth_ldap_groupdescattr']])) { - $gdesc=$group[$prefs['auth_ldap_groupdescattr']]; - } else { - $gdesc=''; - } - $logslib->add_log('ldap','Creating external group '.$gname); - $this->add_group($gname,$gdesc,'',0,0,'','',0,'',0,0,'y'); + } else if (!$this->group_exists($gname)){ // group does not exist + // create group if we should do so + if ($group[$prefs['auth_ldap_create_group_tiki']] == 'y') { + if (isset($group[$prefs['auth_ldap_groupdescattr']])) { + $gdesc=$group[$prefs['auth_ldap_groupdescattr']]; + } else { + $gdesc=''; + } + $logslib->add_log('ldap','Creating external group '.$gname); + $this->add_group($gname,$gdesc,'',0,0,'','',0,'',0,0,'y'); + } } - // add user - if (!in_array($gname,$tikigroups)) { + // add user - before check again if group exists + if (!in_array($gname,$tikigroups) && $this->group_exists($gname)) { $logslib->add_log('ldap','Adding user '.$user.' to external group '.$gname); $this->assign_user_to_group($user,$gname); }
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.
To help developers solve the bug, we kindly request that you demonstrate your bug on a show.tikiwiki.org instance. To start, simply select a version and click on "Create show.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show.tikiwiki.org.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |