summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2021-03-04 13:49:21 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-03-04 18:52:30 +0000
commit8ab601cf66382b56bf7c057a6ab6acc72fa6407f (patch)
tree87a507486ca5474df9e91e7997ab149ae7bda204 /apps/sharebymail/lib
parent4df7cf1f54bdc10fe7dce11f396ab3a568977e47 (diff)
downloadnextcloud-server-8ab601cf66382b56bf7c057a6ab6acc72fa6407f.tar.gz
nextcloud-server-8ab601cf66382b56bf7c057a6ab6acc72fa6407f.zip
Sharebymail: set expiration on creation
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 5977cbd18bb..6ac75ce85d9 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -321,7 +321,8 @@ class ShareByMailProvider implements IShareProvider {
$share->getToken(),
$share->getPassword(),
$share->getSendPasswordByTalk(),
- $share->getHideDownload()
+ $share->getHideDownload(),
+ $share->getExpirationDate()
);
try {
@@ -649,9 +650,10 @@ class ShareByMailProvider implements IShareProvider {
* @param string $password
* @param bool $sendPasswordByTalk
* @param bool $hideDownload
+ * @param \DateTime|null $expirationTime
* @return int
*/
- protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload) {
+ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $expirationTime) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL))
@@ -668,6 +670,10 @@ class ShareByMailProvider implements IShareProvider {
->setValue('stime', $qb->createNamedParameter(time()))
->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT));
+ if ($expirationTime !== null) {
+ $qb->setValue('expiration', $qb->createNamedParameter($expirationTime, IQueryBuilder::PARAM_DATE));
+ }
+
/*
* Added to fix https://github.com/owncloud/core/issues/22215
* Can be removed once we get rid of ajax/share.php