summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2019-08-26 12:58:51 +0200
committerGitHub <noreply@github.com>2019-08-26 12:58:51 +0200
commitb1a0d464ba599e32936f284e7bdba0bf246ab70c (patch)
tree3f79e491eb6933fe3c2b5b01f0ae5e0c4c1e58bc /lib
parent40edabaf6170e74d319d11585b673316348e1ff3 (diff)
parentb557f52c2290379b99838f86c7ab90892b955b41 (diff)
downloadnextcloud-server-b1a0d464ba599e32936f284e7bdba0bf246ab70c.tar.gz
nextcloud-server-b1a0d464ba599e32936f284e7bdba0bf246ab70c.zip
Merge pull request #16723 from nextcloud/fix/sharing/unshare-message
Add expiration event for shares
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/Manager.php3
-rw-r--r--lib/private/Share20/Share.php8
-rw-r--r--lib/public/Share/IShare.php8
3 files changed, 17 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();
diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php
index 60bbe31d406..3b16fcaec0f 100644
--- a/lib/public/Share/IShare.php
+++ b/lib/public/Share/IShare.php
@@ -315,6 +315,14 @@ interface IShare {
public function getExpirationDate();
/**
+ * Is the share expired ?
+ *
+ * @return boolean
+ * @since 18.0.0
+ */
+ public function isExpired();
+
+ /**
* set a label for a share, some shares, e.g. public links can have a label
*
* @param string $label