medium complexity extracted Authentication & Access Control Confidence: 100%
2
Components
58
Shared
0
User Stories
Yes
Analyzed

Description

This feature enforces the four-role access model (Peer Mentor, Coordinator, Organization Administrator, Global Administrator) across all mobile screens and API endpoints. A Role Guard Service evaluates the authenticated user's role and organization context on every navigation event, blocking access to screens outside the user's permission scope. A dedicated No-Access screen is shown to roles that have no mobile access (e.g., Global Administrator, who is redirected to the admin panel). An Auth Middleware on the backend validates role claims on every API request.

User Flow

Role-Based Access Control user flow
Click to expand

Analysis

Business Value

Role-based access control is the security foundation that makes multi-organization multi-role operation safe and correct. Without it, peer mentors could access coordinator tools, coordinators could view other organizations' data, and the entire data isolation model collapses. The four-role model directly maps to the organizational hierarchy of all partner organizations and drives role-specific home screens, navigation items, and feature availability. Correct RBAC also ensures compliance with GDPR data minimization principles — users only see data relevant to their role and organization context.

Implementation Notes

Role claims are embedded in the JWT issued at login and validated server-side on every request by the Auth Middleware (Next.js middleware layer). The Flutter Role Guard Service is a Riverpod provider that reads the current user's role from state and exposes a permission-checking API consumed by all navigators and conditional UI builders. The Permissions Repository caches the role-permission matrix locally for offline access. Navigation guards are implemented as route-level checks in the GoRouter configuration, redirecting unauthorized access to the No-Access screen. The no-access screen provides a clear message and a link to the web admin panel for Global Administrators.

Components (60)

User Interface (1)

Data Layer (1)

Shared Components

These components are reused across multiple features

Infrastructure (20)

User Stories

No user stories have been generated for this feature yet.