You are here

public function LdapServer::groupUserMembershipsFromDn in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_servers/LdapServer.class.php \LdapServer::groupUserMembershipsFromDn()

Get "groups" from derived from DN. Has limited usefulness.

Parameters

mixed:

  • drupal user object (stdClass Object)

    • ldap entry of user (array) (with top level keys of 'dn', 'mail', 'sid' and 'attr' )
    • ldap dn of user (array)
    • drupal username of user (string)

Return value

array of group strings

File

ldap_servers/LdapServer.class.php, line 2046
Defines server classes and related functions.

Class

LdapServer
LDAP Server Class.

Code

public function groupUserMembershipsFromDn($user) {
  if (!$this->groupDeriveFromDn || !$this->groupDeriveFromDnAttr) {
    return FALSE;
  }
  elseif ($user_ldap_entry = $this
    ->userUserToExistingLdapEntry($user)) {
    return ldap_servers_get_all_rdn_values_from_dn($user_ldap_entry['dn'], $this->groupDeriveFromDnAttr);
  }
  else {
    return FALSE;
  }
}