diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-08-12 10:56:23 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-08-21 08:30:17 +0200 |
commit | b557f52c2290379b99838f86c7ab90892b955b41 (patch) | |
tree | f4159cc4446ebe5dec2fd042d4a69f3a715ad977 /lib/private/Share20 | |
parent | dd02920aedc63e89c8c8cf2e2c41344954bac08c (diff) | |
download | nextcloud-server-b557f52c2290379b99838f86c7ab90892b955b41.tar.gz nextcloud-server-b557f52c2290379b99838f86c7ab90892b955b41.zip |
Add expiration event for shares
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r-- | lib/private/Share20/Manager.php | 3 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 2a2c64cf383..2e8e6f9a3af 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1313,8 +1313,7 @@ class Manager implements IManager { } protected function checkExpireDate($share) { - if ($share->getExpirationDate() !== null && - $share->getExpirationDate() <= new \DateTime()) { + if ($share->isExpired()) { $this->deleteShare($share); throw new ShareNotFound($this->l->t('The requested share does not exist anymore')); } diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index f9b548c1adf..9ce88b5af22 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -371,6 +371,14 @@ class Share implements \OCP\Share\IShare { /** * @inheritdoc */ + public function isExpired() { + return $this->getExpirationDate() !== null && + $this->getExpirationDate() <= new \DateTime(); + } + + /** + * @inheritdoc + */ public function setSharedBy($sharedBy) { if (!is_string($sharedBy)) { throw new \InvalidArgumentException(); |