[Pkg-owncloud-commits] [owncloud] 350/394: LDAP: backport basic fix from PR #1493 to fix bug #1450 in stable45

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:48 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 1fa54ef9bb7383565c6986a2c09595087e5545e5
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Fri Feb 15 13:21:27 2013 +0100

    LDAP: backport basic fix from PR #1493 to fix bug #1450 in stable45
---
 apps/user_ldap/user_ldap.php |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index e9c8c93..063cddf 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;
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list