• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/taskchangeaccomplicesrule.php
  • Класс: BitrixTasksAccessRuleTaskChangeAccomplicesRule
  • Вызов: TaskChangeAccomplicesRule::execute
public function execute(AccessibleItem $task = null, $params = null): bool
{
	if (!$task)
	{
		$this->controller->addError(static::class, 'Incorrect task');
		return false;
	}

	if ($this->user->isAdmin())
	{
		return true;
	}

	if (!$this->canChangeAccomplices($task))
	{
		$this->controller->addError(static::class, 'Access to change accomplices denied');
		return false;
	}

	$oldTask = $task;
	$newTask = $task;
	if ($params instanceof TaskModel)
	{
		$newTask = $params;
	}

	if (!$this->canAssignTask($oldTask, RoleDictionary::ROLE_ACCOMPLICE, $newTask))
	{
		$this->controller->addError(static::class, 'Access to assign accomplice denied');
		return false;
	}

	return true;
}