You are here

function _ldapgroups_mapping in LDAP integration 6

Maps LDAP group name to a Drupal role.

Parameters

$account: A user object or sid.

$group: A LDAP group name.

Return value

An Drupal role.

2 calls to _ldapgroups_mapping()
ldapgroups_user_login in ./ldapgroups.inc
Implements hook_user() login operation.
ldapgroups_user_test_output in ./ldapgroups.admin.inc
Generate the test results for the user and ldap settings.

File

./ldapgroups.inc, line 279
ldapgroups include file.

Code

function _ldapgroups_mapping($account, $group) {
  $ldapgroups_mappings = _ldapgroups_ldap_info($account, 'ldapgroups_mappings');
  if (isset($ldapgroups_mappings[$group])) {
    return $ldapgroups_mappings[$group];
  }
  elseif (preg_match('/^[^=]+=([^,]+),.*$/', $group, $matches)) {
    return $matches[1];
  }
  else {
    return $group;
  }
}