function _ldap_servers_get_user_ldap_data in Lightweight Directory Access Protocol (LDAP) 7
@file collection of functions that don't belong in server object
1 call to _ldap_servers_get_user_ldap_data()
- ldap_servers_get_user_ldap_data in ldap_servers/
ldap_servers.module
File
- ldap_servers/
ldap_servers.inc, line 9 - collection of functions that don't belong in server object
Code
function _ldap_servers_get_user_ldap_data($drupal_user, $sid) {
if (is_object($drupal_user) && isset($drupal_user->uid) && ($authname = db_query("SELECT authname FROM {authmap} WHERE uid = :uid AND module = 'ldap_authentication'", array(
':uid' => $drupal_user->uid,
))
->fetchColumn())) {
$drupal_username = $authname;
}
else {
$drupal_username = is_object($drupal_user) ? $drupal_user->name : $drupal_user;
}
$servers = ldap_servers_get_servers($sid, 'enabled');
foreach ($servers as $sid => $ldap_server) {
if ($ldap_user = $ldap_server
->user_lookup($drupal_username)) {
return $ldap_user;
}
}
return FALSE;
}