示例#1
0
 /**
  * Check whenever current user is allowed to use given link
  *
  * @param string $element etc "this", ":Admin:Show:default"
  *
  * @return bool
  */
 public function isAllowed($element)
 {
     list($presenter, $action) = $this->formatLink($element);
     $presenterReflection = UI\PresenterComponentReflection::from($this->presenterFactory->getPresenterClass($presenter));
     if (!$this->requirementsChecker->isAllowed($presenterReflection)) {
         return FALSE;
     }
     $actionKey = UI\Presenter::ACTION_KEY . ucfirst($action);
     if ($presenterReflection->hasMethod($actionKey) && !$this->requirementsChecker->isAllowed($presenterReflection->getMethod($actionKey))) {
         return FALSE;
     }
     return TRUE;
 }
 /**
  * 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;
 }