public function SimpleLdapUserManager::loadDrupalUser in Simple LDAP 8
Load a Drupal user based on an LDAP user.
Parameters
SimpleLdapUser $user: The LDAP user to check for.
Return value
bool|UserInterface Returns a loaded User object if found, FALSE if otherwise.
File
- modules/
simple_ldap_user/ src/ SimpleLdapUserManager.php, line 129
Class
- SimpleLdapUserManager
- Manages the loading and syncing of data between LDAP server and Drupal.
Namespace
Drupal\simple_ldap_userCode
public function loadDrupalUser(SimpleLdapUser $user) {
$uid = $this
->userIdFromLdapUser($user);
if ($uid === FALSE) {
return FALSE;
}
try {
/** @var \Drupal\user\UserInterface $user */
$user = $this->entity_manager
->getStorage('user')
->load($uid);
return $user;
} catch (PluginException $exception) {
watchdog_exception('simple_ldap_user', $exception);
}
return FALSE;
}