OptionaladminRoles?: string[]Roles that bypass tenant filtering entirely
OptionalautoExcludeCoreEntities?: booleanWhen true, entities in the __mj core schema are never tenant-filtered
OptionalcontextSource?: "header" | "linkedEntity" | "custom"How the tenant ID is determined for each request
OptionaldefaultTenantColumn?: stringDefault column name containing the tenant identifier
Optionalenabled?: booleanMaster switch — when false (default), no tenant isolation is applied
OptionalentityColumnMappings?: Record<string, string>Per-entity overrides for the tenant column name: { "EntityName": "ColumnName" }
OptionalscopedEntities?: string[]Entities included/excluded from tenant filtering based on scopingStrategy
OptionalscopingStrategy?: "allowlist" | "denylist"Whether scopedEntities is an allowlist or denylist of entities to filter
OptionaltenantHeader?: stringHTTP header name used when contextSource is 'header'
OptionalwriteProtection?: "strict" | "log" | "off"Write protection mode: 'strict' rejects, 'log' warns, 'off' skips validation
Creates a PreSaveHook that validates the tenant column on writes.
In 'strict' mode, rejects saves where the tenant column value doesn't match the user's TenantContext. In 'log' mode, warns but allows. In 'off' mode, this hook is a no-op.