aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-03-18 10:28:22 +0100
committerMorris Jobke <hey@morrisjobke.de>2021-03-18 10:31:56 +0100
commitd650de13a4af452f8acadcfa5149f58642d8d7be (patch)
treeb8b40c678f86fc691de22c4768d02d52b8d162b9
parent5cdc3e9c9da5db8bf98c2786018941c412ffe146 (diff)
downloadnextcloud-server-d650de13a4af452f8acadcfa5149f58642d8d7be.tar.gz
nextcloud-server-d650de13a4af452f8acadcfa5149f58642d8d7be.zip
Remove duplicate unit test in sharing that checks for group permission updates
* it was skipped before anyways * it is covered for example in build/integration/sharing_features/sharing-v1-part3.feature#L517-L548 (see https://github.com/nextcloud/server/blob/54f8f75f6f82ca102b1cfdb88caf0d06e6c9ba31/build/integration/sharing_features/sharing-v1-part3.feature#L517-L548) * more permission updates are tested in the webdav section, where an OCS API is called and the WebDAV response is checked for the properly changed permission Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--apps/files_sharing/tests/SharedMountTest.php135
1 files changed, 0 insertions, 135 deletions
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php
index 2979ce0f58b..2764dc1032d 100644
--- a/apps/files_sharing/tests/SharedMountTest.php
+++ b/apps/files_sharing/tests/SharedMountTest.php
@@ -264,141 +264,6 @@ class SharedMountTest extends TestCase {
];
}
- public function dataPermissionMovedGroupShare() {
- $data = [];
-
- $powerset = function ($permissions) {
- $results = [\OCP\Constants::PERMISSION_READ];
-
- foreach ($permissions as $permission) {
- foreach ($results as $combination) {
- $results[] = $permission | $combination;
- }
- }
- return $results;
- };
-
- //Generate file permissions
- $permissions = [
- \OCP\Constants::PERMISSION_UPDATE,
- \OCP\Constants::PERMISSION_SHARE,
- ];
-
- $allPermissions = $powerset($permissions);
-
- foreach ($allPermissions as $before) {
- foreach ($allPermissions as $after) {
- if ($before === $after) {
- continue;
- }
-
- $data[] = [
- 'file',
- $before,
- $after,
- ];
- }
- }
-
- //Generate folder permissions
- $permissions = [
- \OCP\Constants::PERMISSION_UPDATE,
- \OCP\Constants::PERMISSION_CREATE,
- \OCP\Constants::PERMISSION_SHARE,
- \OCP\Constants::PERMISSION_DELETE,
- ];
-
- $allPermissions = $powerset($permissions);
-
- foreach ($allPermissions as $before) {
- foreach ($allPermissions as $after) {
- if ($before === $after) {
- continue;
- }
-
- $data[] = [
- 'folder',
- $before,
- $after,
- ];
- }
- }
-
- return $data;
- }
-
-
-
- /**
- * moved mountpoints of a group share should keep the same permission as their parent group share.
- * See #15253
- *
- * @dataProvider dataPermissionMovedGroupShare
- */
- public function testPermissionMovedGroupShare($type, $beforePerm, $afterPerm) {
- $this->markTestSkipped('Unreliable test');
- if ($type === 'file') {
- $path = $this->filename;
- } elseif ($type === 'folder') {
- $path = $this->folder;
- }
-
- $testGroup = $this->groupManager->createGroup('testGroup');
- $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1);
- $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2);
- $user3 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER3);
- $testGroup->addUser($user1);
- $testGroup->addUser($user2);
- $testGroup->addUser($user3);
-
- // Share item with group
- $share = $this->share(
- IShare::TYPE_GROUP,
- $path,
- self::TEST_FILES_SHARING_API_USER1,
- 'testGroup',
- $beforePerm
- );
- $this->shareManager->acceptShare($share, $user1->getUID());
- $this->shareManager->acceptShare($share, $user2->getUID());
- $this->shareManager->acceptShare($share, $user3->getUID());
-
- // Login as user 2 and verify the item exists
- self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
- $this->assertTrue(\OC\Files\Filesystem::file_exists($path)); // TODO: unreliable - this is sometimes false
- $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
- $this->assertEquals($beforePerm, $result->getPermissions());
-
- // Now move the item forcing a new entry in the share table
- \OC\Files\Filesystem::rename($path, 'newPath');
- $this->assertTrue(\OC\Files\Filesystem::file_exists('newPath'));
- $this->assertFalse(\OC\Files\Filesystem::file_exists($path));
-
- // change permissions
- $share->setPermissions($afterPerm);
- $this->shareManager->updateShare($share);
-
- // Login as user 3 and verify that the permissions are changed
- self::loginHelper(self::TEST_FILES_SHARING_API_USER3);
- $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER3);
- $this->assertNotEmpty($result);
- $this->assertEquals($afterPerm, $result->getPermissions());
-
- // Login as user 2 and verify that the permissions are changed
- self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
- $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
- $this->assertNotEmpty($result);
- $this->assertEquals($afterPerm, $result->getPermissions());
- $this->assertEquals('/newPath', $result->getTarget());
-
- //cleanup
- self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
- $this->shareManager->deleteShare($share);
- $testGroup->removeUser($user1);
- $testGroup->removeUser($user2);
- $testGroup->removeUser($user3);
- }
-
/**
* If the permissions on a group share are upgraded be sure to still respect
* removed shares by a member of that group