aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-10-17 18:29:52 +0200
committerRobin Appelman <robin@icewind.nl>2024-10-17 18:29:52 +0200
commita0000c51af173fe974ccbf82b2c9e61a0b6f9525 (patch)
treec10dc3e6b3f4c7c968f5557423543c735c1301da
parent20e08af165d958d76e9a5d550a1cc324dc0b9b57 (diff)
downloadnextcloud-server-copy-share-unmasked.tar.gz
nextcloud-server-copy-share-unmasked.zip
test: add test for permissions of copied sharecopy-share-unmasked
Signed-off-by: Robin Appelman <robin@icewind.nl>
-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 2aa4f38c0da..59129e11cf8 100644
--- a/apps/files_sharing/tests/SharedStorageTest.php
+++ b/apps/files_sharing/tests/SharedStorageTest.php
@@ -578,4 +578,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);
+ }
}