Skip to content

Commit

Permalink
fix: don't show acl groupfolders trash items if we don't know the ori…
Browse files Browse the repository at this point in the history
…ginal location

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Jul 24, 2024
1 parent 63cca16 commit 2f26b80
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Trash/TrashBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ private function getTrashForFolders(IUser $user, array $folders): array {
$mountPoint = $folder['mount_point'];
$trashFolder = $this->getTrashFolder($folderId);
$content = $trashFolder->getDirectoryListing();
$userCanManageAcl = $this->folderManager->canManageACL($folderId, $user);
$this->aclManagerFactory->getACLManager($user)->preloadRulesForFolder($trashFolder->getPath());
foreach ($content as $item) {
/** @var \OC\Files\Node\Node $item */
Expand All @@ -338,6 +339,11 @@ private function getTrashForFolders(IUser $user, array $folders): array {
$key = $folderId . '/' . $name . '/' . $timestamp;

$originalLocation = isset($indexedRows[$key]) ? $indexedRows[$key]['original_location'] : '';

// if we for any reason lost track of the original location, hide the item for non-managers as a fail-safe
if ($originalLocation === '' && !$userCanManageAcl) {
continue;
}
if (!$this->userHasAccessToPath($user, $item->getPath())) {
continue;
}
Expand All @@ -350,6 +356,7 @@ private function getTrashForFolders(IUser $user, array $folders): array {
continue 2;
}
}

$info = $item->getFileInfo();
$info['name'] = $name;
$items[] = new GroupTrashItem(
Expand Down

0 comments on commit 2f26b80

Please sign in to comment.