• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/taskdeadlinerule.php
  • Класс: BitrixTasksAccessRuleTaskDeadlineRule
  • Вызов: TaskDeadlineRule::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 (
		$task->isMember($this->user->getUserId(), RoleDictionary::ROLE_RESPONSIBLE)
		&& $task->isAllowedChangeDeadline()
	)
	{
		return true;
	}

	if (
		array_intersect($task->getMembers(RoleDictionary::ROLE_DIRECTOR), $this->user->getAllSubordinates())
	)
	{
		return true;
	}

	if (
		$task->isAllowedChangeDeadline()
		&& array_intersect($task->getMembers(RoleDictionary::ROLE_RESPONSIBLE), $this->user->getAllSubordinates())
	)
	{
		return true;
	}

	return $this->controller->check(ActionDictionary::ACTION_TASK_EDIT, $task, $params);
}