• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/scrum/controllers/task.php
  • Класс: BitrixTasksScrumControllersTask
  • Вызов: Task::processBeforeAction
protected function processBeforeAction(Action $action)
{
	if ($action->getName() === 'isParentScrumTask')
	{
		return true;
	}

	$actionArguments = $action->getArguments();

	$taskId = (is_numeric($actionArguments['taskId'] ?? null) ? (int) $actionArguments['taskId'] : 0);
	$groupId = (is_numeric($actionArguments['groupId'] ?? null) ? (int) $actionArguments['groupId'] : 0);

	$userId = User::getId();

	if ($taskId && !TaskAccessController::can($userId, ActionDictionary::ACTION_TASK_READ, $taskId))
	{
		$this->errorCollection->setError(
			new Error(
				Loc::getMessage('TASKS_STC_ERROR_ACCESS_DENIED'),
				self::ERROR_ACCESS_DENIED
			)
		);

		return false;
	}

	if (!Loader::includeModule('socialnetwork'))
	{
		$this->errorCollection->setError(
			new Error(
				Loc::getMessage('TASKS_STC_ERROR_INCLUDE_MODULE_ERROR'),
				self::ERROR_COULD_NOT_LOAD_MODULE
			)
		);

		return false;
	}

	if (!$taskId && !Group::canReadGroupTasks($userId, $groupId))
	{
		$this->errorCollection->setError(
			new Error(
				Loc::getMessage('TASKS_STC_ERROR_ACCESS_DENIED'),
				self::ERROR_ACCESS_DENIED
			)
		);

		return false;
	}

	return parent::processBeforeAction($action);
}