Bitrix API

UserPermissions

Table of Contents

Constants

ATTRIBUTES_OPENED  = 'O'
ATTRIBUTES_READ_ALL  = \CCrmPerms::ATTR_READ_ALL
OPERATION_ADD  = 'ADD'
OPERATION_DELETE  = 'DELETE'
OPERATION_EXPORT  = 'EXPORT'
OPERATION_IMPORT  = 'IMPORT'
OPERATION_READ  = 'READ'
OPERATION_UPDATE  = 'WRITE'
PERMISSION_ALL  = \CCrmPerms::PERM_ALL
PERMISSION_CONFIG  = \CCrmPerms::PERM_CONFIG
PERMISSION_DEPARTMENT  = \CCrmPerms::PERM_DEPARTMENT
PERMISSION_NONE  = \CCrmPerms::PERM_NONE
PERMISSION_OPENED  = \CCrmPerms::PERM_OPEN
PERMISSION_SELF  = \CCrmPerms::PERM_SELF
PERMISSION_SUBDEPARTMENT  = \CCrmPerms::PERM_SUBDEPARTMENT

Methods

__construct()  : mixed
applyAvailableItemsFilter()  : array<string|int, mixed>
applyAvailableItemsGetListParameters()  : array<string|int, mixed>
canAddCategory()  : bool
canAddItem()  : bool
canAddItemsInCategory()  : bool
canAddType()  : bool
Returns true if user can create a new entity type
canDeleteCategory()  : bool
canDeleteItem()  : bool
Returns true if user has permission to delete the $item.
canEditAutomatedSolutions()  : bool
Can user create, update or delete automated solutions
canEditAutomation()  : bool
canEditCopilotCallAssessmentSettings()  : bool
canExportType()  : bool
Return true if user can export items of type $entityTypeId in any category
canExportTypeInCategory()  : bool
Return true if user can export items of type $entityTypeId and $categoryId.
canImportItem()  : bool
canReadConfig()  : bool
ATTENTION! Currently, user can't configure this permission.
canReadCopilotCallAssessmentSettings()  : bool
canReadItem()  : bool
canReadType()  : bool
Check that user can view items.
canReadTypeInCategory()  : bool
Check that user can view items in the category.
canUpdateCategory()  : bool
canUpdateItem()  : bool
Returns true if user has permission to update the $item.
canUpdatePermission()  : bool
canUpdateType()  : bool
Returns true if user can update settings of type $entityTypeId
canViewItemsInCategory()  : bool
canWriteButtonConfig()  : bool
canWriteConfig()  : bool
canWriteWebFormConfig()  : bool
checkAddPermissions()  : bool
Returns true if user has permission to add new item to type $entityTypeId in $categoryId on stage $stageId.
checkDeletePermissions()  : bool
Returns true if user has permission to delete item with $id of type $entityTypeId in $categoryId.
checkExportPermissions()  : bool
Return true if user has permission to export element with $id of type $entityTypeId in category $categoryId.
checkReadPermissions()  : bool
Return true if user has permission to read element of type $entityTypeId If $id is defined, access checked for this element If $categoryId is defined, access checked for this category Otherwise, check read access for at least one category
checkUpdatePermissions()  : bool
Returns true if user has permission to update an item with $id of type $entityTypeId in $categoryId.
createListQueryBuilder()  : QueryBuilder
filterAvailableForAddingCategories()  : array<string|int, Category>
filterAvailableForReadingCategories()  : array<string|int, Category>
getAttributesProvider()  : AttributesProvider
getCategoryIdFromPermissionEntityType()  : int|null
getCrmPermissions()  : CCrmPerms
getEntityNameByPermissionEntityType()  : string|null
getItemPermissionEntityType()  : string
getMyCompanyPermissions()  : MyCompany
getPermissionEntityType()  : string
getPermissionType()  : string
getStartStageId()  : string|null
Return first stage identifier from $stages of entity with $entityTypeId on $categoryId where user has permission to do $operation.
getUserId()  : int
isAdmin()  : bool
Is user a portal admin
isAdminForEntity()  : bool
Is user an admin of entity
isAlwaysAllowedEntity()  : bool
isAutomatedSolutionAdmin()  : bool
Is user an admin of automated solution
isAutomatedSolutionsAdmin()  : bool
Is user an admin of all automated solutions
isCrmAdmin()  : bool
Is user a crm admin
isPersonalViewAllowed()  : bool
isStageTransitionAllowed()  : bool
prepareItemPermissionAttributes()  : array<string|int, mixed>
setCrmPermissions()  : UserPermissions

Constants

ATTRIBUTES_READ_ALL

public mixed ATTRIBUTES_READ_ALL = \CCrmPerms::ATTR_READ_ALL

PERMISSION_CONFIG

public mixed PERMISSION_CONFIG = \CCrmPerms::PERM_CONFIG

PERMISSION_DEPARTMENT

public mixed PERMISSION_DEPARTMENT = \CCrmPerms::PERM_DEPARTMENT

