Role Assignment
Feature Detail
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
Analysis
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.
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)
Shared Components
These components are reused across multiple features
User Interface (12)
Service Layer (34)
Data Layer (22)
Infrastructure (38)
User Stories
No user stories have been generated for this feature yet.