medium complexity extracted Profile Management Confidence: 100%
3
Components
32
Shared
0
User Stories
Yes
Analyzed

Description

This feature allows users who hold multiple roles within the platform - such as a user who is both a Peer Mentor in one context and a Coordinator in another - to switch their active role or organizational context without logging out. The role switch widget surfaces role options based on the user's assigned user_roles records and updates the navigation, home dashboard content, and available actions to reflect the selected role. This is particularly relevant for NHF, which has members potentially belonging to up to five local associations.

User Flow

Profile Switching user flow
Click to expand

Analysis

Business Value

Multi-role users are common in peer mentor organizations, especially among experienced volunteers who also take on coordination responsibilities. Without profile switching, these users would need separate accounts or would be locked into a single role view, reducing the utility of the app and creating data attribution errors. For coordinators who also do peer mentoring, seamless switching eliminates friction and increases the likelihood of accurate activity registration under the correct role. This directly improves data quality for Bufdir reporting and organizational statistics, delivering measurable value to org admins and coordinators who rely on accurate records.

Implementation Notes

The active role and organization context must be stored in secure local state (e.g., Riverpod provider or BLoC) and persisted across sessions using secure storage. The Profile Switch Service queries the user_roles table (filtered by the authenticated user) to enumerate available roles and org/association combinations. On switch, the app should re-initialize role-dependent providers and navigate to the appropriate home screen variant. The Role Switch Widget must be accessible from the hamburger menu or profile screen, with clear visual indication of the currently active role. Ensure that activity registration, statistics, and other data queries are always scoped to the active role/org context to prevent cross-tenant data leakage.

Components (35)

User Interface (1)

Service Layer (1)

Data Layer (1)

Shared Components

These components are reused across multiple features

User Stories

No user stories have been generated for this feature yet.