Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ini_route_security.php
Go to the documentation of this file.
1 <?php
12 class ezpRestIniRouteFilter extends ezpRestRouteFilterInterface
13 {
14 private static $skipRoutes;
15 private static $parsedSkipRoutes;
16
17 public function __construct()
18 {
19 self::$skipRoutes = $this->getSkipRoutes();
20 }
21
26 protected function getSkipRoutes()
27 {
28 $skipRoutes = eZINI::instance( 'rest.ini' )->variableArray( 'RouteSettings', 'SkipFilter' );
29 return $skipRoutes;
30
31 }
32
33 public function shallDoActionWithRoute( ezcMvcRoutingInformation $routeInfo )
34 {
35 return $this->checkRoute( $routeInfo->controllerClass, $routeInfo->action);
36 }
37
38 protected function checkRoute( $selectedController, $selectedAction )
39 {
40 if (self::$parsedSkipRoutes === null )
41 {
42 self::$parsedSkipRoutes = array();
43 foreach ( self::$skipRoutes as $routeRule )
44 {
45 list( $routeController, $routeAction ) = explode( '_', $routeRule[0] );
46 $routeVersion = isset( $routeRule[1] ) ? (int)$routeRule[1] : 1;
47 self::$parsedSkipRoutes[$routeController][$routeAction] = $routeVersion;
48 }
49 }
50 $retVal = false;
51 if ( isset( self::$parsedSkipRoutes[$selectedController] ) )
52 {
53 if ( isset( self::$parsedSkipRoutes[$selectedController][$selectedAction] ) )
54 {
55 $retVal = self::$parsedSkipRoutes[$selectedController][$selectedAction] === ezpRestPrefixFilterInterface::getApiVersion();
56 }
57 else if ( isset( self::$parsedSkipRoutes[$selectedController]['*'] ) )
58 {
59 $retVal = self::$parsedSkipRoutes[$selectedController]['*'] === ezpRestPrefixFilterInterface::getApiVersion();
60 }
61 }
62 return !$retVal;
63 }
64
65
66 }
ezpRestIniRouteFilter
Definition: ini_route_security.php:13
ezpRestIniRouteFilter\shallDoActionWithRoute
shallDoActionWithRoute(ezcMvcRoutingInformation $routeInfo)
Definition: ini_route_security.php:33
ezpRestIniRouteFilter\$parsedSkipRoutes
static $parsedSkipRoutes
Definition: ini_route_security.php:15
ezpRestIniRouteFilter\__construct
__construct()
Definition: ini_route_security.php:17
ezpRestIniRouteFilter\$skipRoutes
static $skipRoutes
Definition: ini_route_security.php:14
ezpRestIniRouteFilter\getSkipRoutes
getSkipRoutes()
Definition: ini_route_security.php:26
ezpRestIniRouteFilter\checkRoute
checkRoute( $selectedController, $selectedAction)
Definition: ini_route_security.php:38
ezpRestPrefixFilterInterface\getApiVersion
static getApiVersion()
Definition: prefix_filter.php:83
ezpRestRouteFilterInterface
Definition: route_filter.php:12
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.