From 50a7ab7985642cdc00fb35b50edabed7ef38f7c8 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 10 May 2025 16:16:53 +0200 Subject: [PATCH] Allow public snip viewing if no user is defined --- src/Security/Voter/SnipVoter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Security/Voter/SnipVoter.php b/src/Security/Voter/SnipVoter.php index 012d158..56b8f44 100644 --- a/src/Security/Voter/SnipVoter.php +++ b/src/Security/Voter/SnipVoter.php @@ -25,9 +25,6 @@ class SnipVoter extends Voter /** @var Snip $subject */ $user = $token->getUser(); - if (!$user instanceof UserInterface) { - return false; - } switch ($attribute) { case self::VIEW: @@ -35,6 +32,9 @@ class SnipVoter extends Voter return true; } case self::EDIT: + if (!$user instanceof UserInterface) { + return false; + } if ($subject->getCreatedBy() === $user) { return true; }