Skip to content

Commit

Permalink
Handle REST exceptions for realms that are not configured to provide …
Browse files Browse the repository at this point in the history
…raw data. (#1894)
  • Loading branch information
aaronweeden authored Aug 7, 2024
1 parent cc160a1 commit cc7f948
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions classes/Rest/Controllers/WarehouseControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2126,15 +2126,19 @@ private function getUserStore(\XDUser $user, $realm)
* not included; if an invalid start date,
* end date, realm, field alias, or filter
* key is provided; if the end date is
* before the start date; or if the offset
* is negative.
* before the start date; if the offset is
* negative; or if the requested realm is
* not configured to provide raw data.
*/
public function getRawData(Request $request, Application $app)
{
$user = parent::authenticateToken($request);
$params = $this->validateRawDataParams($request, $user);
$realmManager = new RealmManager();
$queryClass = $realmManager->getRawDataQueryClass($params['realm']);
if (!class_exists($queryClass)) {
throw new BadRequestHttpException('The requested realm is not configured to provide raw data.');
}
$logger = $this->getRawDataLogger();
$streamCallback = function () use (
$user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,11 @@ public function provideGetRawData()
['realm' => 'foo'],
parent::validateBadRequestResponse('Invalid realm.')
],
[
'realm_not_configured',
['realm' => 'Storage'],
parent::validateBadRequestResponse('The requested realm is not configured to provide raw data.')
],
[
'invalid_fields',
['fields' => 'foo,bar;'],
Expand Down

0 comments on commit cc7f948

Please sign in to comment.