PERMISSION_NONE

public mixed PERMISSION_NONE = \CCrmPerms::PERM_NONE

PERMISSION_OPENED

public mixed PERMISSION_OPENED = \CCrmPerms::PERM_OPEN

PERMISSION_SELF

public mixed PERMISSION_SELF = \CCrmPerms::PERM_SELF

PERMISSION_SUBDEPARTMENT

public mixed PERMISSION_SUBDEPARTMENT = \CCrmPerms::PERM_SUBDEPARTMENT

Methods

__construct()

public __construct(int $userId) : mixed
Parameters
$userId : int

applyAvailableItemsFilter()

public applyAvailableItemsFilter(array<string|int, mixed>|null $filter, array<string|int, mixed> $permissionEntityTypes[, string|null $operation = self::OPERATION_READ ][, string|null $primary = 'ID' ]) : array<string|int, mixed>
Parameters
$filter : array<string|int, mixed>|null
$permissionEntityTypes : array<string|int, mixed>
$operation : string|null = self::OPERATION_READ
$primary : string|null = 'ID'
Return values
array<string|int, mixed>

applyAvailableItemsGetListParameters()

public applyAvailableItemsGetListParameters(array<string|int, mixed>|null $parameters, array<string|int, mixed> $permissionEntityTypes[, string|null $operation = self::OPERATION_READ ][, string|null $primary = 'ID' ]) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>|null
$permissionEntityTypes : array<string|int, mixed>
$operation : string|null = self::OPERATION_READ
$primary : string|null = 'ID'
Return values
array<string|int, mixed>

canAddItem()

public canAddItem(Item $item) : bool
Parameters
$item : Item
Return values
bool

canAddType()

Returns true if user can create a new entity type

public canAddType([int|null $automatedSolutionId = null ]) : bool
Parameters
$automatedSolutionId : int|null = null
Return values
bool

canDeleteItem()

Returns true if user has permission to delete the $item.

public canDeleteItem(Item $item) : bool
Parameters
$item : Item
Return values
bool

canEditAutomatedSolutions()

Can user create, update or delete automated solutions

public canEditAutomatedSolutions() : bool
Return values
bool

canEditAutomation()

public canEditAutomation(int $entityTypeId[, int|null $categoryId = null ]) : bool
Parameters
$entityTypeId : int
$categoryId : int|null = null
Return values
bool

canEditCopilotCallAssessmentSettings()

public canEditCopilotCallAssessmentSettings() : bool
Return values
bool

canExportType()

Return true if user can export items of type $entityTypeId in any category

public canExportType(int $entityTypeId) : bool
Parameters
$entityTypeId : int
Return values
bool

canExportTypeInCategory()

Return true if user can export items of type $entityTypeId and $categoryId.

public canExportTypeInCategory(int $entityTypeId, int $categoryId) : bool
Parameters
$entityTypeId : int
$categoryId : int
Return values
bool

canImportItem()

public canImportItem(Item $item) : bool
Parameters
$item : Item
Return values
bool

canReadConfig()

ATTENTION! Currently, user can't configure this permission.

public canReadConfig() : bool

And because of hack in \CCrmPerms::HavePerm, this method returns TRUE for everyone.

Return values
bool

canReadCopilotCallAssessmentSettings()

public canReadCopilotCallAssessmentSettings() : bool
Return values
bool

canReadItem()

public canReadItem(Item $item) : bool
Parameters
$item : Item
Return values
bool

canReadType()

Check that user can view items.

public canReadType(int $entityTypeId) : bool

If entity support categories, we should check all categories of this type, and return true if user can view items in at least one of them.

Parameters
$entityTypeId : int
  • Type identifier.
Return values
bool

canReadTypeInCategory()

Check that user can view items in the category.

public canReadTypeInCategory(int $entityTypeId, int $categoryId) : bool
Parameters
$entityTypeId : int
  • Type identifier.
$categoryId : int

Category identifier.

Return values
bool

canUpdateItem()

Returns true if user has permission to update the $item.

public canUpdateItem(Item $item) : bool
Parameters
$item : Item
Return values
bool

canUpdateType()

Returns true if user can update settings of type $entityTypeId

public canUpdateType(int $entityTypeId) : bool
Parameters
$entityTypeId : int
Return values
bool

canWriteButtonConfig()

public canWriteButtonConfig() : bool
Return values
bool

canWriteWebFormConfig()

public canWriteWebFormConfig() : bool
Return values
bool

checkAddPermissions()

Returns true if user has permission to add new item to type $entityTypeId in $categoryId on stage $stageId.

public checkAddPermissions(int $entityTypeId[, int|null $categoryId = null ][, string|null $stageId = null ]) : bool

If $stageId is not specified than checks access for at least one stage.

Parameters
$entityTypeId : int
$categoryId : int|null = null
$stageId : string|null = null
Return values
bool

checkDeletePermissions()

Returns true if user has permission to delete item with $id of type $entityTypeId in $categoryId.

