Skip to content

Integrate role retrieval into AuthContext for RBAC-ready frontend state#12

Open
alizahh-7 wants to merge 1 commit intoistSOS:mainfrom
alizahh-7:feature/authcontext-role
Open

Integrate role retrieval into AuthContext for RBAC-ready frontend state#12
alizahh-7 wants to merge 1 commit intoistSOS:mainfrom
alizahh-7:feature/authcontext-role

Conversation

@alizahh-7
Copy link
Copy Markdown

This PR integrates user role retrieval into the authentication context to prepare the frontend for role-based access control (RBAC).

Changes

  • Adds role state to AuthContext
  • Fetches the user role after authentication using fetchUserRole
  • Stores the role in the global authentication context
  • Exposes role through the useAuth() hook for use across the UI

Why

Role information is required for implementing role-based UI behavior and RBAC features.
By retrieving and storing the role in AuthContext, the frontend can later conditionally render components and restrict functionality based on user permissions.

Files Modified

ui/context/AuthContext.tsx

Notes

  • Uses the existing fetchUserRole utility from ui/server/fetchUser.ts
  • No backend changes were required

Future Use

This prepares the frontend architecture for upcoming RBAC-related features.

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.

1 participant