Documentation

UserPermissions

Class for handling user access permissions.

Methods

Method Description Available from version
public function __construct(int $userId) Constructor. $userId - user ID.
public function getUserId(): int Returns user ID.
public function canViewType(int $typeId): bool Returns true, when user can view process with ID $typeId.
public function canCreateType(): bool Returns true, when user can create new process.
public function canModifyType(int $typeId): bool Returns true, when user can modify process with ID $typeId.
public function canDeleteType(int $typeId): bool Returns true, when user can delete process with ID $typeId.
public function canViewItemsInStage(Type $type, int $stageId): bool Returns true, when user can view elements of process $type at stage with ID $stageId.

Presently there is no access permission feature associated with stages

public function canModifyItemsInStage(Type $type, int $stageId): bool Returns true, when user can modify elements of process $type at stage with ID $stageId.

Presently there is no access permission feature, associated to stages

public function canAddItemsToType(int $typeId): bool Returns true, when user can create new elements of process with ID $typeId.
public function canViewItem(Item $item): bool Returns true, when user can view $item.

Now element's creator can view the element at any stage.

public function canMoveFromStage(Type $type, int $stageId): bool Returns true when user can move elements of process $type at the stage with ID $stageId.
public function canMoveItem(Item $item, int $fromStageId, int $toStageId): bool Returns true, when user can move element $item from stage with ID $fromStageId to the stage with ID $toStageId.
public function canDeleteItem(Item $item): bool Returns true when user can delete $item.
public function canAddComment(Item $item): bool Returns true when user can add comment to $item.
public function canUpdateComment(Timeline $timeline): bool Returns true when user can modify a $timeline comment.
public function canDeleteComment(Timeline $timeline): bool Returns true when user can delete a $timeline comment.
public function canMoveToStage(Stage $stageTo): bool Returns true when user "theoretically" can move elements to stage $stageTo.
public function getFilterForViewableItems(Type $type): array Returns array for filtering elements of process $type. User can view these elements.
public function getFilterForViewableTypes(): array Returns array for filtering processes that user can view.
public function getFilterForEditableTypes(): array Returns array for filtering processes that user can update.
public static function filterUserIdsWhoCanViewItem(Item $item, array $userIds): array Returns array of user IDs that can view element $item, selected from array $userIds.
public static function filterUserIdsWhoCanViewType(int $typeId, array $userIds): array Returns array of user IDs that can view process with $typdId, selected from array $userIds.
public function getAccessCodes(): ?array Returns array user access codes.
public function loadUserPermissions(): void Uploads user data from database.


© «Bitrix24», 2001-2022
Up