- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
- Класс: CIMRestService
- Вызов: CIMRestService::diskRecordShare
static function diskRecordShare($arParams, $n, CRestServer $server)
{
$arParams = array_change_key_case($arParams, CASE_UPPER);
$dialogId = $arParams['DIALOG_ID'];
if (!BitrixImCommon::isDialogId($dialogId))
{
throw new BitrixRestRestException("Dialog ID can't be empty", "DIALOG_ID_EMPTY", CRestServer::STATUS_WRONG_REQUEST);
}
if (!BitrixImDialog::hasAccess($dialogId))
{
throw new BitrixRestRestException("You don't have access to this chat", "ACCESS_ERROR", CRestServer::STATUS_WRONG_REQUEST);
}
$chatId = BitrixImDialog::getChatId($dialogId);
if ($chatId <= 0)
{
throw new BitrixRestRestException("Chat ID isn't found", "CHAT_NOT_FOUND", CRestServer::STATUS_WRONG_REQUEST);
}
$diskId = (int)$arParams['DISK_ID'];
if ($diskId <= 0)
{
throw new BitrixRestRestException("Disk ID can't be empty", "DISK_ID_EMPTY", CRestServer::STATUS_WRONG_REQUEST);
}
$result = CIMDisk::RecordShare($chatId, $diskId);
if (!$result)
{
throw new BitrixRestRestException("Error during record share", "EXECUTE_ERROR", CRestServer::STATUS_WRONG_REQUEST);
}
return true;
}