Service Layer medium complexity mobilebackend
0
Dependencies
0
Dependents
14
Entities
0
Integrations

Description

Enforces per-request authorization by checking the caller's role against the required role for each protected operation or surface. Lives inside each consuming product (Mobile App and Admin Web Portal) rather than in the shared Authentication Module, preserving auth portability.

Feature: Role-Based Access Control

role-guard

Sources & reasoning

Source defines four roles and strict tenant isolation rules in §Core Roles, and lists RBAC under Mobile App Architecture Auth & Access as well as the §5 Fase 1 MVP scope (two mobile role profiles, two admin role profiles). Target_release matches the source phase name 'MVP'.

  • 4 defined user roles: Peer Mentor, Coordinator, Organization Administrator, Global Administrator
  • No default access to an organization's operational data ... Tenant separation is strict ... Orgs can grant a Global Admin time-bounded support access
  • Role-based access control - Peer Mentor and Coordinator roles
  • 2 mobilrolle-profiler: Peer Mentor, Coordinator (Organization Admins logger på som Coordinator i app-konteksten)

Responsibilities

  • Resolve the current user's role from the Role Store on each protected request
  • Authorize or reject access based on canonical role-to-surface boundary rules
  • Map Org Admin to Coordinator behavior when running in the Mobile App context
  • Deny Global Admin default access to tenant data unless explicitly elevated
  • Emit authorization failure signals for logging and UI redirect handling

Interfaces

authorize(userId, action): AuthorizationResult
requireRole(userId, allowedRoles): void
getEffectiveRole(userId, surface): Role
canAccessSurface(userId, surface): boolean