When the expiration date is enforced respect this
Make sure that we do not allow removing of the expiration date when this is enforced in the settings.
This commit is contained in:
parent
e40b0701d7
commit
3c39658a1c
|
@ -1097,9 +1097,17 @@ class Share extends \OC\Share\Constants {
|
|||
*/
|
||||
public static function setExpirationDate($itemType, $itemSource, $date, $shareTime = null) {
|
||||
$user = \OC_User::getUser();
|
||||
$l = \OC::$server->getL10N('lib');
|
||||
|
||||
if ($date == '') {
|
||||
$date = null;
|
||||
if (\OCP\Util::isDefaultExpireDateEnforced()) {
|
||||
$warning = 'Cannot clear expiration date. Shares are required to have an expiration date.';
|
||||
$warning_t = $l->t('Cannot clear expiration date. Shares are required to have an expiration date.');
|
||||
\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
|
||||
throw new \Exception($warning_t);
|
||||
} else {
|
||||
$date = null;
|
||||
}
|
||||
} else {
|
||||
$date = self::validateExpireDate($date, $shareTime, $itemType, $itemSource);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue