ChainRequestPolicy
class ChainRequestPolicy implements ChainRequestPolicyInterface (View source)
Implements a compound request policy.
When evaluating the compound policy, all of the contained rules are applied to the request. The overall result is computed according to the following rules:
- Returns static::DENY if any of the rules evaluated to static::DENY
- Returns static::ALLOW if at least one of the rules evaluated to static::ALLOW and none to static::DENY
- Otherwise returns NULL
Properties
| protected RequestPolicyInterface[] | $rules | A list of policy rules to apply when this policy is evaluated. |
Methods
Determines whether delivery of a cached page should be attempted.
Details
string|null
check(Request $request)
Determines whether delivery of a cached page should be attempted.
Note that the request-policy check runs very early. In particular it is not possible to determine the logged in user. Also the current route match is not yet present when the check runs. Therefore, request-policy checks need to be designed in a way such that they do not depend on any other service and only take in account the information present on the incoming request.
When matching against the request path, special attention is needed to support path prefixes which are often used on multilingual sites.
$this
addPolicy(RequestPolicyInterface $policy)
Add a policy to the list of policy rules.