Collection
Array of user permission attributes grouped by entity type
Entity permission attributes are restrictions that must be applied to queries for a given EntityType for a user.
There can be none, one or many restrictions for the entity
Restrictions can be four types
- User restrictions. it looks like 'U6' or 'IU6' - U means user and 6 is user id.
- Progress step restrictions. it looks like 'STAGE_IDC7:NEW' - 'C' means Category and 7 is a category id. 'LEAD' means entity without category
- Open entities restrictions. it looks like 'O' (Open). Can access to all "open" entities
- Department restrictions. it looks like 'D2' - D means department and 2 is a department id
The descriptions of restrictions above is example designed to give you an idea of what to expect there, but is not a completely accurate description of all species.
Some examples^
[
'DEAL_C1' => [], // means no access
'DEAL_C2' => [0], // means full access
'DEAL_C3'=> [ // has access with some restrictions
['STAGE_IDC3:NEW', 'U6'], // can access to deals with RESPONSIBLE field is user 6 on the NEW stage
['STAGE_IDC3:PREPAYMENT_INVOICE', 'D2'], // RESPONSIBLE field contain users from department 2 on the PREPAYMENT_INVOICE stage
['STAGE_IDC3:EXECUTING', 'O'] // 'O' - (Open). Can access to all "open" entities on the EXECUTING stage
],
'DEAL_C4' => ['U6'] // can access to deals with RESPONSIBLE field is user 6 on any stage
]
Table of Contents
Methods
- __construct() : mixed
- addByEntityType() : void
- areAllEntityTypesAllowed() : bool
- build() : self
- getAllowedEntityTypes() : array<string|int, mixed>
- getByEntityType() : array<string|int, mixed>
- getUserId() : int
Methods
__construct()
public
__construct(int $userId) : mixed
Parameters
- $userId : int
addByEntityType()
public
addByEntityType(string $permissionEntityType, array<string|int, mixed> $attributes) : void
Parameters
- $permissionEntityType : string
- $attributes : array<string|int, mixed>
areAllEntityTypesAllowed()
public
areAllEntityTypesAllowed() : bool
Return values
boolbuild()
public
static build(UserPermissions $userPermissions, array<string|int, string> $requestedPermissionCheckEntityTypes, array<string|int, string> $requestedOperations) : self
Parameters
- $userPermissions : UserPermissions
- $requestedPermissionCheckEntityTypes : array<string|int, string>
- $requestedOperations : array<string|int, string>
-
- Bitrix\Crm\Service\UserPermission::OPERATIONS_* constants
Return values
selfgetAllowedEntityTypes()
public
getAllowedEntityTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getByEntityType()
public
getByEntityType(mixed $permissionEntityType) : array<string|int, mixed>
Parameters
- $permissionEntityType : mixed
Return values
array<string|int, mixed>getUserId()
public
getUserId() : int