/** * @param string $permission * @param Lesson $lesson * * @throws AccessDeniedException */ protected function checkAccess($permission, Lesson $lesson) { $collection = new ResourceCollection(array($lesson->getResourceNode())); if (!$this->get('security.authorization_checker')->isGranted($permission, $collection)) { throw new AccessDeniedException($collection->getErrorsForDisplay()); } $logEvent = new LogResourceReadEvent($lesson->getResourceNode()); $this->get('event_dispatcher')->dispatch('log', $logEvent); }
/** * @param Lesson $lesson * @param Chapter $chapter */ public function __construct(Lesson $lesson, Chapter $chapter) { $this->lesson = $lesson; $this->details = array('chapter' => array('lesson' => $lesson->getId(), 'chapter' => $chapter->getId(), 'title' => $chapter->getTitle())); parent::__construct($lesson->getResourceNode(), $this->details); }
/** * @param Lesson $lesson * @param string $chaptername */ public function __construct(Lesson $lesson, $chaptername) { $details = array('chapter' => array('lesson' => $lesson->getId(), 'title' => $chaptername)); parent::__construct($lesson->getResourceNode(), $details); }
/** * @param Lesson $lesson * @param Chapter $chapter * @param Chapter $oldparent * @param Chapter $newparent */ public function __construct(Lesson $lesson, Chapter $chapter, Chapter $oldparent, Chapter $newparent) { $details = array('chapter' => array('lesson' => $lesson->getId(), 'chapter' => $chapter->getId(), 'title' => $chapter->getTitle(), 'old_parent' => $oldparent->getTitle(), 'new_parent' => $newparent->getTitle())); parent::__construct($lesson->getResourceNode(), $details); }
/** * @param string $permission * @param Lesson $lesson * * @throws AccessDeniedException */ protected function apiCheckAccess($permission, Lesson $lesson) { $translator = $this->get('translator'); $collection = new ResourceCollection(array($lesson->getResourceNode())); if (!$this->get('security.authorization_checker')->isGranted($permission, $collection)) { throw new HttpException(401, $translator->trans('error_401', array(), 'icap_lesson')); } $logEvent = new LogResourceReadEvent($lesson->getResourceNode()); $this->get('event_dispatcher')->dispatch('log', $logEvent); }