You are here

public function Server::groupUserMembershipsFromDn in Lightweight Directory Access Protocol (LDAP) 8.3

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

Parameters

mixed $user: A Drupal user entity, an LDAP entry array of a user or a username.

Return value

array|bool Array of group strings.

File

ldap_servers/src/Entity/Server.php, line 1561

Class

Server
Defines the Server entity.

Namespace

Drupal\ldap_servers\Entity

Code

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