Skip to main content

User Management

CORTEX provides comprehensive user lifecycle management within a multi-tenant environment.

User Model

interface User {
id: string; // UUID
email: string; // Unique within tenant
firstName: string;
lastName: string;
tenantId: string; // Owning tenant
status: UserStatus;
lastLoginAt: Date | null;
createdAt: Date;
updatedAt: Date;
}

enum UserStatus {
ACTIVE = 'ACTIVE',
SUSPENDED = 'SUSPENDED',
INACTIVE = 'INACTIVE',
}

User Lifecycle

                    ┌──────────────┐
Registration ───▶│ ACTIVE │
└──────────────┘

┌────────────┼────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ SUSPENDED │ │ (stays │ │ INACTIVE │
│ │ │ ACTIVE) │ │ │
└──────────┘ └──────────┘ └──────────┘
│ │
└──────────▶───────────────┘
(can reactivate)

Endpoints

MethodEndpointDescription
POST/usersCreate user
GET/usersList users
GET/users/:idGet user by ID
PATCH/users/:idUpdate user
DELETE/users/:idDelete user
GET/users/:id/rolesGet user's roles
POST/users/:id/suspendSuspend user
POST/users/:id/reactivateReactivate user

Key Features

Email Uniqueness

Email addresses are unique within a tenant. The same email can exist in different tenants.

Soft Delete

Users are soft-deleted (marked as INACTIVE) rather than hard-deleted, preserving audit history.

Status Management

User status can be changed programmatically or administratively to control access.

Organization Membership

Users can belong to multiple organizations within a tenant.

User Statuses

StatusCan LoginDescription
ACTIVEYesNormal account
SUSPENDEDNoTemporarily disabled
INACTIVENoPermanently disabled / deleted