Permissions
Table of Contents
Constants
- ACTION_LISTEN = 'LISTEN'
- ACTION_MODIFY = 'MODIFY'
- ACTION_PERFORM = 'PERFORM'
- ACTION_VIEW = 'VIEW'
- ENTITY_BALANCE = 'BALANCE'
- ENTITY_CALL = 'CALL'
- ENTITY_CALL_DETAIL = 'CALL_DETAIL'
- ENTITY_CALL_RECORD = 'CALL_RECORD'
- ENTITY_LINE = 'LINE'
- ENTITY_SETTINGS = 'SETTINGS'
- ENTITY_USER = 'USER'
- PERMISSION_ANY = 'X'
- PERMISSION_CALL_CRM = 'C'
- PERMISSION_CALL_USERS = 'K'
- PERMISSION_DEPARTMENT = 'D'
- PERMISSION_NONE = ''
- PERMISSION_SELF = 'A'
Methods
- canModifyLines() : bool
- Shortcut method for checking MODIFY permission on ENTITY_LINE
- canModifySettings() : bool
- Shortcut method for checking MODIFY permission on ENTITY_SETTINGS
- canPerform() : bool
- Returns true if user can perform specified action on the entity.
- createWithCurrentUser() : Permissions
- Creates class instance for the current user.
- createWithUserId() : Permissions
- Creates class instance for the specified user.
- getActionName() : string
- Returns name of the action by its code.
- getEntityName() : string
- Returns name of the entity by its code.
- getNormalizedPermissions() : array<string|int, mixed>
- Returns normalized permissions array.
- getPermission() : string
- Returns permission code according to the user's permissions.
- getPermissionName() : string
- Returns name of the permission by its code.
- getUserId() : int
- Returns user id.
Constants
ACTION_LISTEN
public
mixed
ACTION_LISTEN
= 'LISTEN'
ACTION_MODIFY
public
mixed
ACTION_MODIFY
= 'MODIFY'
ACTION_PERFORM
public
mixed
ACTION_PERFORM
= 'PERFORM'
ACTION_VIEW
public
mixed
ACTION_VIEW
= 'VIEW'
ENTITY_BALANCE
public
mixed
ENTITY_BALANCE
= 'BALANCE'
ENTITY_CALL
public
mixed
ENTITY_CALL
= 'CALL'
ENTITY_CALL_DETAIL
public
mixed
ENTITY_CALL_DETAIL
= 'CALL_DETAIL'
ENTITY_CALL_RECORD
public
mixed
ENTITY_CALL_RECORD
= 'CALL_RECORD'
ENTITY_LINE
public
mixed
ENTITY_LINE
= 'LINE'
ENTITY_SETTINGS
public
mixed
ENTITY_SETTINGS
= 'SETTINGS'
ENTITY_USER
public
mixed
ENTITY_USER
= 'USER'
PERMISSION_ANY
public
mixed
PERMISSION_ANY
= 'X'
PERMISSION_CALL_CRM
public
mixed
PERMISSION_CALL_CRM
= 'C'
PERMISSION_CALL_USERS
public
mixed
PERMISSION_CALL_USERS
= 'K'
PERMISSION_DEPARTMENT
public
mixed
PERMISSION_DEPARTMENT
= 'D'
PERMISSION_NONE
public
mixed
PERMISSION_NONE
= ''
PERMISSION_SELF
public
mixed
PERMISSION_SELF
= 'A'
Methods
canModifyLines()
Shortcut method for checking MODIFY permission on ENTITY_LINE
public
canModifyLines() : bool
Return values
boolcanModifySettings()
Shortcut method for checking MODIFY permission on ENTITY_SETTINGS
public
canModifySettings() : bool
Return values
boolcanPerform()
Returns true if user can perform specified action on the entity.
public
canPerform(string $entityCode, string $actionCode[, string $minimumPermission = null ]) : bool
Parameters
- $entityCode : string
-
Code of the entity.
- $actionCode : string
-
Code of the action.
- $minimumPermission : string = null
-
Permission code.
Tags
Return values
boolcreateWithCurrentUser()
Creates class instance for the current user.
public
static createWithCurrentUser() : Permissions
Return values
PermissionscreateWithUserId()
Creates class instance for the specified user.
public
static createWithUserId(int $userId) : Permissions
Parameters
- $userId : int
-
User's id.
Return values
PermissionsgetActionName()
Returns name of the action by its code.
public
static getActionName(string $action) : string
Parameters
- $action : string
-
Action code.
Return values
stringgetEntityName()
Returns name of the entity by its code.
public
static getEntityName(string $entity) : string
Parameters
- $entity : string
-
Entity code.
Return values
stringgetNormalizedPermissions()
Returns normalized permissions array.
public
static getNormalizedPermissions(array<string|int, mixed> $permissions) : array<string|int, mixed>
Parameters
- $permissions : array<string|int, mixed>
-
Some not normalized permissions array.
Return values
array<string|int, mixed>getPermission()
Returns permission code according to the user's permissions.
public
getPermission(string $entityCode, string $actionCode) : string
Parameters
- $entityCode : string
-
Code of the entity.
- $actionCode : string
-
Code of the action.
Tags
Return values
stringgetPermissionName()
Returns name of the permission by its code.
public
static getPermissionName(string $permission) : string
Parameters
- $permission : string
-
Permission code.
Return values
stringgetUserId()
Returns user id.
public
getUserId() : int