summaryrefslogtreecommitdiffstats
path: root/lib/private/share20
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-03-30 13:33:16 +0200
committerRoeland Jago Douma <rullzer@owncloud.com>2016-03-30 13:42:08 +0200
commit2660cf80c3232bd09030b70f55ce8bfbd6700b92 (patch)
treef538807aea42f091a7dd7449068ed50caffaf484 /lib/private/share20
parent456035a750602d6f47384c170e25063684774043 (diff)
downloadnextcloud-server-2660cf80c3232bd09030b70f55ce8bfbd6700b92.tar.gz
nextcloud-server-2660cf80c3232bd09030b70f55ce8bfbd6700b92.zip
Non moveable mount points should always be UPDATE+DELETE shareable
Fixes #23536 The new sharing code is much stricter in checking permissions. However for non moveable mounts the permissions UPDATE+DELETE are not reported on the mount point. This is just a quick fix. * Updated unit tests
Diffstat (limited to 'lib/private/share20')
-rw-r--r--lib/private/share20/manager.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index 5e40acefbef..9e04d57b289 100644
--- a/lib/private/share20/manager.php
+++ b/lib/private/share20/manager.php
@@ -23,6 +23,7 @@
namespace OC\Share20;
+use OC\Files\Mount\MoveableMount;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IUserManager;
@@ -215,8 +216,19 @@ 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;
+ }
+
// Check that we do not share with more permissions than we have
- if ($share->getPermissions() & ~$share->getNode()->getPermissions()) {
+ if ($share->getPermissions() & ~$permissions) {
$message_t = $this->l->t('Cannot increase permissions of %s', [$share->getNode()->getPath()]);
throw new GenericShareException($message_t, $message_t, 404);
}