Documentation

PermissionManager
in package

The PermissionManager manages (checks and manipulates) permissions of actors.

The PermissionManager class provides methods to work with permissions and is the only way to check and manipulate permissions. It can be used to create or delete permissions, to remove, allow or deny permissions to actors and to check whether an actor has a certain permission or if it is explicitly denied to him.

The wording used in this class is:

  • allowed, the actor has a certain permission in the allowed state.
  • denied, the actor has a certain permission in the denied state.

To make this more clear, the following table summarizes how different methods react.

Method State: | Unset | Allowed | Denied -------------------+-------+---------+--------- isAllowed | False | True | False isDenied | False | False | True hasPermissionSet | False | True | True

Table of Contents

AddCharacters  = "lotgd/core/characters/add"
AddScenes  = "lotgd/core/scene/add"
Allowed  = 1
DeleteCharacters  = "lotgd/core/characters/delete"
DeleteScenes  = "lotgd/core/scene/delete"
Denied  = -1
EditCharacters  = "lotgd/core/characters/edit"
EditScenes  = "lotgd/core/scene/edit"
Superuser  = "lotgd/core/superuser"
$game  : Game
__construct()  : mixed
Construct a permission manager.
allow()  : mixed
Allows an actor a permission given by the permission id.
deny()  : mixed
Denies an actor a permission given by the permission id.
hasPermissionSet()  : bool
Checks if an actor has a permission set. No assumption can be made if it's allowed or denied.
isAllowed()  : bool
Checks if an actor is allowed a given permission.
isDenied()  : bool
Checks if an actor is denied a given permission.
remove()  : mixed
Removes a permission from an actor.
findPermission()  : Permission
Retrieves a permission entity from the database by a permission id.

Constants

DeleteCharacters

public mixed DeleteCharacters = "lotgd/core/characters/delete"

Properties

Methods

__construct()

Construct a permission manager.

public __construct(Game $game) : mixed
Parameters
$game : Game

The game.

Return values
mixed

allow()

Allows an actor a permission given by the permission id.

public allow(Actor $actor, string $permissionId) : mixed
Parameters
$actor : Actor
$permissionId : string
Return values
mixed

deny()

Denies an actor a permission given by the permission id.

public deny(Actor $actor, string $permissionId) : mixed
Parameters
$actor : Actor
$permissionId : string
Return values
mixed

hasPermissionSet()

Checks if an actor has a permission set. No assumption can be made if it's allowed or denied.

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

True if the permission has been set, be it allowed or denied.

isAllowed()

Checks if an actor is allowed a given permission.

public isAllowed(Actor $actor, string $permissionId) : bool
Parameters
$actor : Actor
$permissionId : string
Return values
bool

True if the actor has the permission set and it's state is allowed.

isDenied()

Checks if an actor is denied a given permission.

public isDenied(Actor $actor, string $permissionId) : bool
Parameters
$actor : Actor
$permissionId : string
Return values
bool

True if the actor has the permission set and it's state is denied.

remove()

Removes a permission from an actor.

public remove(Actor $actor, string $permissionId) : mixed
Parameters
$actor : Actor
$permissionId : string
Return values
mixed

Search results