aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-04-21 14:10:33 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2020-04-24 16:18:20 +0200
commitf4b8623d330dcde02f07fa58d7134698744ee790 (patch)
tree66a8d1136f4df5320567d0e7e3be6e4dac46c4c3 /lib
parent4114bce1e5a9177641f112efcca8f777224ded16 (diff)
downloadnextcloud-server-f4b8623d330dcde02f07fa58d7134698744ee790.tar.gz
nextcloud-server-f4b8623d330dcde02f07fa58d7134698744ee790.zip
Allow specifying a default expiration date
This overrides the max expiration date. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/Manager.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index becf29e4cc7..eae26645b55 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -396,7 +396,12 @@ class Manager implements IManager {
if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) {
$expirationDate = new \DateTime();
$expirationDate->setTime(0,0,0);
- $expirationDate->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D'));
+
+ $days = (int)$this->config->getAppValue('core', 'internal_defaultExpDays', $this->shareApiLinkDefaultExpireDays());
+ if ($days > $this->shareApiLinkDefaultExpireDays()) {
+ $days = $this->shareApiLinkDefaultExpireDays();
+ }
+ $expirationDate->add(new \DateInterval('P'.$days.'D'));
}
// If we enforce the expiration date check that is does not exceed
@@ -467,7 +472,12 @@ class Manager implements IManager {
if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
$expirationDate = new \DateTime();
$expirationDate->setTime(0,0,0);
- $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
+
+ $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays());
+ if ($days > $this->shareApiLinkDefaultExpireDays()) {
+ $days = $this->shareApiLinkDefaultExpireDays();
+ }
+ $expirationDate->add(new \DateInterval('P'.$days.'D'));
}
// If we enforce the expiration date check that is does not exceed