medium complexity extracted User Management Confidence: 100%
6
Components
106
Shared
0
User Stories
Yes
Analyzed

Description

This feature enables administrators to assign and modify user roles within the Meander platform. Roles define what each user can see and do across the mobile app and admin portal. Supported roles include Peer Mentor, Coordinator, Organization Admin, and Global Admin. The feature allows an Org Admin to promote a Coordinator to an Org Admin role, assign a newly invited user to the Peer Mentor role, or adjust access as responsibilities change. Role changes take effect immediately and are enforced across all active sessions via JWT re-validation on the next request.

User Flow

Role Assignment user flow
Click to expand

Analysis

Business Value

Role-based access control is a non-negotiable security and operational requirement for a multi-tenant platform handling sensitive personal data about vulnerable individuals. Incorrect role assignment could expose contact details, encrypted assignments, or financial reimbursement data to unauthorized users. For organizations, the ability to precisely control who can approve expenses, access Bufdir reports, or register on behalf of others is essential for internal governance and compliance. Proper role management also reduces the support burden on Norse Digital Products, as Org Admins can self-service access changes without requiring platform-level intervention.

Implementation Notes

Roles are stored in the user_roles and user_role_assignments tables. The Role Assignment Component in the admin portal renders a dropdown or toggle interface for selecting roles, posting to /api/v1/users/{id}/roles. Role enforcement is implemented as middleware on both the Next.js API routes and consumed by the Flutter app via the JWT claims. The system uses a deny-by-default approach: all access is blocked unless a role explicitly grants it. Role changes invalidate the user's current JWT on the next refresh cycle by checking a roles_updated_at timestamp against the token's iat claim. The Role Assignment Service encapsulates validation logic to prevent illegal role escalation, such as an Org Admin granting Global Admin privileges.

Components (112)

User Interface (2)

Service Layer (2)

Data Layer (2)

Shared Components

These components are reused across multiple features

Service Layer (34)

Data Layer (22)

Infrastructure (38)

infrastructure Keychain/Keystore Adapter low Shared infrastructure JWT Claims Extractor low Shared infrastructure Organization Labels Adapter low Shared infrastructure Keychain/Keystore Adapter low Shared infrastructure Auth API Client medium Shared infrastructure REST API Client medium Shared infrastructure WCAG Accessibility Adapter low Shared infrastructure Registration API Client low Shared infrastructure Accounting API Client high Shared infrastructure PDF Renderer Adapter medium Shared infrastructure File Share Adapter low Shared infrastructure FCM/APNs Adapter high Shared infrastructure Share Sheet Adapter low Shared infrastructure Share Plus Adapter low Shared infrastructure Platform Accessibility Bridge medium Shared infrastructure Semantics Override Adapter high Shared infrastructure URL Launcher Adapter low Shared infrastructure Markdown Content Renderer low Shared infrastructure Network Connectivity Monitor low Shared infrastructure Expense Receipt Storage Adapter low Shared infrastructure Audit Log Writer low Shared infrastructure Feature Flag Checker low Shared infrastructure Logo Upload Adapter low Shared infrastructure Terminology Constants Registry low Shared infrastructure Feature Flag Cache Adapter low Shared infrastructure Org Scope JWT Resolver medium Shared infrastructure Association Audit Logger low Shared infrastructure Token Blocklist medium Shared infrastructure Analytics Tracker low Shared infrastructure SEO Metadata Config low Shared infrastructure Analytics Tracker low Shared infrastructure Analytics Tracker low Shared infrastructure Sales Analytics Tracker low Shared infrastructure Email Provider Adapter low Shared infrastructure Terms of Service Content Provider low Shared infrastructure Legal PDF Asset Provider low Shared infrastructure Consent-Gated Script Loader low Shared infrastructure Legal Page Layout low Shared

User Stories

No user stories have been generated for this feature yet.