ApiKeyScope
final class ApiKeyScope (View source)
Immutable description of what an API key is allowed to do.
A key with no restrictions ({\Poweradmin\Domain\Model\self::unrestricted()}) behaves exactly like a pre-scope key: every zone and every operation is permitted. Restrictions are additive guards layered on top of the creating user's own permissions - they can only narrow access, never widen it.
Constants
| OP_VIEW |
|
| OP_CREATE |
|
| OP_UPDATE |
|
| OP_DELETE |
|
| OPERATIONS |
|
Methods
No description
A scope that permits everything (the implicit scope of a key with no restrictions).
Map an HTTP method to the operation it represents.
Whether the operation behind the given HTTP method is allowed by this scope.
Whether a specific operation (view/create/update/delete) is allowed by this scope. Use this for endpoints where the HTTP method does not determine the operation - e.g. bulk record changes or dynamic DNS upserts.
Whether the given zone is within this scope.
No description
No description
No description
No description
Details
__construct(array|null $zoneIds, array|null $operations, bool $isReadonly)
No description
static ApiKeyScope
unrestricted()
A scope that permits everything (the implicit scope of a key with no restrictions).
static string
methodToOperation(string $method)
Map an HTTP method to the operation it represents.
bool
isOperationAllowed(string $method)
Whether the operation behind the given HTTP method is allowed by this scope.
Convenience wrapper for endpoints whose HTTP method maps directly to one operation; mixed-action endpoints should call {\Poweradmin\Domain\Model\self::isOperationTypeAllowed()}.
bool
isOperationTypeAllowed(string $operation)
Whether a specific operation (view/create/update/delete) is allowed by this scope. Use this for endpoints where the HTTP method does not determine the operation - e.g. bulk record changes or dynamic DNS upserts.
bool
isZoneAllowed(int $zoneId)
Whether the given zone is within this scope.
bool
hasZoneRestriction()
No description
array|null
getZoneIds()
No description
array|null
getOperations()
No description
bool
isReadonly()
No description