aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-10-17 18:29:52 +0200
committerRobin Appelman <robin@icewind.nl>2024-12-04 19:19:08 +0100
commite59ebafc877ef5e02f88915eeb0b30c91156e242 (patch)
tree41df72d787839e3526fc3f6566736eb5c1c2ff0f /apps
parent6419de7accfdb0d870aeb5cf48ae9ce0ad3cfb43 (diff)
downloadnextcloud-server-e59ebafc877ef5e02f88915eeb0b30c91156e242.tar.gz
nextcloud-server-e59ebafc877ef5e02f88915eeb0b30c91156e242.zip
test: add test for permissions of copied share
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/tests/SharedStorageTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php
index a91931501b4..39ffec0908b 100644
--- a/apps/files_sharing/tests/SharedStorageTest.php
+++ b/apps/files_sharing/tests/SharedStorageTest.php
@@ -579,4 +579,30 @@ class SharedStorageTest extends TestCase {
$this->assertInstanceOf(FailedStorage::class, $storage->getSourceStorage());
$this->assertInstanceOf(FailedCache::class, $storage->getCache());
}
+
+ public function testCopyPermissions(): void {
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ $share = $this->share(
+ IShare::TYPE_USER,
+ $this->filename,
+ self::TEST_FILES_SHARING_API_USER1,
+ self::TEST_FILES_SHARING_API_USER2,
+ Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE - Constants::PERMISSION_DELETE
+ );
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ $view = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+ $this->assertTrue($view->file_exists($this->filename));
+
+ $this->assertTrue($view->copy($this->filename, '/target.txt'));
+
+ $this->assertTrue($view->file_exists('/target.txt'));
+
+ $info = $view->getFileInfo('/target.txt');
+ $this->assertEquals(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE, $info->getPermissions());
+
+ $this->view->unlink($this->filename);
+ $this->shareManager->deleteShare($share);
+ }
}