Menu

## PermissionManager
in package

PermissionManager.php : 33

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

#### AddCharacters

PermissionManager.php : 42
`public mixed AddCharacters = "lotgd/core/characters/add"`

#### AddScenes

PermissionManager.php : 39
`public mixed AddScenes = "lotgd/core/scene/add"`

#### Allowed

PermissionManager.php : 35
`public mixed Allowed = 1`

#### DeleteCharacters

PermissionManager.php : 44
`public mixed DeleteCharacters = "lotgd/core/characters/delete"`

#### DeleteScenes

PermissionManager.php : 41
`public mixed DeleteScenes = "lotgd/core/scene/delete"`

#### Denied

PermissionManager.php : 36
`public mixed Denied = -1`

#### EditCharacters

PermissionManager.php : 43
`public mixed EditCharacters = "lotgd/core/characters/edit"`

#### EditScenes

PermissionManager.php : 40
`public mixed EditScenes = "lotgd/core/scene/edit"`

#### Superuser

PermissionManager.php : 38
`public mixed Superuser = "lotgd/core/superuser"`

### Properties

#### $game

PermissionManager.php : 50
`private Game $game`

### Methods

#### __construct()

PermissionManager.php : 50

Construct a permission manager.

`public __construct(Game $game) : mixed`

##### Parameters

$game : Game

  The game.

##### Return values

mixed —

#### allow()

PermissionManager.php : 123

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()

PermissionManager.php : 149

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()

PermissionManager.php : 58

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()

PermissionManager.php : 74

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()

PermissionManager.php : 90

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()

PermissionManager.php : 175

Removes a permission from an actor.

`public remove(Actor $actor, string $permissionId) : mixed`

##### Parameters

$actor : Actor
$permissionId : string

##### Return values

mixed —

#### findPermission()

PermissionManager.php : 106

Retrieves a permission entity from the database by a permission id.

`private findPermission(string $permissionId) : Permission`

##### Parameters

$permissionId : string

##### Tags

throws
  PermissionIdNotFoundException

##### Return values

Permission —

## Search results