Documentation

Actor
in package

This abtract class provides functionality for user entities that crates might want to implement, such as permissions.

Table of Contents

$permissionIdToAssociation  : array<string|int, mixed>
addPermission()  : mixed
Associates a permission with this actor in a given state. For permission manipulation, use only the PermissionManager class.
getPermission()  : PermissionAssociationInterface
Returns the associated permission given by an id. For permission checking, use only the PermissionManager class.
getRawPermission()  : Permission
Returns the raw permission given by the id. For permission checking, use only the PermissionManager class.
hasPermissionSet()  : bool
Checks if the actor is associated with a given permission. For permission checking, use only the PermissionManager class.
removePermission()  : mixed
Removes an associated permission from this actor by a given id. For permission manipulation, use only the PermissionManager class.
getPermissionAssociationClass()  : string
Returns the class of the permission associations used for the entity implementing this class.
getPermissionAssociations()  : Generator
Needs to return a generator which iterates through all permission associations.
loadPermissions()  : mixed
Loads all associated permissions for this actor.

Properties

$permissionIdToAssociation

private array<string|int, mixed> $permissionIdToAssociation = []

Associations between permission-id and PermissionAssociation entity.

Methods

addPermission()

Associates a permission with this actor in a given state. For permission manipulation, use only the PermissionManager class.

public addPermission(Permission $permission, int $state) : mixed
Parameters
$permission : Permission
$state : int
Tags
throws
PermissionAlreadyExistsException
Return values
mixed

getRawPermission()

Returns the raw permission given by the id. For permission checking, use only the PermissionManager class.

public getRawPermission(string $permissionId) : Permission
Parameters
$permissionId : string
Return values
Permission

hasPermissionSet()

Checks if the actor is associated with a given permission. For permission checking, use only the PermissionManager class.

public hasPermissionSet(string $permissionId) : bool
Parameters
$permissionId : string
Return values
bool

removePermission()

Removes an associated permission from this actor by a given id. For permission manipulation, use only the PermissionManager class.

public removePermission(string $permissionId) : mixed
Parameters
$permissionId : string
Tags
throws
PermissionDoesNotExistException
Return values
mixed

getPermissionAssociationClass()

Returns the class of the permission associations used for the entity implementing this class.

protected abstract getPermissionAssociationClass() : string
Return values
string

fully qualified class name of the permission association entity.

getPermissionAssociations()

Needs to return a generator which iterates through all permission associations.

protected abstract getPermissionAssociations() : Generator
Return values
Generator

List of PermissionAssociations.

loadPermissions()

Loads all associated permissions for this actor.

protected loadPermissions() : mixed
Tags
throws
PermissionAssociationEntityMissingException
Return values
mixed

Search results