Merge pull request #6678 from nextcloud/downstream-ldap-configurable-user-update

LDAP: configurable user update  interval
This commit is contained in:
John Molakvoæ 2017-11-13 08:14:52 +01:00 committed by GitHub
commit 8e61ad8847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -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)) < intval($this->config->getAppValue('user_ldap', 'updateAttributesInterval', 86400)) ) {
return false;
}
return true;

View File

@ -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())