aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-05-06 21:39:49 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-05-18 13:47:38 +0000
commitaac0dd1f20cbffec6dbc9c3282e8ffe552c48be8 (patch)
treea7e4437d5f02b27458e10d75caf5e8ec6ff6848e /apps/files_sharing/lib
parent231eaf6ffd91225d1136adaae0c0595133406677 (diff)
downloadnextcloud-server-aac0dd1f20cbffec6dbc9c3282e8ffe552c48be8.tar.gz
nextcloud-server-aac0dd1f20cbffec6dbc9c3282e8ffe552c48be8.zip
Have share permissions on link shares if it is enabled
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 49320d57f16..0fbd57b4713 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -216,15 +216,6 @@ class ShareAPIController extends OCSController {
$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
}
- // TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
- // For link shares, we need to have the PERMISSION_SHARE if federated is enabled
- if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
- if ($share->getShareType() === IShare::TYPE_LINK
- || $share->getShareType() === IShare::TYPE_EMAIL) {
- $result['permissions'] |= Constants::PERMISSION_SHARE;
- }
- }
-
if ($share->getShareType() === IShare::TYPE_USER) {
$sharedWith = $this->userManager->get($share->getSharedWith());
$result['share_with'] = $share->getSharedWith();
@@ -511,6 +502,11 @@ class ShareAPIController extends OCSController {
$permissions = Constants::PERMISSION_READ;
}
+ // TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
+ if (($permissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
+ $permissions |= Constants::PERMISSION_SHARE;
+ }
+
$share->setPermissions($permissions);
// Set password
@@ -1055,6 +1051,11 @@ class ShareAPIController extends OCSController {
}
if ($newPermissions !== null) {
+ // TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
+ if (($newPermissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
+ $newPermissions |= Constants::PERMISSION_SHARE;
+ }
+
$share->setPermissions($newPermissions);
$permissions = $newPermissions;
}