summaryrefslogtreecommitdiffstats
path: root/lib/private/share/share.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-30 10:50:12 +0200
committerVincent Petry <pvince81@owncloud.com>2015-08-30 10:50:12 +0200
commit045f8cc97101521cafd664faf7b8f24ea9e88451 (patch)
tree9ae066c9370d09a88c8bb1890b05a7eac62ab0bc /lib/private/share/share.php
parent114d1acd2ca9f254b7e6639a2e1f0a1748e4c254 (diff)
parent2aff11c80bbc7fb0524c52d17824d68bda43aac5 (diff)
downloadnextcloud-server-045f8cc97101521cafd664faf7b8f24ea9e88451.tar.gz
nextcloud-server-045f8cc97101521cafd664faf7b8f24ea9e88451.zip
Merge pull request #18651 from owncloud/ocs_share_create_with_expire
Allow to directly set the expireDate on a new (link)share
Diffstat (limited to 'lib/private/share/share.php')
-rw-r--r--lib/private/share/share.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index c245f0f88a9..d0c69badb46 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -649,6 +649,21 @@ class Share extends Constants {
$permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE;
}
+ //Validate expirationDate
+ if ($expirationDate !== null) {
+ try {
+ /*
+ * Reuse the validateExpireDate.
+ * We have to pass time() since the second arg is the time
+ * the file was shared, since it is not shared yet we just use
+ * the current time.
+ */
+ $expirationDate = self::validateExpireDate($expirationDate->format('Y-m-d'), time(), $itemType, $itemSource);
+ } catch (\Exception $e) {
+ throw new \OC\HintException($e->getMessage(), $e->getMessage(), 404);
+ }
+ }
+
// Verify share type and sharing conditions are met
if ($shareType === self::SHARE_TYPE_USER) {
if ($shareWith == $uidOwner) {