summaryrefslogtreecommitdiffstats
path: root/lib/private/share
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2015-03-19 10:07:17 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2015-03-19 10:07:17 +0100
commit3c39658a1ca3a720072df3d98fa012208c6f73e3 (patch)
treea9128cb227760a56c6ad5107e8b0518c667ad40f /lib/private/share
parente40b0701d7afc0d016c3c35ad1fe2a46321b2ad3 (diff)
downloadnextcloud-server-3c39658a1ca3a720072df3d98fa012208c6f73e3.tar.gz
nextcloud-server-3c39658a1ca3a720072df3d98fa012208c6f73e3.zip
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.
Diffstat (limited to 'lib/private/share')
-rw-r--r--lib/private/share/share.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 974ebf41f93..dff3af56f40 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -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);
}