summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/Manager.php
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-05-18 14:54:27 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-07-28 16:53:22 +0200
commita95c19e14b5a371240392de480278ee97c01ab12 (patch)
treec96d6efaa88d234cdc3393e5004fd27cfc174ebe /lib/private/Share20/Manager.php
parentee23f41abe2fd53d00f44d9c16ebd722ac93e9a3 (diff)
downloadnextcloud-server-a95c19e14b5a371240392de480278ee97c01ab12.tar.gz
nextcloud-server-a95c19e14b5a371240392de480278ee97c01ab12.zip
Add share attributes + prevent download permission
Makes it possible to store download permission Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 25511491a24..d0120a299be 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -70,6 +70,7 @@ use OCP\Share;
use OCP\Share\Exceptions\AlreadySharedException;
use OCP\Share\Exceptions\GenericShareException;
use OCP\Share\Exceptions\ShareNotFound;
+use OCP\Share\IAttributes;
use OCP\Share\IManager;
use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
@@ -1093,6 +1094,7 @@ class Manager implements IManager {
'shareWith' => $share->getSharedWith(),
'uidOwner' => $share->getSharedBy(),
'permissions' => $share->getPermissions(),
+ 'attributes' => $share->getAttributes(),
'path' => $userFolder->getRelativePath($share->getNode()->getPath()),
]);
}
@@ -2087,4 +2089,16 @@ class Manager implements IManager {
yield from $provider->getAllShares();
}
}
+
+ /**
+ * @param IAttributes|null $perms
+ * @return string
+ */
+ private function hashAttributes($perms) {
+ if ($perms === null || empty($perms->toArray())) {
+ return "";
+ }
+
+ return \md5(\json_encode($perms->toArray()));
+ }
}