コード例 #1
0
 /**
  * 
  * @param string $routeName
  * @return boolean
  */
 public function isGranted($routeName)
 {
     if (!$this->isRouteGuarded($routeName)) {
         return true;
     }
     $allowedRoles = $this->getAllowedRolesByRouteName($routeName);
     return $this->authorizationService->matchIdentityRoles($allowedRoles);
 }
コード例 #2
0
 /**
  * 
  * @param mixed $permission
  * @return boolean
  */
 public function isGranted($permission)
 {
     $controllerName = $permission['controller'];
     $actionName = $permission['action'];
     if (!$this->isControllerActionGuarded($controllerName, $actionName)) {
         return true;
     }
     $allowedRoles = $this->getAllowedRolesByControllerAction($controllerName, $actionName);
     return $this->authorizationService->matchIdentityRoles($allowedRoles);
 }
コード例 #3
0
 /**
  * 
  * @param EventInterface $event
  * @throws UnauthorizedException
  */
 public function onCheck(EventInterface $event)
 {
     if (!$this->authorizationService->isGranted($event->getParam('permission'))) {
         throw new UnauthorizedException();
     }
 }