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_OPENED
public
mixed
ATTRIBUTES_OPENED
= 'O'
ATTRIBUTES_READ_ALL
public
mixed
ATTRIBUTES_READ_ALL
= \CCrmPerms::ATTR_READ_ALL
OPERATION_ADD
public
mixed
OPERATION_ADD
= 'ADD'
OPERATION_DELETE
public
mixed
OPERATION_DELETE
= 'DELETE'
OPERATION_EXPORT
public
mixed
OPERATION_EXPORT
= 'EXPORT'
OPERATION_IMPORT
public
mixed
OPERATION_IMPORT
= 'IMPORT'
OPERATION_READ
public
mixed
OPERATION_READ
= 'READ'
OPERATION_UPDATE
public
mixed
OPERATION_UPDATE
= 'WRITE'
PERMISSION_ALL
public
mixed
PERMISSION_ALL
= \CCrmPerms::PERM_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>canAddCategory()
public
canAddCategory(Category $category) : bool
Parameters
- $category : Category
Return values
boolcanAddItem()
public
canAddItem(Item $item) : bool
Parameters
- $item : Item
Return values
boolcanAddItemsInCategory()
public
canAddItemsInCategory(Category $category) : bool
Parameters
- $category : Category
Return values
boolcanAddType()
Returns true if user can create a new entity type
public
canAddType([int|null $automatedSolutionId = null ]) : bool
Parameters
- $automatedSolutionId : int|null = null
Return values
boolcanDeleteCategory()
public
canDeleteCategory(Category $category) : bool
Parameters
- $category : Category
Return values
boolcanDeleteItem()
Returns true if user has permission to delete the $item.
public
canDeleteItem(Item $item) : bool
Parameters
- $item : Item
Return values
boolcanEditAutomatedSolutions()
Can user create, update or delete automated solutions
public
canEditAutomatedSolutions() : bool
Return values
boolcanEditAutomation()
public
canEditAutomation(int $entityTypeId[, int|null $categoryId = null ]) : bool
Parameters
- $entityTypeId : int
- $categoryId : int|null = null
Return values
boolcanEditCopilotCallAssessmentSettings()
public
canEditCopilotCallAssessmentSettings() : bool
Return values
boolcanExportType()
Return true if user can export items of type $entityTypeId in any category
public
canExportType(int $entityTypeId) : bool
Parameters
- $entityTypeId : int
Return values
boolcanExportTypeInCategory()
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
boolcanImportItem()
public
canImportItem(Item $item) : bool
Parameters
- $item : Item
Return values
boolcanReadConfig()
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
boolcanReadCopilotCallAssessmentSettings()
public
canReadCopilotCallAssessmentSettings() : bool
Return values
boolcanReadItem()
public
canReadItem(Item $item) : bool
Parameters
- $item : Item
Return values
boolcanReadType()
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
boolcanReadTypeInCategory()
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
boolcanUpdateCategory()
public
canUpdateCategory(Category $category) : bool
Parameters
- $category : Category
Return values
boolcanUpdateItem()
Returns true if user has permission to update the $item.
public
canUpdateItem(Item $item) : bool
Parameters
- $item : Item
Return values
boolcanUpdatePermission()
public
canUpdatePermission(PermIdentifier $permission) : bool
Parameters
- $permission : PermIdentifier
Return values
boolcanUpdateType()
Returns true if user can update settings of type $entityTypeId
public
canUpdateType(int $entityTypeId) : bool
Parameters
- $entityTypeId : int
Return values
boolcanViewItemsInCategory()
public
canViewItemsInCategory(Category $category) : bool
Parameters
- $category : Category
Return values
boolcanWriteButtonConfig()
public
canWriteButtonConfig() : bool
Return values
boolcanWriteConfig()
public
canWriteConfig() : bool
Return values
boolcanWriteWebFormConfig()
public
canWriteWebFormConfig() : bool
Return values
boolcheckAddPermissions()
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
boolcheckDeletePermissions()
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
boolcheckExportPermissions()
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
boolcheckReadPermissions()
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
boolcheckUpdatePermissions()
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
boolcreateListQueryBuilder()
public
createListQueryBuilder(mixed $permissionEntityTypes[, QueryBuilderOptions $options = null ]) : QueryBuilder
Parameters
- $permissionEntityTypes : mixed
- $options : QueryBuilderOptions = null
Return values
QueryBuilderfilterAvailableForAddingCategories()
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>getAttributesProvider()
public
getAttributesProvider() : AttributesProvider
Return values
AttributesProvidergetCategoryIdFromPermissionEntityType()
public
static getCategoryIdFromPermissionEntityType(string $permissionEntityType) : int|null
Parameters
- $permissionEntityType : string
Return values
int|nullgetCrmPermissions()
public
getCrmPermissions() : CCrmPerms
Return values
CCrmPermsgetEntityNameByPermissionEntityType()
public
static getEntityNameByPermissionEntityType(string $permissionEntityType) : string|null
Parameters
- $permissionEntityType : string
Return values
string|nullgetItemPermissionEntityType()
public
static getItemPermissionEntityType(Item $item) : string
Parameters
- $item : Item
Return values
stringgetMyCompanyPermissions()
public
getMyCompanyPermissions() : MyCompany
Return values
MyCompanygetPermissionEntityType()
public
static getPermissionEntityType(int $entityTypeId[, int $categoryId = 0 ]) : string
Parameters
- $entityTypeId : int
- $categoryId : int = 0
Return values
stringgetPermissionType()
public
getPermissionType(Item $item[, string $operationType = self::OPERATION_READ ]) : string
Parameters
- $item : Item
- $operationType : string = self::OPERATION_READ
Return values
stringgetStartStageId()
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|nullgetUserId()
public
getUserId() : int
Return values
intisAdmin()
Is user a portal admin
public
isAdmin() : bool
Return values
boolisAdminForEntity()
Is user an admin of entity
public
isAdminForEntity(int $entityTypeId) : bool
Parameters
- $entityTypeId : int
Return values
boolisAlwaysAllowedEntity()
public
static isAlwaysAllowedEntity(int $entityTypeId) : bool
Parameters
- $entityTypeId : int
Return values
boolisAutomatedSolutionAdmin()
Is user an admin of automated solution
public
isAutomatedSolutionAdmin(int $automatedSolutionId) : bool
Parameters
- $automatedSolutionId : int
Return values
boolisAutomatedSolutionsAdmin()
Is user an admin of all automated solutions
public
isAutomatedSolutionsAdmin() : bool
Return values
boolisCrmAdmin()
Is user a crm admin
public
isCrmAdmin() : bool
Return values
boolisPersonalViewAllowed()
public
static isPersonalViewAllowed(int $entityTypeId, int|null $categoryId) : bool
Parameters
- $entityTypeId : int
- $categoryId : int|null
Return values
boolisStageTransitionAllowed()
public
isStageTransitionAllowed(string $currentStage, string $newStageId, ItemIdentifier $itemIdentifier) : bool
Parameters
- $currentStage : string
- $newStageId : string
- $itemIdentifier : ItemIdentifier
Return values
boolprepareItemPermissionAttributes()
public
prepareItemPermissionAttributes(Item $item) : array<string|int, mixed>
Parameters
- $item : Item
Return values
array<string|int, mixed>setCrmPermissions()
public
setCrmPermissions(CCrmPerms $crmPermissions) : UserPermissions
Parameters
- $crmPermissions : CCrmPerms