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 54f8f75f6f/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>
This commit is contained in:
Morris Jobke 2021-03-18 10:28:22 +01:00
parent 5cdc3e9c9d
commit d650de13a4
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
1 changed files with 0 additions and 135 deletions

View File

@ -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