From e5960fe2606d6b84e558ae5b6f888ff3a24e4a05 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 4 May 2017 08:41:54 +0200 Subject: [PATCH 1/3] Revert "Revert "fix permissions of mountpoints"" This reverts commit 70a0e9c2d39532f9de6c6e108ef7eaaebb856ed6. Signed-off-by: Roeland Jago Douma --- lib/private/Files/View.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 5e581feba6..c10b5b693b 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1351,8 +1351,12 @@ class View { return false; } - if ($mount instanceof MoveableMount && $internalPath === '') { - $data['permissions'] |= \OCP\Constants::PERMISSION_DELETE; + if ($internalPath === '') { + if ($mount instanceof MoveableMount) { + $data['permissions'] = $data['permissions'] | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE; + } else { + $data['permissions'] = $data['permissions'] & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)); + } } $owner = $this->getUserObjectForOwner($storage->getOwner($internalPath)); From 412d3e2e80f79b09e51b9f9aeebc6298aa524ddf Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 4 May 2017 08:43:05 +0200 Subject: [PATCH 2/3] Fix SharedStorage Test A moveable mount point (What a SharedStorage is) always has DELETE + UPDATE permissions. Since you can either delete (unshare) or update (rename) it. Signed-off-by: Roeland Jago Douma --- apps/files_sharing/tests/SharedStorageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 7d007cb641..0d536e9483 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -210,7 +210,7 @@ class SharedStorageTest extends TestCase { // the read permissions (1) // the delete permission (8), to enable unshare $rootInfo = \OC\Files\Filesystem::getFileInfo($this->folder); - $this->assertSame(9, $rootInfo->getPermissions()); + $this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE, $rootInfo->getPermissions()); // for the file within the shared folder we expect: // the read permissions (1) From 9b750c08ac70efd13f97fe3076ad7a1d5d3af5a0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 15 May 2017 15:54:37 +0200 Subject: [PATCH 3/3] update comment to code Signed-off-by: Robin Appelman --- apps/files_sharing/tests/SharedStorageTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 0d536e9483..195016c47d 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -207,8 +207,9 @@ class SharedStorageTest extends TestCase { $this->assertTrue(\OC\Files\Filesystem::is_dir($this->folder)); // for the share root we expect: - // the read permissions (1) - // the delete permission (8), to enable unshare + // the read permissions + // the delete permission, to enable unshare + // the update permission, to enable moving the share $rootInfo = \OC\Files\Filesystem::getFileInfo($this->folder); $this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE, $rootInfo->getPermissions());