Example #1
0
 public static function is_route_allowed($route_str)
 {
     if (Kohana::$profiling === TRUE and class_exists('Profiler', FALSE)) {
         // Start a new benchmark
         $benchmark = Profiler::start('ACL', __FUNCTION__);
     }
     $route_name = Route::get_route_name($route_str);
     $route_name = mb_strtolower($route_name);
     $route_params = Route::get_route_params($route_str);
     $uri = Route::get($route_name)->uri($route_params);
     $request = Request::factory($uri);
     $matched_params = Route::get($route_name)->matches($request);
     $allowed = self::is_action_allowed(arr::get($matched_params, 'directory'), arr::get($matched_params, 'controller'), arr::get($matched_params, 'action'));
     if (isset($benchmark)) {
         // Stop the benchmark
         Profiler::stop($benchmark);
     }
     return $allowed;
 }
Example #2
0
 public static function route_params($route_str)
 {
     return Route::get_route_params($route_str);
 }