isAuthorized.php
Table of Contents
Functions
- isAuthorized() : bool
- Decides whether a field projection is allowed for the current request.
Functions
isAuthorized()
Decides whether a field projection is allowed for the current request.
isAuthorized(array<string|int, mixed> $definition[, array<string|int, mixed> $init = [] ]) : bool
Reads the optional Field::REQUIRES permission subject(s) declared on the
field definition, then defers the actual decision to a backend-agnostic
Closure(string $subject): bool injected through $init[Arango::AUTHORIZER].
The framework remains agnostic of the underlying authorization layer (Casbin, OPA, custom, ...) — the consumer is responsible for binding the callable to a real enforcer and a request-scoped user identifier.
Resolution rules:
- No
Field::REQUIRESdeclared on the definition →true(no gating). Field::REQUIRESresolves to an empty list →true(no gating).- No
Arango::AUTHORIZERinjected, or value is not callable →true(authorization layer disabled, fail open). - One or more subjects declared →
trueif at least one subject is granted by the callable (logical OR).
Parameters
- $definition : array<string|int, mixed>
-
Field definition. Reads
Field::REQUIRES. - $init : array<string|int, mixed> = []
-
The request-level init array. Reads
Arango::AUTHORIZER.
Tags
Return values
bool —true when the projection is allowed, false when every
declared subject was refused.