Skip to content

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

@alizahh-7

Description

@alizahh-7

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions