]> source.dussan.org Git - nextcloud-server.git/commitdiff
allow to update lables for public link shares
authorBjoern Schiessle <bjoern@schiessle.org>
Wed, 17 Oct 2018 08:50:58 +0000 (10:50 +0200)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 1 Nov 2018 01:18:55 +0000 (02:18 +0100)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
apps/files_sharing/lib/Controller/ShareAPIController.php
lib/private/Share20/DefaultShareProvider.php

index 9fb78533a43a4fcb17c89a00198732402a0b850b..61fad5d2b148b2067dde660efbe0d5de38f65d4f 100644 (file)
@@ -745,6 +745,7 @@ class ShareAPIController extends OCSController {
         * @param string $publicUpload
         * @param string $expireDate
         * @param string $note
+        * @param string $label
         * @param string $hideDownload
         * @return DataResponse
         * @throws LockedException
@@ -761,6 +762,7 @@ class ShareAPIController extends OCSController {
                string $publicUpload = null,
                string $expireDate = null,
                string $note = null,
+               string $label = null,
                string $hideDownload = null
        ): DataResponse {
                try {
@@ -775,7 +777,15 @@ class ShareAPIController extends OCSController {
                        throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist'));
                }
 
-               if ($permissions === null && $password === null && $sendPasswordByTalk === null && $publicUpload === null && $expireDate === null && $note === null && $hideDownload === null) {
+               if ($permissions === null &&
+                       $password === null &&
+                       $sendPasswordByTalk === null &&
+                       $publicUpload === null &&
+                       $expireDate === null &&
+                       $note === null &&
+                       $label === null &&
+                       $hideDownload === null
+               ) {
                        throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given'));
                }
 
@@ -859,6 +869,10 @@ class ShareAPIController extends OCSController {
                                $share->setPassword($password);
                        }
 
+                       if ($label !== null) {
+                               $share->setLabel($label);
+                       }
+
                } else {
                        if ($permissions !== null) {
                                $permissions = (int)$permissions;
index dc0ecea880771bd36f740048d74ca33cb2517618..50111054546c80c3b96dcf17b083928735879293 100644 (file)
@@ -301,6 +301,7 @@ class DefaultShareProvider implements IShareProvider {
                                ->set('token', $qb->createNamedParameter($share->getToken()))
                                ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
                                ->set('note', $qb->createNamedParameter($share->getNote()))
+                               ->set('label', $qb->createNamedParameter($share->getLabel()))
                                ->set('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0), IQueryBuilder::PARAM_INT)
                                ->execute();
                }