diff options
author | Joas Schilling <coding@schilljs.com> | 2019-07-03 16:32:45 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-07-03 16:34:00 +0200 |
commit | 85a80b05acbb6e13d8b49d1ee7f79e9a8c708066 (patch) | |
tree | e340955eb97afc58ebb6358d4d938ae736b0cf7d /lib/private/Share20/Manager.php | |
parent | e4addbae3e564b6009dc09c6c5e36c018cd8d5d0 (diff) | |
download | nextcloud-server-85a80b05acbb6e13d8b49d1ee7f79e9a8c708066.tar.gz nextcloud-server-85a80b05acbb6e13d8b49d1ee7f79e9a8c708066.zip |
Unify the permission checking in one place only
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r-- | lib/private/Share20/Manager.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 4c31a29dc02..bd174069778 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -290,16 +290,9 @@ class Manager implements IManager { throw new \InvalidArgumentException('A share requires permissions'); } - /* - * Quick fix for #23536 - * Non moveable mount points do not have update and delete permissions - * while we 'most likely' do have that on the storage. - */ - $permissions = $share->getNode()->getPermissions(); $mount = $share->getNode()->getMountPoint(); - if (!($mount instanceof MoveableMount)) { - $permissions |= \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE; - } else if ($share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) { + if ($share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) { + // When it's a reshare use the parent share permissions as maximum $userMountPointId = $mount->getStorageRootId(); $userMountPoints = $userFolder->getById($userMountPointId); $userMountPoint = array_shift($userMountPoints); @@ -316,6 +309,16 @@ class Manager implements IManager { $permissions |= $incomingShare->getPermissions(); } } + } else { + /* + * Quick fix for #23536 + * Non moveable mount points do not have update and delete permissions + * while we 'most likely' do have that on the storage. + */ + $permissions = $share->getNode()->getPermissions(); + if (!($mount instanceof MoveableMount)) { + $permissions |= \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE; + } } // Check that we do not share with more permissions than we have |