From 18c35a7ab00b7f24c80896f5b0651ec43a12cc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Wed, 16 Aug 2017 09:56:37 +0200 Subject: [PATCH 1/3] Keep the current quota if no suitable quota is found Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/User/User.php | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 5017f35ed0a4f..a46b0053b40d4 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -529,7 +529,6 @@ public function updateQuota($valueFromLDAP = null) { $targetUser->setQuota($quota); } else { $this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN); - $targetUser->setQuota('default'); } } else { $this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', \OCP\Util::ERROR); From b8afb84b18be9991df30b5402d4ce06649a913b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Wed, 16 Aug 2017 11:10:23 +0200 Subject: [PATCH 2/3] Adjust unittest Signed-off-by: Arthur Schiwon --- apps/user_ldap/tests/User/UserTest.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 5563eeef9cfd9..27409489a9b24 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -453,9 +453,8 @@ public function testUpdateQuotaNoneProvided() { ->will($this->returnValue(false)); $user = $this->createMock('\OCP\IUser'); - $user->expects($this->once()) - ->method('setQuota') - ->with('default'); + $user->expects($this->never()) + ->method('setQuota'); $userMgr->expects($this->once()) ->method('get') @@ -495,9 +494,8 @@ public function testUpdateQuotaNoneConfigured() { ->method('__get'); $user = $this->createMock('\OCP\IUser'); - $user->expects($this->once()) - ->method('setQuota') - ->with('default'); + $user->expects($this->never()) + ->method('setQuota'); $userMgr->expects($this->once()) ->method('get') @@ -633,9 +631,8 @@ public function testUpdateWrongDefaultQuotaProvided() { ->will($this->returnValue(false)); $user = $this->createMock('\OCP\IUser'); - $user->expects($this->once()) - ->method('setQuota') - ->with('default'); + $user->expects($this->never()) + ->method('setQuota'); $userMgr->expects($this->once()) ->method('get') @@ -681,9 +678,8 @@ public function testUpdateWrongQuotaAndDefaultAllProvided() { ->will($this->returnValue(array('23 flush'))); $user = $this->createMock('\OCP\IUser'); - $user->expects($this->once()) - ->method('setQuota') - ->with('default'); + $user->expects($this->never()) + ->method('setQuota'); $userMgr->expects($this->once()) ->method('get') @@ -726,9 +722,8 @@ public function testUpdateWrongDefaultQuotaNotProvided() { ->method('readAttribute'); $user = $this->createMock('\OCP\IUser'); - $user->expects($this->once()) - ->method('setQuota') - ->with('default'); + $user->expects($this->never()) + ->method('setQuota'); $userMgr->expects($this->once()) ->method('get') From 791fa6905f6f2b2991c65c366461f761653efcc5 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 28 Sep 2017 01:16:57 +0200 Subject: [PATCH 3/3] and add missing whitespaces to log outout Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/Connection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 10fbea7174bfe..5b5991e499578 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -436,8 +436,8 @@ private function doCriticalValidation() { || ($agent !== '' && $pwd === '') ) { \OCP\Util::writeLog('user_ldap', - $errorStr.'either no password is given for the'. - 'user agent or a password is given, but not an'. + $errorStr.'either no password is given for the '. + 'user agent or a password is given, but not an '. 'LDAP agent.', \OCP\Util::WARN); $configurationOK = false;