You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User Story:
As SIMS, we need to validate that all ministry users have user profiles, otherwise they should not be able to function in the app.
Acceptance Criteria:
Add validation for ministry account users to require a user profile (users table).
If a user logs in and has no user profile or does not have enough information to create a user profile (example: missing email) they should be redirected to the login page and receive the same message as an unauthorized user with no user profile.
Context:
During onboarding of contracted users, we noticed that some navigation in the system was possible even though the mandatory email in their profile was not present. Emails will continue to be mandatory, so if users does not have a user profile, they should not be able to navigate the system.
Technical
Create a guard to validate if the user exists.
Crate a decorator to allow the user to not exist for some endpoints, for instance, the ones that need to create the user.
Please use the RequiresStudentAccountGuard as a reference and the RequiresStudentAccount as a decorator reference to allow certain endpoints to be reach even without a user created, for instance, for the endpoints actually creating the user.
Apply this guard globally.
Create a test into the existing auth.e2e-spec.ts.
The text was updated successfully, but these errors were encountered:
# Validate user account for all routes
## New global guard and decorator
- [x] New guard `RequiresUserAccountGuard` has been introduced globally
to ensure that routes are authorized with the user token which belongs
to valid SIMS user. There are exceptional routes like public routes and
routes used that setup the user itself are skipped from this validation.
- [x] New decorator `@RequiresUserAccount()` is introduced to get the
metadata context for the guard.
## Student page container
- [x] Student page container updated to NOT render restriction and SIN
banners for pages which does not require a valid student account.
## E2E Tests
- [x] The existing method to mock the student info from token
`mockUserLoginInfo()` does not have a way to restore the mock, if the
mock needs to be restored for other tests in same suite.
Hence refactored the code to use `jest.spyOn()` to mock the userService
method implementation and also created a reset mock method to reset the
mock as required in the test suite.
Here is an example.
**Mock applied**
![image](https://github.com/user-attachments/assets/9f0277d8-27c9-4c1a-98d0-8fd5fc5583a8)
**Mock Reset**
![image](https://github.com/user-attachments/assets/0e9115b3-d456-43eb-aace-d282d68d5297)
- [x] Created new Auth E2E tests
![image](https://github.com/user-attachments/assets/b3e48542-c314-4ee7-81e3-6807a6ea32f6)
## Volar extension
- [x] Updated the workspace file with deprecated vue extension by
replacing with recommended extension.
![image](https://github.com/user-attachments/assets/1ee3de6f-b315-4d87-acd2-32f58dce0891)
User Story:
As SIMS, we need to validate that all ministry users have user profiles, otherwise they should not be able to function in the app.
Acceptance Criteria:
users
table).Context:
Technical
RequiresStudentAccountGuard
as a reference and theRequiresStudentAccount
as a decorator reference to allow certain endpoints to be reach even without a user created, for instance, for the endpoints actually creating the user.auth.e2e-spec.ts
.The text was updated successfully, but these errors were encountered: