]> source.dussan.org Git - nextcloud-server.git/commitdiff
Have share permissions on link shares if it is enabled
authorRoeland Jago Douma <roeland@famdouma.nl>
Wed, 6 May 2020 19:39:49 +0000 (21:39 +0200)
committerJulius Härtl <jus@bitgrid.net>
Tue, 26 May 2020 09:37:01 +0000 (11:37 +0200)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
apps/files_sharing/lib/Controller/ShareAPIController.php

index 299744d6dff19a1aac991428ddcce6c73962bc8a..f8847125a299821fc42b6a42f59129932d2d473f 100644 (file)
@@ -477,10 +477,12 @@ class ShareAPIController extends OCSController {
                        } else {
                                $permissions = Constants::PERMISSION_READ;
                        }
+
                        // TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
-                       if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
+                       if (($permissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
                                $permissions |= Constants::PERMISSION_SHARE;
                        }
+
                        $share->setPermissions($permissions);
 
                        // Set password
@@ -906,6 +908,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;
                        }