• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/lib/rest/restservice.php
  • Класс: BitrixListsRestRestService
  • Вызов: RestService::deleteSection
static function deleteSection(array $params, $n, CRestServer $server)
{
	$param = new Param($params);
	$params = $param->getParams();

	$section = new Section($param);
	if (!$section->isExist())
	{
		self::throwError($section->getErrors(), "Section not found", Section::ERROR_SECTION_NOT_FOUND);
	}

	global $USER;
	$rightParam = new RightParam($param);
	$rightParam->setUser($USER);
	$rightParam->setEntityId($params["IBLOCK_SECTION_ID"]);

	if (!CLists::isListFeatureEnabled($rightParam->getIblockTypeId()))
	{
		throw new AccessException('Available only on extended plans');
	}

	$right = new Right($rightParam, new SectionRight($rightParam));
	$right->checkPermission(SectionRight::DELETE);
	if ($right->hasErrors())
	{
		self::throwError($right->getErrors());
	}

	if ($section->delete())
	{
		return true;
	}
	else
	{
		self::throwError($section->getErrors());
	}
}