CRM_Core_Permission_Temp
in package
This supplements the permissions of the CMS system, allowing us to temporarily acknowledge permission grants for API keys.
In normal usage, the class isn't even instantiated - it's only used when processing certain API backends.
Table of Contents
Properties
- $id : mixed
- $grants : array<string|int, mixed>
- Array(int $grantId => array($perm))
- $idx : array<string|int, mixed>
- Array ($perm => 1);
Methods
- check() : bool
- Determine if a permission has been granted.
- grant() : string|int
- Grant permissions temporarily.
- revoke() : mixed
- Revoke a previously granted permission.
- index() : array<string|int, mixed>
- Generate an optimized index of granted permissions.
Properties
$id
public
static mixed
$id
= 0
$grants
Array(int $grantId => array($perm))
private
array<string|int, mixed>
$grants
$idx
Array ($perm => 1);
private
array<string|int, mixed>
$idx
Methods
check()
Determine if a permission has been granted.
public
check(string $perm) : bool
Parameters
- $perm : string
-
The permission name (e.g. "view all contacts").
Return values
boolgrant()
Grant permissions temporarily.
public
grant(string|array<string|int, mixed> $perms) : string|int
Parameters
- $perms : string|array<string|int, mixed>
-
List of permissions to apply.
Return values
string|int —A handle for the grant. Useful for revoking later on.
revoke()
Revoke a previously granted permission.
public
revoke(string|int $id) : mixed
Parameters
- $id : string|int
-
The handle previously returned by grant().
index()
Generate an optimized index of granted permissions.
protected
index(array<string|int, mixed> $grants) : array<string|int, mixed>
Parameters
- $grants : array<string|int, mixed>
-
Array(string $permName).
Return values
array<string|int, mixed> —Array(string $permName => bool $granted).