summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-08-21 16:15:23 +0200
committerJoas Schilling <coding@schilljs.com>2019-11-12 17:13:38 +0100
commitdcdbea54e60d13d2508b71ebdcb7992f2ae5ef34 (patch)
tree4157d8fbbec25f53ab99df3c7e495f8d8862fc36 /lib
parent6f8c7885b6263b7e23f0e48c1376b7e67417be2c (diff)
downloadnextcloud-server-dcdbea54e60d13d2508b71ebdcb7992f2ae5ef34.tar.gz
nextcloud-server-dcdbea54e60d13d2508b71ebdcb7992f2ae5ef34.zip
Respect the accepted flag for group and user shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/DefaultShareProvider.php3
-rw-r--r--lib/private/Share20/Share.php17
-rw-r--r--lib/public/Share/IShare.php34
3 files changed, 54 insertions, 0 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index 05b3094e6a2..61c62364153 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -142,6 +142,7 @@ class DefaultShareProvider implements IShareProvider {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
//Set the UID of the user we share with
$qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith()));
+ $qb->setValue('accepted', $qb->createNamedParameter(IShare::STATUS_PENDING));
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
//Set the GID of the group we share with
$qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith()));
@@ -932,6 +933,7 @@ class DefaultShareProvider implements IShareProvider {
->setTarget($data['file_target'])
->setNote($data['note'])
->setMailSend((bool)$data['mail_send'])
+ ->setStatus((int)$data['accepted'])
->setLabel($data['label']);
$shareTime = new \DateTime();
@@ -1020,6 +1022,7 @@ class DefaultShareProvider implements IShareProvider {
while($data = $stmt->fetch()) {
$shareMap[$data['parent']]->setPermissions((int)$data['permissions']);
+ $shareMap[$data['parent']]->setStatus((int)$data['accepted']);
$shareMap[$data['parent']]->setTarget($data['file_target']);
$shareMap[$data['parent']]->setParent($data['parent']);
}
diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php
index 9ce88b5af22..57b5304b102 100644
--- a/lib/private/Share20/Share.php
+++ b/lib/private/Share20/Share.php
@@ -58,6 +58,8 @@ class Share implements \OCP\Share\IShare {
private $shareOwner;
/** @var int */
private $permissions;
+ /** @var int */
+ private $status;
/** @var string */
private $note = '';
/** @var \DateTime */
@@ -321,6 +323,21 @@ class Share implements \OCP\Share\IShare {
/**
* @inheritdoc
*/
+ public function setStatus(int $status): IShare {
+ $this->status = $status;
+ return $this;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getStatus(): int {
+ return $this->status;
+ }
+
+ /**
+ * @inheritdoc
+ */
public function setNote($note) {
$this->note = $note;
return $this;
diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php
index 3b16fcaec0f..a4d120da5f4 100644
--- a/lib/public/Share/IShare.php
+++ b/lib/public/Share/IShare.php
@@ -97,6 +97,21 @@ interface IShare {
// const TYPE_USERROOM = 11;
/**
+ * @since 18.0.0
+ */
+ public const STATUS_PENDING = 0;
+
+ /**
+ * @since 18.0.0
+ */
+ public const STATUS_ACCEPTED = 1;
+
+ /**
+ * @since 18.0.0
+ */
+ public const STATUS_REJECTED = 2;
+
+ /**
* Set the internal id of the share
* It is only allowed to set the internal id of a share once.
* Attempts to override the internal id will result in an IllegalIDChangeException
@@ -280,6 +295,25 @@ interface IShare {
public function getPermissions();
/**
+ * Set the accepted status
+ * See self::STATUS_*
+ *
+ * @param int $status
+ * @return IShare The modified object
+ * @since 18.0.0
+ */
+ public function setStatus(int $status): IShare;
+
+ /**
+ * Get the accepted status
+ * See self::STATUS_*
+ *
+ * @return int
+ * @since 18.0.0
+ */
+ public function getStatus(): int;
+
+ /**
* Attach a note to a share
*
* @param string $note