ResolvedPermissionGrant
in package
implements
JsonSerializable
A permission grant with its scopes resolved. A superset of [`PermissionGrant`]: `scope_ids` is still present and still authoritative, so a client written before `scopes` existed is unaffected.
Table of Contents
Interfaces
- JsonSerializable
Properties
- $effect : PermissionEffect
- $permission : Permission
- $scopeIds : array<string|int, mixed>
- $scopes : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructs a ResolvedPermissionGrant.
- fromArray() : self
- Rebuilds a ResolvedPermissionGrant from one decoded JSON object.
- jsonSerialize() : array<string, mixed>
- Renders this object for `json_encode()`.
- toArray() : array<string, mixed>
- Renders this object back to its wire form.
Properties
$effect read-only
public
PermissionEffect
$effect
$permission read-only
public
Permission
$permission
$scopeIds read-only
public
array<string|int, mixed>
$scopeIds
$scopes read-only
public
array<string|int, mixed>
$scopes
Methods
__construct()
Constructs a ResolvedPermissionGrant.
public
__construct(PermissionEffect $effect, Permission $permission, array<int, string> $scopeIds, array<int, GrantedScope> $scopes) : mixed
Parameters
- $effect : PermissionEffect
-
Whether the grant permits or refuses.
- $permission : Permission
-
The permission this grant is about.
- $scopeIds : array<int, string>
-
The scope ids the grant is constrained to. Empty is the wildcard.
- $scopes : array<int, GrantedScope>
-
The scopes
scope_idsnames, in the same order where resolvable. A scope that cannot be resolved is omitted rather than represented by a placeholder, so this can be shorter thanscope_ids. That happens when a scope was deleted while a grant still referenced it, and showing a name for something that no longer exists would be worse than showing one fewer chip beside a count that still says how many ids the grant carries.
fromArray()
Rebuilds a ResolvedPermissionGrant from one decoded JSON object.
public
static fromArray(array<string, mixed> $data) : self
Parameters
- $data : array<string, mixed>
-
The raw wire object.
Return values
selfjsonSerialize()
Renders this object for `json_encode()`.
public
jsonSerialize() : array<string, mixed>
Any Sensitive it carries stays WRAPPED here, so a log line or a
json_encode($model) in application code prints [SENSITIVE]. The one place a secret
is revealed is ManagementTransport, on the way to the wire
and nowhere else (§27.5).
Return values
array<string, mixed>toArray()
Renders this object back to its wire form.
public
toArray() : array<string, mixed>
§27.4 rule 5: a null property is OMITTED, not emitted as null. On a sparse update those two say opposite things — "leave this alone" versus "set this to nothing" — and only omission means the first.