public function Server::userUsernameFromLdapEntry in Lightweight Directory Access Protocol (LDAP) 8.3
Returns the username from the LDAP entry.
Parameters
array $ldap_entry: The LDAP entry.
Return value
string The user name.
File
- ldap_servers/
src/ Entity/ Server.php, line 1047
Class
- Server
- Defines the Server entity.
Namespace
Drupal\ldap_servers\EntityCode
public function userUsernameFromLdapEntry(array $ldap_entry) {
if ($this
->get('account_name_attr')) {
$accountName = empty($ldap_entry[$this
->get('account_name_attr')][0]) ? FALSE : $ldap_entry[$this
->get('account_name_attr')][0];
}
elseif ($this
->get('user_attr')) {
$accountName = empty($ldap_entry[$this
->get('user_attr')][0]) ? FALSE : $ldap_entry[$this
->get('user_attr')][0];
}
else {
$accountName = FALSE;
}
return $accountName;
}