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);