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

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

	if (!$this->controller->check(ActionDictionary::ACTION_TEMPLATE_READ, $template, $params))
	{
		$this->controller->addError(static::class, 'Access to template denied');
		return false;
	}

	if ($template->getTemplatePermission($this->user, PermissionDictionary::TEMPLATE_FULL))
	{
		return true;
	}

	return (bool) $this->user->getPermission(PermissionDictionary::TEMPLATE_REMOVE);
}