diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-08-22 10:02:37 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-09-11 11:48:25 +0000 |
commit | 338e0451413272c3a676da42eb81b5dfa2fa4d4d (patch) | |
tree | 1d93b1398fa5b48000dcb6688a7a0e2386da94e7 /apps/files_sharing/lib/Controller/ShareAPIController.php | |
parent | 1e08f91408058686b970a46f7c30ace6b5e27bab (diff) | |
download | nextcloud-server-338e0451413272c3a676da42eb81b5dfa2fa4d4d.tar.gz nextcloud-server-338e0451413272c3a676da42eb81b5dfa2fa4d4d.zip |
fix(files_sharing): adjust permissions from custom edit and delete check methodsbackport/47339/stable30
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/lib/Controller/ShareAPIController.php')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 8b7a711c0ee..1be1fdbbde9 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -158,6 +158,23 @@ class ShareAPIController extends OCSController { if ($isOwnShare) { $result['item_permissions'] = $node->getPermissions(); } + + // If we're on the recipient side, the node permissions + // are bound to the share permissions. So we need to + // adjust the permissions to the share permissions if necessary. + if (!$isOwnShare) { + $result['item_permissions'] = $share->getPermissions(); + + // For some reason, single files share are forbidden to have the delete permission + // since we have custom methods to check those, let's adjust straight away. + // DAV permissions does not have that issue though. + if ($this->canDeleteShare($share) || $this->canDeleteShareFromSelf($share)) { + $result['item_permissions'] |= Constants::PERMISSION_DELETE; + } + if ($this->canEditShare($share)) { + $result['item_permissions'] |= Constants::PERMISSION_UPDATE; + } + } // See MOUNT_ROOT_PROPERTYNAME dav property $result['is-mount-root'] = $node->getInternalPath() === ''; |