Skip to content

Commit

Permalink
Merge pull request #4493 from corentin-soriano/get_complexity_level_p…
Browse files Browse the repository at this point in the history
…ersonal_folder

Allow get_complexity_level in subfolders of user personal folder.
  • Loading branch information
nilsteampassnet authored Nov 26, 2024
2 parents 6baa014 + b50e69d commit 8004e27
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions sources/items.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -4835,15 +4835,21 @@
} elseif ($folder_is_personal === 1) {

// Check if personal folder is owned by user
$folder_title = DB::queryFirstRow(
'SELECT title
$folder = DB::queryFirstRow(
'SELECT id
FROM ' . prefixTable('nested_tree') . '
WHERE id = %s AND title = %s',
$inputData['folderId'],
WHERE title = %s',
$session->get('user-id'),
);

if ($folder_title) $accessLevel = 30;
if ($folder) {
// Get all subfolders of user personal folder
$ids = $tree->getDescendants($folder['id'], true, false, true);

// This folder is owned by user
if (in_array($inputData['folderId'], $ids))
$accessLevel = 30;
}
}

// Access is not allowed to this folder
Expand Down Expand Up @@ -7356,4 +7362,3 @@ function getAccessResponse(bool $error, bool $access, bool $edit, bool $delete,
'edition_locked' => $editionLocked,
];
}

0 comments on commit 8004e27

Please sign in to comment.