• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/rule/checklistaddrule.php
  • Класс: BitrixTasksAccessRuleChecklistAddRule
  • Вызов: ChecklistAddRule::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 instanceOf TemplateModel)
	{
		return $this->controller->check(ActionDictionary::ACTION_TEMPLATE_EDIT, $task, $params);
	}

	if (!$this->controller->check(ActionDictionary::ACTION_TASK_READ, $task, $params))
	{
		return false;
	}

	if (
		(
			$task->isMember($this->user->getUserId(), RoleDictionary::ROLE_RESPONSIBLE)
			|| $task->isMember($this->user->getUserId(), RoleDictionary::ROLE_ACCOMPLICE)
		)
		&& $this->user->getPermission(PermissionDictionary::TASK_RESPONSE_CHECKLIST_ADD)
	)
	{
		return true;
	}

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