Multi-Tenant Isolation & Data Classifications
Enterprise SaaS and regulated healthcare systems must isolate organization records strictly across every query and mutation while tagging personal and protected fields for masking, consent governance, and test anonymization.
1. MultiTenant vs GlobalMaster Scoping
Attach traits directly in Object Browser → Traits (🧩) or on entity cards in Diagram View:
| Trait | Tenant Scoping Behavior | Common Domain Uses |
|---|---|---|
MultiTenant |
Injects indexed tenantId (String) into the schema and constrains every generated read (findMany, findOne, findView) and mutation (update, delete) to req.user.tenantId. |
Operational records: Customer, WorkOrder, FieldAsset, Patient, Appointment, MedicalRecord |
GlobalMaster |
Shares canonical cross-tenant lookup data readably while preserving auditability and role write guards. | Standard code sets, tax jurisdictions, SNOMED / tariff reference tables |
Every compiled endpoint guarded by MultiTenant merges { id, tenantId: req.user.tenantId } into Prisma where clauses (using findFirst, update, or delete), eliminating cross-tenant identifier enumeration by construction.
2. Five-Tier Data Sensitivity Classification
Every entity attribute carries an explicit privacy classification tier used across the RBAC Matrix, API serializers, and Scenario PII Vault:
| Tier | Intent & Policy Effect | Example Attributes |
|---|---|---|
Public |
Non-sensitive catalog or status fields safe for broad display | code, status, durationMinutes |
Internal |
Operational metadata restricted to authenticated workspace users | slaTargetHours, priority, assignedRegion |
PII |
Personally identifiable contact or identity data subject to GDPR masking & PII Vault scrubbing | primaryContactEmail, nhsNumber, firstName, lastName, dateOfBirth |
Confidential |
Restricted commercial, credential, or non-public diagnosis values | primarySnomedCode, treatmentPlan, systolicBP, siteAccessPin |
ePHI |
Electronic Protected Health Information triggering mandatory unseal checks (reveal_sensitive) and HIPAA read/write audit events |
presentingComplaint, clinicalSummary |
When an attribute combines classification: PII, Confidential, or ePHI with role restrictions, users holding read without <Entity>.reveal_sensitive receive masked placeholders while authorized roles unseal the plaintext cleanly.
3. Automated PII Vault Scrubbing for Safe Environments
During Scenario snapshots and environment dataset captures, attributes marked classification: PII, Confidential, or ePHI are detected automatically and redacted into deterministic synthetic values inside non-production snapshots. Real patient identifiers and customer contact records remain isolated to encrypted production storage while staging and test suites retain valid schema shapes.