Service Layer medium complexity mobileshared
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Manages the active profile selection for the current session and exposes it to other app modules. Persists the chosen context per session and notifies subscribers when the active profile changes.

Feature: Profile Switching

profile-context-service

Sources & reasoning

NHF explicitly needs to disambiguate members belonging to up to five local associations, and the doc requires Org Admins to appear as Coordinators on mobile - both demand an explicit context switcher to prevent mis-attributed activities. Targeted to Core Product because MVP only needs single-context login; multi-context handling is a documented Phase-2 concern tied to proxy/bulk registration and duplicate detection.

  • Håndtering av medlemmer i flere lokallag (opptil 5): Avklare tilhørighet og hindre dobbeltrapportering.
  • On mobile, an Org Admin is surfaced as a Coordinator - they use the same mobile experience as coordinators without a separate UI path.

Responsibilities

  • Resolve the set of profiles available to the authenticated user
  • Persist the active profile selection for the current session
  • Apply the role and association scope of the active profile to subsequent API calls
  • Emit change events so dependent screens can refresh
  • Restore the last active profile on app resume

Interfaces

getAvailableProfiles(): Profile[]
getActiveProfile(): Profile
setActiveProfile(profileId): Promise<Profile>
subscribe(listener): Unsubscribe

Related Data Entities (2)

Data entities managed by this component