- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/classes/general/restentity.php
- Класс: CBitrixRestEntity
- Вызов: CBitrixRestEntity::entityDelete
static function entityDelete($params, $n, $server)
{
if(self::checkParams($params))
{
$arIBlock = self::getIBlock(self::getEntityIBlockCode($params['ENTITY'], $server));
if($arIBlock)
{
if(CIBlockRights::UserHasRightTo($arIBlock['ID'], $arIBlock['ID'], 'iblock_edit'))
{
$ib = new CIBlock();
if(!$ib->Delete($arIBlock['ID']))
{
throw new RestException($ib->LAST_ERROR, RestException::ERROR_CORE);
}
return true;
}
else
{
throw new AccessException();
}
}
else
{
throw new RestException('Entity not found', self::ERROR_ENTITY_NOT_FOUND);
}
}
}