- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/classes/general/restentity.php
- Класс: CBitrixRestEntity
- Вызов: CBitrixRestEntity::entitySectionDelete
static function entitySectionDelete($params, $n, $server)
{
if(self::checkSectionParams($params))
{
$params['ID'] = intval($params['ID']);
if($params['ID'] <= 0)
{
throw new BitrixMainArgumentNullException("ID");
}
else
{
$arIBlock = self::getIBlock(self::getEntityIBlockCode($params['ENTITY'], $server));
if($arIBlock)
{
if(CIBlockRights::UserHasRightTo($arIBlock['ID'], $arIBlock['ID'], 'section_delete'))
{
$dbRes = CIBlockSection::GetList(array(), array(
'ID' => $params['ID'],
'IBLOCK_ID' => $arIBlock['ID']
), false, array('ID'));
$arRes = $dbRes->Fetch();
if($arRes)
{
if(!CIBlockSection::Delete($params['ID']))
{
throw new RestException('Unable to delete section', RestException::ERROR_CORE);
}
return true;
}
else
{
throw new RestException('Section not found', self::ERROR_SECTION_NOT_FOUND);
}
}
else
{
throw new AccessException();
}
}
else
{
throw new RestException('Entity not found', self::ERROR_ENTITY_NOT_FOUND);
}
}
}
}