summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/user_ldap.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/user_ldap.php')
-rw-r--r--apps/user_ldap/user_ldap.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 61f84047f1e..57b2ef489ba 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -27,9 +27,6 @@ namespace OCA\user_ldap;
class USER_LDAP extends lib\Access implements \OCP\UserInterface {
- // cache getUsers()
- protected $_users = null;
-
private function updateQuota($dn) {
$quota = null;
if(!empty($this->connection->ldapQuotaDefault)) {
@@ -97,11 +94,13 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface {
* Get a list of all users.
*/
public function getUsers(){
- if(is_null($this->_users)) {
+ $ldap_users = $this->connection->getFromCache('getUsers');
+ if(is_null($ldap_users)) {
$ldap_users = $this->fetchListOfUsers($this->connection->ldapUserFilter, array($this->connection->ldapUserDisplayName, 'dn'));
- $this->_users = $this->ownCloudUserNames($ldap_users);
+ $ldap_users = $this->ownCloudUserNames($ldap_users);
+ $this->connection->writeToCache('getUsers', $ldap_users);
}
- return $this->_users;
+ return $ldap_users;
}
/**
@@ -110,18 +109,25 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface {
* @return boolean
*/
public function userExists($uid){
+ if($this->connection->isCached('userExists'.$uid)) {
+ return $this->connection->getFromCache('userExists'.$uid);
+ }
+
//getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking.
$dn = $this->username2dn($uid);
if(!$dn) {
+ $this->connection->writeToCache('userExists'.$uid, false);
return false;
}
//if user really still exists, we will be able to read his cn
$cn = $this->readAttribute($dn, 'cn');
if(!$cn || empty($cn)) {
+ $this->connection->writeToCache('userExists'.$uid, false);
return false;
}
+ $this->connection->writeToCache('userExists'.$uid, true);
return true;
}