From 8680bafc5c791153488dd32108f4a7d0969edb8c Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 25 Jan 2021 15:26:16 +0100 Subject: Implement expiration date for federated shares Add expiration date field in UI. Save expiration date when creating or updating federated share. Read expiration date from DB in federated share provider. Applies to both federated user and group shares. Signed-off-by: Vincent Petry --- lib/private/Share20/Manager.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 49a716e3216..f7e7f371b51 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -751,6 +751,9 @@ class Manager implements IManager { // Verify the expiration date $share = $this->validateExpirationDateInternal($share); + } elseif ($share->getShareType() === IShare::TYPE_REMOTE || $share->getShareType() === IShare::TYPE_REMOTE_GROUP) { + //Verify the expiration date + $share = $this->validateExpirationDateInternal($share); } elseif ($share->getShareType() === IShare::TYPE_LINK || $share->getShareType() === IShare::TYPE_EMAIL) { $this->linkCreateChecks($share); @@ -999,7 +1002,7 @@ class Manager implements IManager { if (empty($plainTextPassword) && $share->getSendPasswordByTalk()) { throw new \InvalidArgumentException('Can’t enable sending the password by Talk with an empty password'); } - + /** * If we're in a mail share, we need to force a password change * as either the user is not aware of the password or is already (received by mail) @@ -1019,6 +1022,12 @@ class Manager implements IManager { $this->validateExpirationDateLink($share); $expirationDateUpdated = true; } + } elseif ($share->getShareType() === IShare::TYPE_REMOTE || $share->getShareType() === IShare::TYPE_REMOTE_GROUP) { + if ($share->getExpirationDate() != $originalShare->getExpirationDate()) { + //Verify the expiration date + $this->validateExpirationDateInternal($share); + $expirationDateUpdated = true; + } } $this->pathCreateChecks($share->getNode()); -- cgit v1.2.3