-
Notifications
You must be signed in to change notification settings - Fork 42
MMT-4138: Check for assurance level 4 and role for non NASA MMT access #1429
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
base: MMT-3759
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## MMT-3759 #1429 +/- ##
===========================================
Coverage ? 98.19%
===========================================
Files ? 433
Lines ? 7082
Branches ? 1519
===========================================
Hits ? 6954
Misses ? 127
Partials ? 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| throw new Error(`HTTP error! status: ${response.status}`) | ||
| } | ||
|
|
||
| const data = await response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data.items isn't guaranteed to exist, can we default items to [] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| const ErrorUnauthorizedAccess = () => { | ||
| const location = useLocation() | ||
| const queryParams = new URLSearchParams(location.search) | ||
| const errorType = queryParams.get('errorType') || 'default' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the ?errorType=foo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| <AuthContext.Provider value={context}> | ||
| <MemoryRouter initialEntries={[`/unauthorized?errorType=${errorType}`]}> | ||
| <Routes> | ||
| <Route path="/unauthorized" element={<ErrorUnauthorizedAccess />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should match the route name to actual name in the implementation, unauthorizedAccess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
| } | ||
| } | ||
|
|
||
| if (assuranceLevel === 4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| const response = await edlCallback(mockEvent) | ||
|
|
||
| expect(response.statusCode).toBe(303) | ||
| expect(response.headers.Location).toBe('https://mmt.example.com/unauthorizedAccess?errorType=nonNasaMMT') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below this,
expect(checkNonNasaMMTAccess).toHaveBeenCalledTimes(1)
Anywhere in this file where you have a .toHAveBeenCalledWith(), there should be an accompanying .toHaveBeenCalledTimes()
|
|
||
| await expect(checkNonNasaMMTAccess('testUser', 'testToken')).rejects.toThrow('Network error') | ||
| expect(consoleSpy).toHaveBeenCalledWith('Error checking Non-NASA MMT access:', expect.any(Error)) | ||
| consoleSpy.mockRestore() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Overview
What is the feature?
Check for assurance level 4 and role for non NASA MMT access
What is the Solution?
Check for assurance level 4 and role for non NASA MMT access
What areas of the application does this impact?
Non NASA MMT (Draft MMT)
Testing
Assurance level has to be '4' and ACL has 'name' containing NON_NASA_DRAFT_USER. Error pages for level less than 4 or level 4 but no role assigned.
Attachments
Checklist