ApiClientContext
in package
FinalYes
External Api client whose key came with the request being processed right now.
Set in one place only: ApiClientKeyTrait::checkClientKey()
in startup() of the Api presenter, so only on the external HTTP path. Web and admin call the Api
through ApiBridge without startup(), so nothing is ever set there and the role ceiling does
not apply to them.
Read by PermissionResolver: the client's allowed roles cap the caller's roles in every decision of the request, including a nested internal call the Api presenter makes during the external request (it is still the same caller).
Table of Contents
Properties
- $client : ApiClientIdentity|null
Methods
- get() : ApiClientIdentity|null
- getAllowedRoleCodes() : array<int, string>|null
- Returns the role codes that may be applied; `null` means no restriction (web, admin, cron, an external call without a key while `api.clientKey.required` is false).
- set() : void
Properties
$client
private
ApiClientIdentity|null
$client
= null
Methods
get()
public
get() : ApiClientIdentity|null
Return values
ApiClientIdentity|nullgetAllowedRoleCodes()
Returns the role codes that may be applied; `null` means no restriction (web, admin, cron, an external call without a key while `api.clientKey.required` is false).
public
getAllowedRoleCodes() : array<int, string>|null
Return values
array<int, string>|nullset()
public
set(ApiClientIdentity|null $client) : void
Parameters
- $client : ApiClientIdentity|null