Problem
Currently, the authentication context stores the user token but does not expose the user's role globally. This makes it difficult to implement role-based UI behavior and RBAC features in the frontend.
Proposed Solution
Extend the AuthContext to retrieve and store the user role after authentication using the existing fetchUserRole function.
This would:
- Fetch the role after login
- Store the role in the global authentication state
- Expose the role via useAuth() for UI components
Expected Outcome
- The frontend will have access to the authenticated user's role, enabling future implementation of:
- Role-based UI rendering
- Permission-based access control
- RBAC features across the application
Related Files
ui/context/AuthContext.tsx
ui/server/fetchUser.ts
Proposed Implementation
Fetch the role using fetchUserRole(token, username) after authentication and store it in the AuthContext state.
Problem
Currently, the authentication context stores the user token but does not expose the user's role globally. This makes it difficult to implement role-based UI behavior and RBAC features in the frontend.
Proposed Solution
Extend the AuthContext to retrieve and store the user role after authentication using the existing fetchUserRole function.
This would:
Expected Outcome
Related Files
ui/context/AuthContext.tsx
ui/server/fetchUser.ts
Proposed Implementation
Fetch the role using fetchUserRole(token, username) after authentication and store it in the AuthContext state.