Commit 3c39658a authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

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.
parent e40b0701
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment