diff options
author | Robin Appelman <robin@icewind.nl> | 2024-10-17 18:29:52 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-12-04 19:19:08 +0100 |
commit | e59ebafc877ef5e02f88915eeb0b30c91156e242 (patch) | |
tree | 41df72d787839e3526fc3f6566736eb5c1c2ff0f /apps | |
parent | 6419de7accfdb0d870aeb5cf48ae9ce0ad3cfb43 (diff) | |
download | nextcloud-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.php | 26 |
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); + } } |