Merge pull request #22673 from owncloud/fix_enforced_expire_date_setting

Expiration date can only be enforced if default is enabled
This commit is contained in:
Thomas Müller 2016-02-29 07:08:57 +01:00
commit 3e8e0049b4
2 changed files with 17 additions and 1 deletions

View File

@ -1079,7 +1079,8 @@ class Manager implements IManager {
* @return bool
*/
public function shareApiLinkDefaultExpireDateEnforced() {
return $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
return $this->shareApiLinkDefaultExpireDate() &&
$this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
}
/**

View File

@ -746,12 +746,27 @@ class ManagerTest extends \Test\TestCase {
$this->config->method('getAppValue')
->will($this->returnValueMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
]));
$this->invokePrivate($this->manager, 'validateExpirationDate', [$share]);
}
public function testvalidateExpirationDateEnforceButNotEnabledAndNotSet() {
$share = $this->manager->newShare();
$share->setProviderId('foo')->setId('bar');
$this->config->method('getAppValue')
->will($this->returnValueMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
]));
$this->invokePrivate($this->manager, 'validateExpirationDate', [$share]);
$this->assertNull($share->getExpirationDate());
}
public function testvalidateExpirationDateEnforceButNotSetNewShare() {
$share = $this->manager->newShare();