private function checkPermission(Event $event) { if ($event->isEditable() === false) { throw new AccessDeniedException('You cannot edit this event'); } if ($event->getWorkspace()) { if (!$this->authorization->isGranted(array('agenda_', 'edit'), $event->getWorkspace())) { throw new AccessDeniedException('You cannot edit the agenda'); } return; } if ($this->tokenStorage->getToken()->getUser() != $event->getUser()) { throw new AccessDeniedException('You cannot edit the agenda'); } }