diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-03-28 14:39:38 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-04-03 10:29:32 +0200 |
commit | c191173d5914f77ebac425e315d2b962077bd654 (patch) | |
tree | 221b0239404581c081ed9c79cb82b3fbf15923a3 /apps/files_sharing | |
parent | c6613ee8fcfd19a74bcd4652187c51a642a1fc4c (diff) | |
download | nextcloud-server-c191173d5914f77ebac425e315d2b962077bd654.tar.gz nextcloud-server-c191173d5914f77ebac425e315d2b962077bd654.zip |
allow password protected mail shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 80ba7534da0..bd3535536e4 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -742,12 +742,31 @@ class ShareAPIController extends OCSController { } else { // For other shares only permissions is valid. - if ($permissions === null) { + if ($share->getShareType() !== \OCP\Share::SHARE_TYPE_EMAIL && $permissions === null) { throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given')); - } else { + } elseif ($permissions !== null) { $permissions = (int)$permissions; $share->setPermissions($permissions); } + + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + if ($expireDate === '') { + $share->setExpirationDate(null); + } else if ($expireDate !== null) { + try { + $expireDate = $this->parseDate($expireDate); + } catch (\Exception $e) { + throw new OCSBadRequestException($e->getMessage()); + } + $share->setExpirationDate($expireDate); + } + + if ($password === '') { + $share->setPassword(null); + } else if ($password !== null) { + $share->setPassword($password); + } + } } if ($permissions !== null && $share->getShareOwner() !== $this->currentUser) { |