You are here

public function LdapBaseManager::queryAllBaseDnLdapForUsername in Lightweight Directory Access Protocol (LDAP) 8.4

Queries LDAP server for the user.

@todo This function does return data and check for validity of response. This makes responses difficult to parse and should be optimized.

Parameters

string $drupal_username: Drupal user name.

Return value

\Symfony\Component\Ldap\Entry|false LDAP Entry.

2 calls to LdapBaseManager::queryAllBaseDnLdapForUsername()
LdapBaseManager::matchUsernameToExistingLdapEntry in ldap_servers/src/LdapBaseManager.php
Match username to existing LDAP entry.
LdapUserManager::getUserDataByIdentifier in ldap_servers/src/LdapUserManager.php
Fetch user data from server by Identifier.

File

ldap_servers/src/LdapBaseManager.php, line 386

Class

LdapBaseManager
LDAP Base Manager.

Namespace

Drupal\ldap_servers

Code

public function queryAllBaseDnLdapForUsername(string $drupal_username) {
  if (!$this
    ->checkAvailability()) {
    return FALSE;
  }
  foreach ($this->server
    ->getBaseDn() as $base_dn) {
    $result = $this
      ->queryLdapForUsername($base_dn, $drupal_username);
    if ($result === FALSE || $result instanceof Entry) {
      return $result;
    }
  }
  return FALSE;
}