src/Security/Voter/Survey/Preview/PdfPreviewVoter.php line 13
<?phpdeclare(strict_types=1);namespace App\Security\Voter\Survey\Preview;use App\Data\Survey\SurveyPatient;use App\Data\User\PatientUser;use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;use Symfony\Component\Security\Core\Authorization\Voter\Voter;class PdfPreviewVoter extends Voter{protected function supports(string $attribute, mixed $subject): bool{return $subject instanceof SurveyPatient && $attribute === 'SURVEY_PDF_PREVIEW';}protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool{$user = $token->getUser();if ($user instanceof PatientUser && $subject instanceof SurveyPatient) {return $user === $subject->getPatient()->getUser();}return false;}}