Service Layer medium complexity backend
0
Dependencies
0
Dependents
11
Entities
0
Integrations

Description

Orchestrates all administrative user lifecycle operations including invitation, profile updates, deactivation, and deletion. Enforces multi-tenant isolation by scoping every operation to the calling administrator's tenant. Acts as the authoritative business logic layer between the UI and the data repository.

Feature: User CRUD

admin-user-service

Sources & reasoning

Lines 325-328 explicitly place Brukeradministrasjon (invite, deactivate, role assignment) in the Admin Web Portal MVP scope. Without user CRUD the organization cannot onboard any peer mentors or coordinators, making the platform non-functional. It is the prerequisite for all other admin portal capabilities and directly referenced in the Phase 1 MVP deliverables.

  • docs/source/likeperson.md · line 325-328
    - Brukeradministrasjon (invitere, deaktivere, rolletildeling)

Responsibilities

  • Validate tenant membership and admin authorization before any mutation
  • Coordinate user invitation flow including token generation and email dispatch
  • Apply and persist profile updates with field-level validation
  • Enforce deactivation rules (e.g. cannot deactivate the last active admin)
  • Execute permanent deletion and cascade cleanup of related records

Interfaces

listUsers(tenantId, query): UserPage
getUser(tenantId, userId): User
inviteUser(tenantId, email, role): InviteResult
updateUser(tenantId, userId, changes): User
deactivateUser(tenantId, userId): void
deleteUser(tenantId, userId): void