fix and more robustness thx to scrutinizer

This commit is contained in:
Arthur Schiwon 2015-02-20 13:54:28 +01:00
parent 66bc8145a9
commit a418150470
1 changed files with 4 additions and 1 deletions

View File

@ -80,6 +80,9 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
try {
$ldapRecord = $this->getLDAPUserByLoginName($loginName);
$user = $this->access->userManager->get($ldapRecord['dn']);
if($user instanceof OfflineUser) {
return false;
}
return $user->getUsername();
} catch (\Exception $e) {
return false;
@ -140,7 +143,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
$dpn = $ldapRecord[$this->access->connection->ldapUserDisplayName];
$user->storeDisplayName($dpn);
}
if(isset($users[0]['uid'])) {
if(isset($ldapRecord['uid'])) {
$user->storeLDAPUserName($ldapRecord['uid']);
} else if(isset($ldapRecord['samaccountname'])) {
$user->storeLDAPUserName($ldapRecord['samaccountname']);