SilverStripe\ControllerPolicy\ControllerPolicyApplicator
This extension will register the policy with the middleware system to be run at process() stage of the middleware control pipeline. This is done with the help of the ControllerPolicyMiddleware.
This will override any specific headers that have been set by the default HTTP::add_cache_headers, which is
actually what we want. The policies are applied in the order they are added, so if there are two added the
latter will override the former.
Synopsis
class ControllerPolicyApplicator
extends Extension
{
- // members
- protected HTTPMiddleware $middleware;
- protected array $policies = ;
- // methods
- public void setMiddleware()
- public HTTPMiddleware getMiddleware()
- public void setPolicies()
- public array getPolicies()
- public void onAfterInit()
Hierarchy
Extends
- SilverStripe\Core\Extension
Members
protected
- $middleware — SilverStripe\Control\Middleware\HTTPMiddleware
- $policies — array
Methods
public
- getMiddleware()
- getPolicies() — Get the policies for this controller
- onAfterInit() — Register the requested policies with the global request filter. This doesn't mean the policies will be executed at this point - it will rather be delayed until the Director::callMiddleware runs.
- setMiddleware()
- setPolicies() — Set the policies for this controller. Will set, not add to the list.