Abstract Class Phalcon\Firewall\Adapter\AbstractAdapter
Source on GitHub
Namespace |
Phalcon\Firewall\Adapter |
|
Uses |
Closure, Phalcon\Acl\Enum, Phalcon\Acl\RoleAware, Phalcon\Cache\Adapter\AdapterInterface, Phalcon\Di\DiInterface, Phalcon\Events\EventsAwareInterface, Phalcon\Events\ManagerInterface, Phalcon\Firewall\Exception, Phalcon\Mvc\Dispatcher |
|
Implements |
AdapterInterface, EventsAwareInterface |
Adapter for Phalcon\Firewall adapters
Properties
/**
* Storing active identity object implementing Phalcon/Acl/RoleAware
*/
protected activeIdentity;
/**
* Storing active user role
*/
protected activeRole;
/**
* Should role always be resolved using role callback or just once?
* @var bool
*/
protected alwaysResolvingRole = false;
/**
* Cache for caching access
* @var CacheAdapterInterface
*/
protected cache;
/**
* Default access
* @var int
*/
protected defaultAccess;
/**
* Events manager
* @var mixed
*/
protected eventsManager;
/**
* Internal cache for caching access during request time
* @var mixed
*/
protected internalCache;
/**
* Anonymous function for getting user identity - this function must
* return string, array or object implementing Phalcon\Acl\RoleAware
* @var mixed
*/
protected roleCallback;
Methods
public function getActiveIdentity()
public function getActiveRole()
public function getDefaultAccess(): int
public function getEventsManager(): ManagerInterface;
Returns the internal event manager
public function getRoleCallback(): Closure;
Gets role callback to fetch role name
public function isAlwaysResolvingRole(): bool;
Gets always resolving role option
public function setAlwaysResolvingRole( bool $alwaysResolvingRole ): void;
Sets always resolving role option
public function setCache( CacheAdapterInterface $cache ): AdapterInterface;
Sets the cache adapter
public function setDefaultAccess( int $defaultAccess ): AdapterInterface;
Sets the default access level (Phalcon\Acl\Enum::ALLOW or Phalcon\Acl\Enum::DENY)
public function setEventsManager( ManagerInterface $eventsManager ): void;
Sets the events manager
public function setRoleCallback( Closure $callback ): AdapterInterface;
Sets role callback to fetch role name
protected function callRoleCallback( DiInterface $container ): void;
//
protected function fireEventOrThrowException( mixed $role, string $actionName, string $controllerName, bool $access );
Fires event or throwing exception
protected function getAccessFromCache( string $key, array $originalValues = null, string $roleCacheKey = null ): bool | null;
Gets access from cache
protected function handleException( \Exception $exception );
Handles a user exception
protected function saveAccessInCache( string $key, bool $access ): void;
Saves access in cache and internal cache
protected function throwFirewallException( string $message, int $exceptionCode = int ): bool;
Throws an internal exception
Class Phalcon\Firewall\Adapter\Acl
Source on GitHub
Namespace |
Phalcon\Firewall\Adapter |
|
Uses |
Phalcon\Acl\Adapter\AdapterInterface, Phalcon\Di, Phalcon\Cache\Adapter\AdapterInterface, Phalcon\Events\Event, Phalcon\Events\ManagerInterface, Phalcon\Firewall\Exception, Phalcon\Mvc\DispatcherInterface |
|
Extends |
AbstractAdapter |
FirewallZ for Phalcon\Application which depends on acl and dispatcher
Properties
/**
* Acl service name
* @var string
*/
protected aclServiceName;
/**
* Bound models
* @var array
*/
protected boundModels;
/**
* Property used for setting different key names in associated acl function than got from Binder
*/
protected boundModelsKeyMap;
/**
* Dispatcher
* @var mixed
*/
protected dispatcher;
/**
* Parameter for using with multi module application
* @var bool
*/
protected multiModuleConfiguration = false;
/**
* Separator between module name and controller prefix
* @var string
*/
protected moduleSeparator = :;
/**
* Function returning string for role cache key
* @var mixed
*/
protected roleCacheCallback;
Methods
public function __construct( string $aclServiceName, array $boundModelsKeyMap = null );
Phalcon\Firewall\Adapter\Acl constructor
public function afterBinding( Event $event, DispatcherInterface $dispatcher, mixed $data );
//
public function beforeExecuteRoute( Event $event, DispatcherInterface $dispatcher, mixed $data );
//
public function getAclServiceName(): string
public function getBoundModelsKeyMap()
public function getDispatcher(): DispatcherInterface;
Gets dispatcher
public function getModuleSeparator(): string
public function getRoleCacheCallback(): mixed
public function isMultiModuleConfiguration(): bool;
Returns multiModuleConfiguration @return bool
public function setAclServiceName( string $aclServiceName )
public function setBoundModelsKeyMap( $boundModelsKeyMap )
public function setModuleSeparator( string $moduleSeparator )
public function setRoleCacheCallback( mixed $roleCacheCallback )
public function useMultiModuleConfiguration( bool $multiModuleConfiguration );
Sets multiModuleConfiguration
protected function getAccessFromCache( string $key, array $originalValues = null, string $roleCacheKey = null ): bool | null;
//
protected function handleDispatcher( DispatcherInterface $dispatcher );
//
protected function saveAccessInCache( string $key, bool $access ): void;
//
Interface Phalcon\Firewall\Adapter\AdapterInterface
Source on GitHub
Namespace |
Phalcon\Firewall\Adapter |
|
Uses |
Closure, Phalcon\Mvc\DispatcherInterface, Phalcon\Cache\Adapter\AdapterInterface |
Interface for Phalcon\Mvc\Dispatcher\Firewall adapters
Methods
public function getDefaultAccess(): int;
Returns the default ACL access level
public function getRoleCallback(): Closure;
Gets role callback to fetch role name
public function isAlwaysResolvingRole(): bool;
Gets always resolving role option
public function setAlwaysResolvingRole( bool $alwaysResolvingRole ): void;
Sets always resolving role option
public function setCache( CacheAdapterInterface $cache ): AdapterInterface;
Sets cache backend
public function setDefaultAccess( int $defaultAccess ): AdapterInterface;
Sets the default access level (Phalcon\Acl::ALLOW or Phalcon\Acl::DENY)
public function setRoleCallback( Closure $callback ): AdapterInterface;
Sets role callback to fetch role name
Class Phalcon\Firewall\Adapter\Annotations
Source on GitHub
Namespace |
Phalcon\Firewall\Adapter |
|
Uses |
Phalcon\Annotations\Adapter\AdapterInterface, Phalcon\Events\Event, Phalcon\Events\ManagerInterface, Phalcon\Firewall\Exception, Phalcon\Mvc\DispatcherInterface, ReflectionClass |
|
Extends |
AbstractAdapter |
Firewall which depends on annotations and dispatcher
Properties
/**
* Number of active active arguments in active annotation
* @var int
*/
protected activeArgumentsNumber = 0;
/**
* Adapter for annotations
* @var mixed
*/
protected annotationsAdapter;
/**
* Dispatcher
* @var mixed
*/
protected dispatcher;
/**
* Role for which access was granted
*/
protected resolvedRole;
Methods
public function __construct( AdapterInterface $annotationsAdapter );
Phalcon\Firewall\Adapter\Annotations constructor
public function beforeExecuteRoute( Event $event, DispatcherInterface $dispatcher, mixed $data );
//
public function getAnnotationsAdapter(): mixed
public function getDispatcher(): DispatcherInterface;
Gets dispatcher
public function setAnnotationsAdapter( mixed $annotationsAdapter )
protected function checkActionAnnotationAccess( string $controllerClass, string $controllerName, string $actionName, mixed $role );
//
protected function checkAnnotations( mixed $annotations, mixed $role );
//
protected function checkControllerAnnotationAccess( string $controllerClass, string $controllerName, mixed $role );
//
protected function getAccessFromCache( string $key, array $originalValues = null, string $roleCacheKey = null ): bool | null;
//
protected function handleAnnotation( mixed $annotation, bool $access, mixed $role );
//
Class Phalcon\Firewall\Adapter\Micro\Acl
Source on GitHub
Namespace |
Phalcon\Firewall\Adapter\Micro |
|
Uses |
Phalcon\Acl\Adapter\AdapterInterface, Phalcon\Di, Phalcon\Cache\Adapter\AdapterInterface, Phalcon\Di\DiInterface, Phalcon\Events\Event, Phalcon\Events\ManagerInterface, Phalcon\Firewall\Adapter\AbstractAdapter, Phalcon\Firewall\Exception, Phalcon\Mvc\Micro, Phalcon\Mvc\Model\BinderInterface, Phalcon\Mvc\Router |
|
Extends |
AbstractAdapter |
Firewall for Phalcon\Mvc\Micro which depends on ACL
Properties
/**
* Acl service name
* @var string
*/
protected aclServiceName;
/**
* Bound models
* @var array
*/
protected boundModels;
/**
* Property used for setting different key names in associated ACL function
* than got from Binder
*/
protected boundModelsKeyMap;
/**
* Component name used to acquire access, be default it's Micro
* @var string
*/
protected componentName = Micro;
/**
* Micro object
* @var mixed
*/
protected micro;
/**
* Function returning string for role cache key
* @var mixed
*/
protected roleCacheCallback;
/**
* Router object
* @var mixed
*/
protected router;
/**
* By default using route names which are required, you can change it to
* false to use route patterns
* @var bool
*/
protected routeNameConfiguration = true;
Methods
public function __construct( string $aclServiceName, array $boundModelsKeyMap = null );
//
public function afterBinding( Event $event, Micro $micro, mixed $data );
//
public function beforeExecuteRoute( Event $event, Micro $micro, mixed $data );
//
public function getAclServiceName(): string
public function getBoundModelsKeyMap()
public function getComponentName(): string
public function getMicro(): Micro;
Gets micro
public function getRoleCacheCallback(): mixed
public function isRouteNameConfiguration(): bool;
Gets route name configuration
public function setAclServiceName( string $aclServiceName )
public function setBoundModelsKeyMap( $boundModelsKeyMap )
public function setComponentName( string $componentName )
public function setRoleCacheCallback( mixed $roleCacheCallback )
public function setRouteNameConfiguration( bool $routeNameConfiguration )
protected function fireEventOrThrowException( mixed $role, string $actionName, string $controllerName, bool $access );
Fires event or throwing exception
protected function getAccessFromCache( string $key, array $originalValues = null, string $roleCacheKey = null ): bool | null;
//
protected function handleRouter( Micro $micro );
//
protected function saveAccessInCache( string $key, bool $access ): void;
//
Class Phalcon\Firewall\Exception
Source on GitHub
Namespace |
Phalcon\Firewall |
|
Extends |
\Phalcon\Exception |
Exceptions thrown in Phalcon\Firewall will use this class