diff --git a/Resources/views/Event/listByPerson.html.twig b/Resources/views/Event/listByPerson.html.twig index cc99cff4f..f0337b300 100644 --- a/Resources/views/Event/listByPerson.html.twig +++ b/Resources/views/Event/listByPerson.html.twig @@ -50,7 +50,6 @@ diff --git a/Security/Authorization/EventVoter.php b/Security/Authorization/EventVoter.php index 77548f1a5..f3ef499f0 100644 --- a/Security/Authorization/EventVoter.php +++ b/Security/Authorization/EventVoter.php @@ -9,6 +9,7 @@ use Chill\MainBundle\Security\ProvideRoleHierarchyInterface; use Chill\EventBundle\Entity\Event; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Entity\User; +use Chill\PersonBundle\Security\Authorization\PersonVoter; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; use Psr\Log\LoggerInterface; @@ -86,11 +87,11 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter } if ($subject instanceof Event) { - if ($subject->getPerson() === null) { + if ($subject->getId() === null) { throw new \LogicException("You should associate a person with event " . "in order to check autorizations"); } - $person = $subject->getPerson(); + $person = $subject->getId(); // liaison event --> person } elseif ($subject instanceof Person) { $person = $subject;