Validates an operation's resource modules against a tenant.
resolve/2 takes the resource modules an entry point touches and the tenant:
- If none declares multitenancy, the tenant passes through unchanged.
- If all declare attribute multitenancy on the same attribute with
global?: false, a tenant is required. Missing tenants return{:error, :tenant_required}. - Mixed declarations, different tenant attributes, context multitenancy,
or
global?: truereturn{:error, :tenancy_mismatch}.
Entry points supply every resource they read or write, including optional event-log and attempt-history resources. They reject missing or mismatched tenancy before data access. Event-log replay forwards its tenant to resend when rearming an existing terminal delivery.
Summary
Functions
Recovers the tenant from a stored row using its resource's
tenant_from_attribute callback. Resources without attribute multitenancy
return nil. Use this value for tenant options and custody canonicalization.
Validates the resources an operation touches against the caller's tenant.
Types
Functions
Recovers the tenant from a stored row using its resource's
tenant_from_attribute callback. Resources without attribute multitenancy
return nil. Use this value for tenant options and custody canonicalization.
Validates the resources an operation touches against the caller's tenant.
modules is the caller-supplied resource set. Only these modules are
checked. tenant is the caller-supplied tenant, or nil when absent.