- Модуль: imbot
- Путь к файлу: ~/bitrix/modules/imbot/lib/restservice.php
- Класс: BitrixImBotRestService
- Вызов: RestService::validateRequest
static function validateRequest($params, CRestServer $server): bool
{
if ($server->getAuthType() !== RestSessionAuthAuth::AUTH_TYPE)
{
throw new RestException(
'Access for this method not allowed with non session authorization.',
'WRONG_AUTH_TYPE',
CRestServer::STATUS_FORBIDDEN
);
}
if(
!Loader::includeModule('im')
|| !Loader::includeModule('imbot')
)
{
throw new RestException(
'Necessary modules are missing',
'WRONG_REQUEST',
CRestServer::STATUS_WRONG_REQUEST
);
}
$classSupport = self::detectSupportBot();
if (empty($classSupport) || $classSupport::getBotId() <= 0)
{
throw new RestException(
'Support bot has not been installed',
'WRONG_REQUEST',
CRestServer::STATUS_WRONG_REQUEST
);
}
return true;
}