Esempio n. 1
0
 /**
  * Checks if the provided route matches a allowed route of the roles
  * @param string $route Route to match
  * @return boolean True if a match is found, false otherwise
  */
 public function isRouteAllowed($route)
 {
     if ($this->isSuperUser()) {
         return true;
     }
     if (!isset($this->routes)) {
         $this->initializeRoutes();
     }
     if ($this->routeMatcher->matchRoute($route, $this->routes)) {
         return true;
     }
     return false;
 }
 /**
  * Check whether the current user is allowed to view the given route
  * @param string $route Route of the page
  * @return boolean
  */
 public function isRouteAllowed($route)
 {
     if (!$this->model || $this->isCli) {
         return true;
     }
     $route = ltrim($route, Request::QUERY_SEPARATOR);
     $allowed = !$this->routeMatcher->matchRoute($route, $this->getDeniedRoutes());
     if ($allowed) {
         return true;
     }
     $user = $this->getUser();
     if ($user != null && $user->isRouteAllowed($route)) {
         return true;
     }
     return false;
 }