diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-06-11 18:24:45 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-06-18 22:01:42 +0200 |
commit | 7bd7056a4c426730c2885c0e301bea4ebdae5524 (patch) | |
tree | 17d340f6512d604c70a7401655f6de8fd9bc47da | |
parent | ac8b748b88931f0191367ad803963d636850909e (diff) | |
download | nextcloud-server-7bd7056a4c426730c2885c0e301bea4ebdae5524.tar.gz nextcloud-server-7bd7056a4c426730c2885c0e301bea4ebdae5524.zip |
Backport of #16890 to stable8
the user is gone, userExists will not bring him back. But the user's folder needs to be deleted anyway
delete user test to take getHome into account to ensure it is also deleted subsequently
-rw-r--r-- | apps/user_ldap/tests/user_ldap.php | 5 | ||||
-rw-r--r-- | apps/user_ldap/user_ldap.php | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php index 119b0b186d4..f8ac4a11c6a 100644 --- a/apps/user_ldap/tests/user_ldap.php +++ b/apps/user_ldap/tests/user_ldap.php @@ -253,12 +253,15 @@ class Test_User_Ldap_Direct extends \Test\TestCase { $config = $this->getMock('\OCP\IConfig'); $config->expects($this->exactly(2)) ->method('getUserValue') - ->will($this->returnValue(1)); + ->will($this->onConsecutiveCalls('1', '/var/vhome/jdings/')); $backend = new UserLDAP($access, $config); $result = $backend->deleteUser('jeremy'); $this->assertTrue($result); + + $home = $backend->getHome('jeremy'); + $this->assertSame($home, '/var/vhome/jdings/'); } /** diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index c65c68d609c..69c4af0ebbf 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -196,6 +196,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn } //getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking. $user = $this->access->userManager->get($uid); + if(is_null($user)) { \OCP\Util::writeLog('user_ldap', 'No DN found for '.$uid.' on '. $this->access->connection->ldapHost, \OCP\Util::DEBUG); @@ -247,16 +248,16 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn * @return string|bool */ public function getHome($uid) { - // user Exists check required as it is not done in user proxy! - if(!$this->userExists($uid)) { - return false; - } - if(isset($this->homesToKill[$uid]) && !empty($this->homesToKill[$uid])) { //a deleted user who needs some clean up return $this->homesToKill[$uid]; } + // user Exists check required as it is not done in user proxy! + if(!$this->userExists($uid)) { + return false; + } + $cacheKey = 'getHome'.$uid; if($this->access->connection->isCached($cacheKey)) { return $this->access->connection->getFromCache($cacheKey); |