Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Mount/FolderStorageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ private function getBaseStorageForFolderSeparate(
$storage = $this->getBaseStorageForFolderSeparateStorageLocal($folderId, $init);
}

if ($folder?->acl && $user) {
// apply acl before jail, trash doesn't get the ACL wrapper as it does its own ACL filtering
if ($folder?->acl && $user && $type !== 'trash') {
$aclManager = $this->aclManagerFactory->getACLManager($user);
$storage = new ACLStorageWrapper([
'storage' => $storage,
Expand Down
24 changes: 24 additions & 0 deletions tests/Trash/TrashBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,30 @@ public function testHideDeletedTrashItemInDeletedParentFolderAcl(): void {
$this->logout();
}

public function testRemoveTrashedFolderWithRestrictedChild(): void {
$this->loginAsUser('manager');

$folder = $this->managerUserFolder->newFolder("{$this->folderName}/folder");
$child = $folder->newFile('file.txt', 'content');

$this->trashBackend->moveToTrash($folder->getStorage(), $folder->getInternalPath());
$this->assertFalse($this->managerUserFolder->nodeExists("{$this->folderName}/folder"));

// the rule follows the child's file id into the trash, where the storage must not
// enforce it: the trash backend does its own ACL filtering
$this->ruleManager->saveRule(new Rule(new UserMapping('user', 'manager'), $child->getId(), Constants::PERMISSION_DELETE, 0));

$items = $this->trashBackend->listTrashRoot($this->managerUser);
$this->assertCount(1, $items);

$this->trashBackend->removeItem($items[0]);

$this->assertCount(0, $this->trashBackend->listTrashRoot($this->managerUser));
$this->assertCount(0, $this->trashManager->listTrashForFolders([$this->folderId]));

$this->logout();
}

public function testWrongOriginalLocation(): void {
$shareManager = Server::get(Share\IManager::class);

Expand Down
Loading