diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-10-16 10:31:38 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-01 02:15:07 +0100 |
commit | f377a61f90065439e2f176669079c00d522adf12 (patch) | |
tree | 25ea0a4c30facec9c660d1a044be175505906c01 /lib/private/Share20 | |
parent | d0411b2369e285b8c82e49294244032ca9624075 (diff) | |
download | nextcloud-server-f377a61f90065439e2f176669079c00d522adf12.tar.gz nextcloud-server-f377a61f90065439e2f176669079c00d522adf12.zip |
allow to add labels to shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 8 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 17 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 3dcca0facbc..dc0ecea8807 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -146,6 +146,8 @@ class DefaultShareProvider implements IShareProvider { //Set the GID of the group we share with $qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith())); } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + //set label for public link + $qb->setValue('label', $qb->createNamedParameter($share->getLabel())); //Set the token of the share $qb->setValue('token', $qb->createNamedParameter($share->getToken())); @@ -225,6 +227,9 @@ class DefaultShareProvider implements IShareProvider { * * @param \OCP\Share\IShare $share * @return \OCP\Share\IShare The share object + * @throws ShareNotFound + * @throws \OCP\Files\InvalidPathException + * @throws \OCP\Files\NotFoundException */ public function update(\OCP\Share\IShare $share) { @@ -919,7 +924,8 @@ class DefaultShareProvider implements IShareProvider { ->setPermissions((int)$data['permissions']) ->setTarget($data['file_target']) ->setNote($data['note']) - ->setMailSend((bool)$data['mail_send']); + ->setMailSend((bool)$data['mail_send']) + ->setLabel($data['label']); $shareTime = new \DateTime(); $shareTime->setTimestamp((int)$data['stime']); diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index e218360f87b..f9b548c1adf 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -76,6 +76,8 @@ class Share implements \OCP\Share\IShare { private $shareTime; /** @var bool */ private $mailSend; + /** @var string */ + private $label = ''; /** @var IRootFolder */ private $rootFolder; @@ -337,6 +339,21 @@ class Share implements \OCP\Share\IShare { /** * @inheritdoc */ + public function setLabel($label) { + $this->label = $label; + return $this; + } + + /** + * @inheritdoc + */ + public function getLabel() { + return $this->label; + } + + /** + * @inheritdoc + */ public function setExpirationDate($expireDate) { //TODO checks |