You are here

public function LdapGroupManager::groupUserMembershipsFromDn in Lightweight Directory Access Protocol (LDAP) 8.4

Get "groups" from derived from DN.

Has limited usefulness.

Parameters

string $username: A username.

Return value

array Array of group strings.

File

ldap_servers/src/LdapGroupManager.php, line 696

Class

LdapGroupManager
LDAP Group Manager.

Namespace

Drupal\ldap_servers

Code

public function groupUserMembershipsFromDn(string $username) : array {
  $memberships = [];
  if ($this
    ->checkAvailability() && $this->server
    ->isGroupDerivedFromDn() && $this->server
    ->getDerivedGroupFromDnAttribute()) {
    $ldap_entry = $this
      ->matchUsernameToExistingLdapEntry($username);
    if ($ldap_entry) {
      $memberships = $this
        ->getAllRdnValuesFromDn($ldap_entry
        ->getDn(), $this->server
        ->getDerivedGroupFromDnAttribute());
    }
  }
  return $memberships;
}