aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/user_ldap.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-06-22 12:42:07 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-06-22 12:42:07 +0200
commitbef9b671ee6beb36a0f10ac755b32477ef5f77e6 (patch)
tree33b464d75aa57861ae1587b1a0d09b5f6d56635d /apps/user_ldap/user_ldap.php
parentdf60d6d5d2e905d3df9095d244e756fd60fd8c01 (diff)
downloadnextcloud-server-bef9b671ee6beb36a0f10ac755b32477ef5f77e6.tar.gz
nextcloud-server-bef9b671ee6beb36a0f10ac755b32477ef5f77e6.zip
LDAP: cheaper userExists() implementation
Diffstat (limited to 'apps/user_ldap/user_ldap.php')
-rw-r--r--apps/user_ldap/user_ldap.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 9281aebe81d..48e7d429fcb 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -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;
}
}