public checkDeletePermissions(int $entityTypeId[, int $id = 0 ][, int|null $categoryId = null ]) : bool
Parameters
$entityTypeId : int
$id : int = 0
$categoryId : int|null = null
Return values
bool

checkExportPermissions()

Return true if user has permission to export element with $id of type $entityTypeId in category $categoryId.

public checkExportPermissions(int $entityTypeId[, int $id = 0 ][, int|null $categoryId = null ]) : bool
Parameters
$entityTypeId : int
$id : int = 0
$categoryId : int|null = null
Return values
bool

checkReadPermissions()

Return true if user has permission to read element of type $entityTypeId If $id is defined, access checked for this element If $categoryId is defined, access checked for this category Otherwise, check read access for at least one category

public checkReadPermissions(int $entityTypeId[, int $id = 0 ][, int|null $categoryId = null ]) : bool

If both $id and $categoryId are passed, $categoryId must contain correct category for $id.

Parameters
$entityTypeId : int
$id : int = 0
$categoryId : int|null = null
Return values
bool

checkUpdatePermissions()

Returns true if user has permission to update an item with $id of type $entityTypeId in $categoryId.

public checkUpdatePermissions(int $entityTypeId, int $id[, int|null $categoryId = null ]) : bool

If $categoryId not defined, value will be loaded from DB for item $id

Parameters
$entityTypeId : int
$id : int
$categoryId : int|null = null
Return values
bool

filterAvailableForAddingCategories()

public filterAvailableForAddingCategories(array<string|int, mixed> $categories) : array<string|int, Category>
Parameters
$categories : array<string|int, mixed>
Return values
array<string|int, Category>

filterAvailableForReadingCategories()

public filterAvailableForReadingCategories(array<string|int, mixed> $categories) : array<string|int, Category>
Parameters
$categories : array<string|int, mixed>
Return values
array<string|int, Category>

getCategoryIdFromPermissionEntityType()

public static getCategoryIdFromPermissionEntityType(string $permissionEntityType) : int|null
Parameters
$permissionEntityType : string
Return values
int|null

getCrmPermissions()

public getCrmPermissions() : CCrmPerms
Return values
CCrmPerms

getEntityNameByPermissionEntityType()

public static getEntityNameByPermissionEntityType(string $permissionEntityType) : string|null
Parameters
$permissionEntityType : string
Return values
string|null

getItemPermissionEntityType()

public static getItemPermissionEntityType(Item $item) : string
Parameters
$item : Item
Return values
string

getPermissionEntityType()

public static getPermissionEntityType(int $entityTypeId[, int $categoryId = 0 ]) : string
Parameters
$entityTypeId : int
$categoryId : int = 0
Return values
string

getPermissionType()

public getPermissionType(Item $item[, string $operationType = self::OPERATION_READ ]) : string
Parameters
$item : Item
$operationType : string = self::OPERATION_READ
Return values
string

getStartStageId()

Return first stage identifier from $stages of entity with $entityTypeId on $categoryId where user has permission to do $operation.

public getStartStageId(int $entityTypeId, EO_Status_Collection $stages[, int $categoryId = 0 ][, string $operation = self::OPERATION_ADD ]) : string|null

If such stage is not found - return null.

Parameters
$entityTypeId : int
  • entity identifier.
$stages : EO_Status_Collection
  • collection of stages to search to.
$categoryId : int = 0
  • category identifier.
$operation : string = self::OPERATION_ADD
  • operation (ADD | UPDATE).
Return values
string|null

isAdmin()

Is user a portal admin

public isAdmin() : bool
Return values
bool

isAdminForEntity()

Is user an admin of entity

public isAdminForEntity(int $entityTypeId) : bool
Parameters
$entityTypeId : int
Return values
bool

isAlwaysAllowedEntity()

public static isAlwaysAllowedEntity(int $entityTypeId) : bool
Parameters
$entityTypeId : int
Return values
bool

isAutomatedSolutionAdmin()

Is user an admin of automated solution

public isAutomatedSolutionAdmin(int $automatedSolutionId) : bool
Parameters
$automatedSolutionId : int
Return values
bool

isAutomatedSolutionsAdmin()

Is user an admin of all automated solutions

public isAutomatedSolutionsAdmin() : bool
Return values
bool

isCrmAdmin()

Is user a crm admin

public isCrmAdmin() : bool
Return values
bool

isPersonalViewAllowed()

public static isPersonalViewAllowed(int $entityTypeId, int|null $categoryId) : bool
Parameters
$entityTypeId : int
$categoryId : int|null
Return values
bool

isStageTransitionAllowed()

public isStageTransitionAllowed(string $currentStage, string $newStageId, ItemIdentifier $itemIdentifier) : bool
Parameters
$currentStage : string
$newStageId : string
$itemIdentifier : ItemIdentifier
Return values
bool

prepareItemPermissionAttributes()

public prepareItemPermissionAttributes(Item $item) : array<string|int, mixed>
Parameters
$item : Item
Return values
array<string|int, mixed>

        
On this page

Search results