Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor REST warehouse raw data realm validation. #1895

Merged

Conversation

aaronweeden
Copy link
Contributor

Description

This PR refactors the validation of the realm parameter for REST requests to the warehouse raw data endpoint.

Now, instead of responding with a message of Invalid realm, the message provides more information depending on the reason for the error:

  • No realm exists with the requested name.
  • The requested realm is not configured to provide raw data.
  • Your user account does not have permission to get raw data from the requested realm.

In the last example above, it now responds with 403 Forbidden instead of 400 Bad Request.

Tests performed

In addition to updating the expected message in an integration test, I also updated my port on xdmod-dev and made sure the following tests passed with different roles and different realms, making the following request (replacing <token> with the user's token and <realm> with the realm):

GET https://xdmod-dev.ccr.xdmod.org:9001/rest/warehouse/raw-data?realm=<realm>&start_date=2024-01-01&end_date=2024-01-01&Bearer=<token>
Top Role Realm Result
User foo No realm exists with the requested name.
User Jobs Success
User Cloud Success
User Accounts Success
User Allocations Success
User ResourceAllocations Your user account does not have permission to get raw data from the requested realm.
User Requests The requested realm is not configured to provide raw data.
User Gateways The requested realm is not configured to provide raw data.
User SUPREMM Success
User JobEfficiency The requested realm is not configured to provide raw data.
User ResourceSpecifications Success
User Introspection The requested realm is not configured to provide raw data.
User PCPArchives The requested realm is not configured to provide raw data.
User OnDemand The requested realm is not configured to provide raw data.
Program Officer foo No realm exists with the requested name.
Program Officer Jobs Success
Program Officer Cloud Success
Program Officer Accounts Success
Program Officer Allocations Success
Program Officer ResourceAllocations Success
Program Officer Requests The requested realm is not configured to provide raw data.
Program Officer Gateways The requested realm is not configured to provide raw data.
Program Officer SUPREMM Success
Program Officer JobEfficiency The requested realm is not configured to provide raw data.
Program Officer ResourceSpecifications Success
Program Officer Introspection The requested realm is not configured to provide raw data.
Program Officer PCPArchives The requested realm is not configured to provide raw data.
Program Officer OnDemand The requested realm is not configured to provide raw data.

Checklist:

  • The pull request description is suitable for a Changelog entry
  • The milestone is set correctly on the pull request
  • The appropriate labels have been added to the pull request

@aaronweeden aaronweeden added enhancement Enhancement of the functionality of an existing feature Category: Data Analytics Framework php Pull requests that update Php code labels Aug 7, 2024
@aaronweeden aaronweeden added this to the 11.0.0 milestone Aug 7, 2024
Copy link
Contributor

@ryanrath ryanrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one note re: adding a test that exercises the new AccessDeniedException path in validateRawDataParams.

@ryanrath ryanrath self-requested a review August 8, 2024 17:34
@aaronweeden aaronweeden merged commit bc967eb into ubccr:xdmod11.0 Aug 8, 2024
4 checks passed
@aaronweeden aaronweeden deleted the refactor-raw-data-realm-validation branch August 8, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Data Analytics Framework enhancement Enhancement of the functionality of an existing feature php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants