From 3d0fca204f3918e65eebd253caae766738cffc99 Mon Sep 17 00:00:00 2001 From: Christian Fasching Date: Tue, 17 Dec 2024 14:32:25 +0100 Subject: [PATCH] [Bug] Fixed permission checks in certain constellations (#798) * fixed permission checks in certain constellations * fixed style * fixed permission checks in certain constellations --- src/Helper/GridHelperService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Helper/GridHelperService.php b/src/Helper/GridHelperService.php index 51ad8d82e..ddc46c7e4 100644 --- a/src/Helper/GridHelperService.php +++ b/src/Helper/GridHelperService.php @@ -954,7 +954,7 @@ private function optimizedConcatNotLike(string $fullpath, bool $onlyChildren = f } return '( - (`path` != "' . $path . '/" AND `key` != "' . $leaf . '") + NOT (`path` = "' . $path . '/" AND `key` = "' . $leaf . '") AND `path` NOT LIKE "' . $fullpath . '/%" )'; @@ -989,7 +989,9 @@ protected function getPermittedPathsByUser(string $type, User $user): string //if any allowed child is found, the current folder can be listed but its content is still blocked $onlyChildren = true; } - $forbiddenPathSql[] = $this->optimizedConcatNotLike($forbiddenPath, $onlyChildren) . $exceptions; + $forbiddenPathSql[] = + '(' . $this->optimizedConcatNotLike($forbiddenPath, $onlyChildren) . $exceptions . ')' + ; } foreach ($elementPaths['allowed'] as $allowedPaths) { $allowedPathSql[] = $this->optimizedConcatLike($allowedPaths);