You are here

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

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

UserUsernameFromLdapEntry.

Parameters

array $ldap_entry:

Return value

string user's username value

1 call to LdapServer::userUsernameFromLdapEntry()
LdapServer::userUsernameFromDn in ldap_servers/LdapServer.class.php
UserUsernameFromDn.

File

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

Class

LdapServer
LDAP Server Class.

Code

public function userUsernameFromLdapEntry($ldap_entry) {
  if ($this->account_name_attr) {
    $accountname = empty($ldap_entry[$this->account_name_attr][0]) ? FALSE : $ldap_entry[$this->account_name_attr][0];
  }
  elseif ($this->user_attr) {
    $accountname = empty($ldap_entry[$this->user_attr][0]) ? FALSE : $ldap_entry[$this->user_attr][0];
  }
  else {
    $accountname = FALSE;
  }
  return $accountname;
}