-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/(CUST-CPC-1134): Render pages based on user roles (#656)
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
- Loading branch information
1 parent
fae551a
commit f3ed6e6
Showing
5 changed files
with
205 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters