Skip to content

173 - Role Authorization for Each Page#236

Merged
prooflesben merged 9 commits intomainfrom
173-role-authorization
Nov 30, 2025
Merged

173 - Role Authorization for Each Page#236
prooflesben merged 9 commits intomainfrom
173-role-authorization

Conversation

@aaronashby
Copy link
Contributor

ℹ️ 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:

  1. Added RestrictedPage.tsx that is accessible with the url, "main/restricted"
  2. Added handling for cases when the current user is 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 null when a full page reload occurs, causing all data in the store to be reinitialized (user would be initialized to null). When only using the logic that checks if the user's position is inactive, it would allow any user to bypass the guard since null !== UserStatus.Inactive evaluates to true. I wasn't sure how to get around this outside of using local storage, which would be unsafe.

@prooflesben prooflesben merged commit c1d287f into main Nov 30, 2025
1 check passed
@prooflesben prooflesben deleted the 173-role-authorization branch February 15, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DEV - establish role authorization for each page

2 participants