diff options
author | Robin Appelman <robin@icewind.nl> | 2024-10-17 18:29:52 +0200 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2025-02-13 18:17:31 +0100 |
commit | 449ac364b3f07ee7b418615ac9704c57dfca7a95 (patch) | |
tree | 296de47456becf9ab060b41ad104160a840637c1 | |
parent | 9f1666ef3d5447ea1cd4a7f6c82bfb1c18c720a6 (diff) | |
download | nextcloud-server-449ac364b3f07ee7b418615ac9704c57dfca7a95.tar.gz nextcloud-server-449ac364b3f07ee7b418615ac9704c57dfca7a95.zip |
test: add test for permissions of copied sharebackport/48769/stable30
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/files_sharing/tests/SharedStorageTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 320fc466789..e8824cca734 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -10,6 +10,7 @@ use OC\Files\View; use OCA\Files_Sharing\SharedStorage; use OCA\Files_Trashbin\AppInfo\Application; use OCP\AppFramework\Bootstrap\IBootContext; +use OCP\Constants; use OCP\Files\NotFoundException; use OCP\Share\IShare; @@ -579,4 +580,30 @@ class SharedStorageTest extends TestCase { $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage()); $this->assertInstanceOf(\OC\Files\Cache\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); + } } |