diff options
Diffstat (limited to 'apps/user_ldap/user_ldap.php')
-rw-r--r-- | apps/user_ldap/user_ldap.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index e9c8c934053..063cddf39d5 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -169,6 +169,10 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { * @return boolean */ private function determineHomeDir($uid) { + $cacheKey = 'getHome'.$uid; + if($this->connection->isCached($cacheKey)) { + return $this->connection->getFromCache($cacheKey); + } if(strpos($this->connection->homeFolderNamingRule, 'attr:') === 0) { $attr = substr($this->connection->homeFolderNamingRule, strlen('attr:')); $homedir = $this->readAttribute($this->username2dn($uid), $attr); @@ -185,15 +189,14 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { $homedir = \OCP\Config::getSystemValue( "datadirectory", \OC::$SERVERROOT."/data" ) . '/' . $homedir[0]; } - \OCP\Config::setUserValue($uid, 'user_ldap', 'homedir', $homedir); + $this->connection->writeToCache($cacheKey, $homedir); return $homedir; } } //fallback and default: username - $homedir = \OCP\Config::getSystemValue( "datadirectory", \OC::$SERVERROOT."/data" ) . '/' . $uid; - \OCP\Config::setUserValue($uid, 'user_ldap', 'homedir', $homedir); - return $homedir; + $this->connection->writeToCache($cacheKey, false); + return false; } /** @@ -203,11 +206,7 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { */ public function getHome($uid) { if($this->userExists($uid)) { - $homedir = \OCP\Config::getUserValue($uid, 'user_ldap', 'homedir', false); - if(!$homedir) { - $homedir = $this->determineHomeDir($uid); - } - return $homedir; + return $this->determineHomeDir($uid); } return false; } |