Skip to content

Commit

Permalink
test: add test for permissions of copied share
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot[bot] committed Dec 4, 2024
1 parent 558784e commit 9b59ebf
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions apps/files_sharing/tests/SharedStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,4 +601,30 @@ public function testInitWithNotFoundSource() {
$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);
}
}

0 comments on commit 9b59ebf

Please sign in to comment.