Secure the twig renderer template loader
This commit is contained in:
@ -48,8 +48,13 @@ class SnipTwigExtension extends AbstractExtension
|
||||
|
||||
private function snipsByTag(string $tag): array
|
||||
{
|
||||
// Todo: get 'context' user from the snip it is called from
|
||||
$user = $this->security->getUser();
|
||||
if ($user === null) {
|
||||
return [];
|
||||
}
|
||||
$request = new SnipFilterRequest(SnipFilterRequest::VISIBILITY_ALL, tag: $tag);
|
||||
$snips = $this->snipRepo->findByRequest($this->security->getUser(), $request);
|
||||
$snips = $this->snipRepo->findByRequest($user, $request);
|
||||
return array_map(fn(Snip $snip) => [
|
||||
'id' => $snip->getId(),
|
||||
'name' => $snip->getName(),
|
||||
|
Reference in New Issue
Block a user