• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Task/Service/AccessService.php
  • Класс: BitrixBizprocTaskServiceAccessService
  • Вызов: AccessService::checkDelegateTask
public function checkDelegateTask(int $toUserId, int $fromUserId): CheckDelegateTasksResult
{
	$result = new CheckDelegateTasksResult();

	if (Loader::includeModule('intranet'))
	{
		if (
			!BitrixIntranetUtil::isIntranetUser($toUserId)
			|| !BitrixIntranetUtil::isIntranetUser($this->userId)
		)
		{
			return $result->addError(
				new Error(Loc::getMessage('BIZPROC_LIB_TASK_ACCESS_SERVICE_DELEGATE_ERROR_ONLY_INTRANET_USER'))
			);
		}
	}

	$isHead = CBPHelper::checkUserSubordination($this->userId, $toUserId);
	$allowedDelegationTypes = [CBPTaskDelegationType::AllEmployees];
	if ($isHead)
	{
		$allowedDelegationTypes[] = CBPTaskDelegationType::Subordinate;
	}

	$result->setData([
		'allowedDelegationTypes' => $this->isUserAdmin ? null : $allowedDelegationTypes,
	]);

	return $result;
}