HIGH story-role-based-access-control-global-admin-004 3 pts
3
Story Points
High
Priority
Role-Based Access Control
Feature

User Story

As a user
I want the app to remember my role and organizational context when I am offline
So that So that I can continue using the app in field conditions with limited connectivity without being locked out or losing my session context

Acceptance Criteria

  • Given a user has previously authenticated and their role data has been cached, when the device goes offline, then the app continues to function with the cached role and organization context
  • Given the device is offline and the user navigates to a protected route, when the Permission Guard evaluates access, then it uses the cached role data from the Role Config Store
  • Given the device reconnects to the network, when the session is active, then the Role Config Store is refreshed with the latest role data from Supabase
  • Given the user switches roles while online, when the switch completes, then the Role Config Store cache is invalidated and refreshed with the new active role
  • Given the cached session has expired after an extended offline period, when the user attempts to access a protected route, then they are redirected to the login screen rather than using expired cached credentials

Business Value

Peer mentors use the app in the field during home visits and community events where connectivity may be unreliable. Without offline role caching, any connectivity interruption would lock them out of the app, making it unusable in real-world conditions. This is particularly critical for Norwegian users in rural areas or older users relying on less reliable mobile infrastructure.