Permission
Table of Contents
Constants
- ACTION_MODIFY = 'MODIFY'
- ACTION_VIEW = 'VIEW'
- ENTITY_AD = 'AD'
- ENTITY_BLACKLIST = 'BLACKLIST'
- ENTITY_LETTER = 'LETTER'
- ENTITY_RC = 'RC'
- ENTITY_SEGMENT = 'SEGMENT'
- ENTITY_SETTINGS = 'SETTINGS'
- PERMISSION_ANY = 'X'
- PERMISSION_DEPARTMENT = 'D'
- PERMISSION_NONE = ''
- PERMISSION_SELF = 'A'
Methods
- check() : bool
- Returns true if user can perform specified action on the entity.
- getActionName() : string
- Returns name of the action by its code.
- getByUserId() : array<string|int, mixed>
- Get permissions by user ID.
- getEntityName() : string
- Returns name of the entity by its code.
- getMap() : array<string|int, mixed>
- Returns Permission map.
- getPermissionName() : string
- Returns name of the permission by its code.
- normalize() : array<string|int, mixed>
- Returns normalized permission array.
Constants
ACTION_MODIFY
public
mixed
ACTION_MODIFY
= 'MODIFY'
ACTION_VIEW
public
mixed
ACTION_VIEW
= 'VIEW'
ENTITY_AD
public
mixed
ENTITY_AD
= 'AD'
ENTITY_BLACKLIST
public
mixed
ENTITY_BLACKLIST
= 'BLACKLIST'
ENTITY_LETTER
public
mixed
ENTITY_LETTER
= 'LETTER'
ENTITY_RC
public
mixed
ENTITY_RC
= 'RC'
ENTITY_SEGMENT
public
mixed
ENTITY_SEGMENT
= 'SEGMENT'
ENTITY_SETTINGS
public
mixed
ENTITY_SETTINGS
= 'SETTINGS'
PERMISSION_ANY
public
mixed
PERMISSION_ANY
= 'X'
PERMISSION_DEPARTMENT
public
mixed
PERMISSION_DEPARTMENT
= 'D'
PERMISSION_NONE
public
mixed
PERMISSION_NONE
= ''
PERMISSION_SELF
public
mixed
PERMISSION_SELF
= 'A'
Methods
check()
Returns true if user can perform specified action on the entity.
public
static check(array<string|int, mixed> $permissions, string $entityCode, string $actionCode[, string $minPerm = null ]) : bool
Parameters
- $permissions : array<string|int, mixed>
-
Permissions.
- $entityCode : string
-
Code of the entity.
- $actionCode : string
-
Code of the action.
- $minPerm : string = null
-
Code of minimal permission.
Tags
Return values
boolgetActionName()
Returns name of the action by its code.
public
static getActionName(string $action) : string
Parameters
- $action : string
-
Action code.
Return values
stringgetByUserId()
Get permissions by user ID.
public
static getByUserId(int $userId) : array<string|int, mixed>
Parameters
- $userId : int
-
User ID.
Tags
Return values
array<string|int, mixed>getEntityName()
Returns name of the entity by its code.
public
static getEntityName(string $entity) : string
Parameters
- $entity : string
-
Entity code.
Return values
stringgetMap()
Returns Permission map.
public
static getMap() : array<string|int, mixed>
Return values
array<string|int, mixed>getPermissionName()
Returns name of the permission by its code.
public
static getPermissionName(string $permission) : string
Parameters
- $permission : string
-
Permission code.
Return values
stringnormalize()
Returns normalized permission array.
public
static normalize(array<string|int, mixed> $source) : array<string|int, mixed>
Parameters
- $source : array<string|int, mixed>
-
Some not normalized permission array.