public function checkRequirements($element) { parent::checkRequirements($element); if (!$this->permissionChecker->isAllowed($element)) { throw new ForbiddenRequestException(); } }
/** * Check whenever current user is allowed to use given link * @param string $link etc "this", ":Admin:Show:default" * @return bool */ public function isAllowed($link) { list($presenter, $action) = $this->formatLink($link); $presenterReflection = PresenterComponentReflection::from($this->presenterFactory->getPresenterClass($presenter)); if (!$this->permissionChecker->isAllowed($presenterReflection)) { return false; } $actionKey = Presenter::ACTION_KEY . ucfirst($action); if ($presenterReflection->hasMethod($actionKey) && !$this->permissionChecker->isAllowed($presenterReflection->getMethod($actionKey))) { return false; } return true; }