Skip to content
Snippets Groups Projects
Commit 0d9534eb authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

LDAP: cheaper userExists() implementation

parent 65c14e21
No related branches found
No related tags found
No related merge requests found
......@@ -124,7 +124,19 @@ class OC_USER_LDAP extends OC_User_Backend {
* @return boolean
*/
public function userExists($uid){
return in_array($uid, $this->getUsers());
//getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking.
$dn = OC_LDAP::username2dn($uid);
if(!$dn) {
return false;
}
//if user really still exists, we will be able to read his cn
$cn = OC_LDAP::readAttribute($dn, 'cn');
if(!$cn || empty($cn)) {
return false;
}
return true;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment