In ldapgroups.module, you will get a failure at line 250 if ldapgroups_roles_filter has NOT been uncommented in ldap_integration/ldapgroups.conf.php

This is because $groups will never get assigned to $roles

Suggested solution:

On Line 243 of ldapgroups.module, add:

$roles = $groups;

Comments

kreaper’s picture

Version: 5.x-1.1 » master
Assigned: Unassigned » kreaper
Status: Active » Fixed

fixed in HEAD

check for empty arrays

//need to check for empty roles
if ($roles) {
foreach ($roles as $role) {
_ldapgroups_create_role($role);
_ldapgroups_grant_role($user, $role);
}
}

dcartertod’s picture

I'm not 100% sure this fixes the problem. I'm reproducing the revised code below with my suggested revision.

$groups can contain a valid array, but if you haven't uncommented the function in the sub-folder, then those groups will never be granted as roles.

  // Then, we figure out the appropriate groups
  $groups = _ldapgroups_detect_groups();
  if ($groups === false) {
    // Oh, this means this user didn't even have to be here. Bye!
    return true;
  }

  // SUGGESTED REVISION
  $roles = $groups;
  //

  // Next, we apply site-specific rules
  if (function_exists('ldapgroups_roles_filter')) {
    $roles = ldapgroups_roles_filter($groups);
  }

  // Finally, we grant the roles
  //need to check for empty roles
  if ($roles) {
    foreach ($roles as $role) {
      _ldapgroups_create_role($role);
      _ldapgroups_grant_role($user, $role);
    }
  }

Thanks

kreaper’s picture

Gottit -- I won't have access to my mac till tomorrow - so I can update the code then. In the mean time, if scafmac gets to it first, he can update the code as well.

kreaper’s picture

Status: Fixed » Active
kreaper’s picture

Status: Active » Fixed

Committed to HEAD

kreaper’s picture

Status: Fixed » Closed (fixed)

bugfix confirmed by others