From 0b290c090480c81cd7ee7209489aaacc1cefb38f Mon Sep 17 00:00:00 2001 From: sidey79 Date: Fri, 4 Aug 2017 22:54:48 +0200 Subject: Update User.php Makes the time between needsRefresh configurable via app config option updateAttribuesInterval. Default is still 86400 secons which is one day. Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/User/User.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apps/user_ldap') diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index afd43999c7f..a295e7fe6f2 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -387,8 +387,7 @@ class User { $lastChecked = $this->config->getUserValue($this->uid, 'user_ldap', self::USER_PREFKEY_LASTREFRESH, 0); - //TODO make interval configurable - if((time() - intval($lastChecked)) < 86400 ) { + if((time() - intval($lastChecked)) < $this->config->getAppValue('user_ldap', 'updateAttribuesInterval', 86400) ) { return false; } return true; -- cgit v1.2.3 From 039f6c9636cf57d6206fce8c157f4fac0d03e406 Mon Sep 17 00:00:00 2001 From: sidey79 Date: Tue, 8 Aug 2017 21:10:46 +0200 Subject: Fixed Typo in user.php Fixed a typo for the app config prameter updateAttributesInterval Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/User/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/user_ldap') diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index a295e7fe6f2..2ad395275d2 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -387,7 +387,7 @@ class User { $lastChecked = $this->config->getUserValue($this->uid, 'user_ldap', self::USER_PREFKEY_LASTREFRESH, 0); - if((time() - intval($lastChecked)) < $this->config->getAppValue('user_ldap', 'updateAttribuesInterval', 86400) ) { + if((time() - intval($lastChecked)) < $this->config->getAppValue('user_ldap', 'updateAttributesInterval', 86400) ) { return false; } return true; -- cgit v1.2.3 From 45dfc1113725c27bfbf4dbc433d8df873bc764cb Mon Sep 17 00:00:00 2001 From: sidey79 Date: Tue, 8 Aug 2017 21:53:55 +0200 Subject: tryfix needsRefresh unit tests Forced updateAttributesInterval from getAppValue to int Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/User/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/user_ldap') diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 2ad395275d2..c93d2a77d80 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -387,7 +387,7 @@ class User { $lastChecked = $this->config->getUserValue($this->uid, 'user_ldap', self::USER_PREFKEY_LASTREFRESH, 0); - if((time() - intval($lastChecked)) < $this->config->getAppValue('user_ldap', 'updateAttributesInterval', 86400) ) { + if((time() - intval($lastChecked)) < intval($this->config->getAppValue('user_ldap', 'updateAttributesInterval', 86400)) ) { return false; } return true; -- cgit v1.2.3 From ea0ad82e5684b61c6b2536642a73a360db346e43 Mon Sep 17 00:00:00 2001 From: sidey79 Date: Wed, 9 Aug 2017 21:52:23 +0200 Subject: Update testUpdateNoRefresh Mocked getAppValue to deliver a value of 1800 when updateAttributesInterval is requested by needsRefresh. Signed-off-by: Arthur Schiwon --- apps/user_ldap/tests/User/UserTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'apps/user_ldap') diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 5e911159285..8e4bb93c555 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -871,7 +871,14 @@ class UserTest extends \Test\TestCase { ->with($this->equalTo('alice'), $this->equalTo('user_ldap'), $this->equalTo(User::USER_PREFKEY_LASTREFRESH), $this->equalTo(0)) - ->will($this->returnValue(time())); + ->will($this->returnValue(time() - 10)); + + $config->expects($this->once()) + ->method('getAppValue') + ->with($this->equalTo('user_ldap'), + $this->equalTo('updateAttributesInterval'), + $this->anything()) + ->will($this->returnValue(1800); $config->expects($this->exactly(2)) ->method('getUserValue'); $config->expects($this->never()) -- cgit v1.2.3 From fbd8c5db4f2e1ca39c3576c9642058b00696474a Mon Sep 17 00:00:00 2001 From: sidey79 Date: Wed, 9 Aug 2017 22:28:35 +0200 Subject: Fixed typo from last commit Fixed typo in getAppValue mocket method from last commit Signed-off-by: Arthur Schiwon --- apps/user_ldap/tests/User/UserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/user_ldap') diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 8e4bb93c555..7fb1007befe 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -878,7 +878,7 @@ class UserTest extends \Test\TestCase { ->with($this->equalTo('user_ldap'), $this->equalTo('updateAttributesInterval'), $this->anything()) - ->will($this->returnValue(1800); + ->will($this->returnValue(1800)); $config->expects($this->exactly(2)) ->method('getUserValue'); $config->expects($this->never()) -- cgit v1.2.3 From d536e4e3b8ea608e14d0b0192bcadd216d460b4d Mon Sep 17 00:00:00 2001 From: sidey79 Date: Thu, 10 Aug 2017 09:24:39 +0200 Subject: Fixed indentation Fixed indentation of this pr Signed-off-by: Arthur Schiwon --- apps/user_ldap/tests/User/UserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/user_ldap') diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 7fb1007befe..27bd7762e39 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -871,7 +871,7 @@ class UserTest extends \Test\TestCase { ->with($this->equalTo('alice'), $this->equalTo('user_ldap'), $this->equalTo(User::USER_PREFKEY_LASTREFRESH), $this->equalTo(0)) - ->will($this->returnValue(time() - 10)); + ->will($this->returnValue(time() - 10)); $config->expects($this->once()) ->method('getAppValue') -- cgit v1.2.3