User Management
Overview
Core Concepts
The Person Model
┌─────────────────────────────────────────────────────────────────┐
│ THE PERSON (Taylor) │
├─────────────────────┬─────────────────────┬─────────────────────┤
│ users (personal) │ users (work-acme) │ users (work-newco) │
│ id: user-P │ id: user-A │ id: user-N │
│ primary_user_id: │ primary_user_id: │ primary_user_id: │
│ NULL (is primary) │ user-P │ user-P │
├─────────────────────┼─────────────────────┼─────────────────────┤
│ user_identities: │ user_identities: │ user_identities: │
│ [email protected] │ [email protected] │ [email protected] │
│ (active) │ (DELETED on leave) │ (active) │
├─────────────────────┼─────────────────────┼─────────────────────┤
│ tenant_users: │ tenant_users: │ tenant_users: │
│ (none) │ acme (INACTIVE) │ newco (ACTIVE) │
├─────────────────────┼─────────────────────┼─────────────────────┤
│ DATA OWNED: │ DATA OWNED: │ DATA OWNED: │
│ - therapy sessions │ - survey responses │ - survey responses │
│ - EAP usage │ - backfill data │ - backfill data │
│ - personal reports │ - HRIS records │ - HRIS records │
└─────────────────────┴─────────────────────┴─────────────────────┘Key Distinctions
Concept
What It Is
Where Stored
Why Multiple User Records?
Database Schema
users Table
Field
Purpose
user_identities Table
Field
Purpose
User Lifecycle Flows
Flow 1: HRIS Creates Work Account
Flow 2: User Authenticates with Work Email
Flow 3: User Creates Personal Account
Personal Account Without Tenant Access
Flow 4: Linking Personal to Work Account
Flow 5: Employee Leaves Company
Access After Termination
Flow 6: User Joins New Company
Flow 7: GDPR Deletion Request
Data Retention After Deletion
Data Type
Action
Reason
Deletion Scope
Querying Linked Users
Helper Functions
Query Patterns
Personal vs Work Data
Data Ownership Model
Data Type
Owned By
Example
Privacy Boundary
Route-Based Data Access
Identity Resolution Flow
Account Linking UI
Settings Page
Linking Flow UI
Notification Routing
Routing Logic
Notification Context Examples
Notification Type
Context
Email Used
Why Not a Dedicated Field?
Best Practices
For HRIS Sync
For Authentication
For Data Queries
For Notifications
Future Improvements
Structured Name Fields in Employee Data
Related Documentation
Last updated