173 - Role Authorization for Each Page#236
Merged
prooflesben merged 9 commits intomainfrom Nov 30, 2025
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ℹ️ Issue
Closes #173
📝 Description
I protected each main page with a guard that ensures that the currently logged-in user isn't inactive. If the user is inactive, it redirects them to a "Restricted" page with a button that takes them back to the login page.
Briefly list the changes made to the code:
RestrictedPage.tsxthat is accessible with the url, "main/restricted"null(the user is redirected to the login page)✔️ Verification
I made temporary changes to bcanuser33's position by making that user's position be "Inactive" (if this affected anyone working on their tickets, sorry about that 😔)
Screen.Recording.2025-11-29.at.4.04.01.PM.mov
Test Changes
N/A
🏕️ (Optional) Future Work / Notes
Regarding change no. 2, I noticed the currently logged-in user would be
nullwhen a full page reload occurs, causing all data in the store to be reinitialized (userwould be initialized tonull). When only using the logic that checks if the user's position is inactive, it would allow any user to bypass the guard sincenull !== UserStatus.Inactiveevaluates totrue. I wasn't sure how to get around this outside of using local storage, which would be unsafe.