The piping option for the mapping described as so
"Enter a list of LDAP groups and their Drupal role mappings, one per line with a | delimiter. Should be in the form [ldap group]|[drupal role] such as:
cn=ED IT NAG Staff,DC=ad,DC=uiuc,DC=edu|admin
cn=Ed Webs UIUC Webmasters,DC=ad,DC=uiuc,DC=edu|committee member"
...works incorrectly. Instead of the piped role being assigned the LDAP group name is assigned. This is because line 269 of the ldapsgroups.module states to return $groups_new[] = $group instead of $groups_new[] = $role retrieved from the unserialized db call.
Here is the correct code.
function _ldapgroups_filter($account, $groups) {
if (_ldapgroups_ldap_info($account, 'ldapgroups_mappings_filter') && count(_ldapgroups_ldap_info($account, 'ldapgroups_mappings') > 0)) {
$groups_new = array();
foreach ($groups as $group) {
foreach (_ldapgroups_ldap_info($account, 'ldapgroups_mappings') as $group_approved => $role) {
if (strcasecmp($group_approved, $group) == 0)
$groups_new[] = $role;
}
}
$groups = $groups_new;
}
if ($code = _ldapgroups_ldap_info($account, 'ldapgroups_filter_php'))
$groups = eval($code);
return $groups;
}
Another side note, the text description above the mapping entry box is missleading. It reads
"The module automatically decides names for the Drupal roles based in the names of the LDAP groups. For example:
LDAP group: Admins => Drupal role: Admins
LDAP group: ou=Underlings,dc=myorg,dc=mytld => Drupal role: Underlings."
Which is currently true only because the piping method is broken. If the method to create roles based on groups was intended (by leaving out the pipe) then something else must be wrong because a pipe is required for entry. However I find the piping method to be the needed method in my situation, I would assume having both might be a future feature.
Comments
Comment #1
miglius commentedPlease attach the patch in the proper format, otherwise it is hard to read.
Comment #2
miglius commentedYes, it's a bug. I have changed to $groups_new[] = $role in the cvs.
The description:
"The module automatically decides names for the Drupal roles based in the names of the LDAP groups. For example:
LDAP group: Admins => Drupal role: Admins
LDAP group: ou=Underlings,dc=myorg,dc=mytld => Drupal role: Underlings."
is correct because this supposed to work only when there is no mappings defined.
Comment #3
el senor juju commentedHello,
Finaly the ldap integration with the mapping role works.
But my sites are based on multi-site with SSO, so the mapping works when you log directly on the site but if you pass by the SSO, roles are not mapped.
Do you have a solution?
Have a nice day.
Comment #5
amariotti commentedI installed this a week ago and I had to make this change. Has the change been applied to the version available on the project page?
Comment #6
amariotti commentedThis has been fixed in the latest 6.x-1.0-beta2 release.
Comment #8
lsaslam2 commentedHi
need help to giv the ldap mapping to my site
here is the maping i given
cn=ldapgroup,DC=ad,DC=uiuc,DC=edu|myroleindrupal
ou=ldapgroup,dc=myorg,dc=mytld|myroleindrupal
is this the correct one, i havnt changed anything on the module file in my site..is it required?
Comment #9
lsaslam2 commentedHi
need help to giv the ldap mapping to my site
here is the maping i given
cn=ldapgroup,DC=ad,DC=uiuc,DC=edu|myroleindrupal
ou=ldapgroup,dc=myorg,dc=mytld|myroleindrupal
is this the correct one, i havnt changed anything on the module file in my site..is it required?
Comment #10
johnbarclay commentedPlease open a new ticket with the category of "support" for such things. In drupal 6 you do not need a separate file. Your mappings look correct.
See also: http://drupal.org/node/118112