/** * * @param string $routeName * @return boolean */ public function isGranted($routeName) { if (!$this->isRouteGuarded($routeName)) { return true; } $allowedRoles = $this->getAllowedRolesByRouteName($routeName); return $this->authorizationService->matchIdentityRoles($allowedRoles); }
/** * * @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); }
/** * * @param EventInterface $event * @throws UnauthorizedException */ public function onCheck(EventInterface $event) { if (!$this->authorizationService->isGranted($event->getParam('permission'))) { throw new UnauthorizedException(); } }