pub trait TenantFilterProvider {
// Required method
fn tenant_condition<E>(scope: &AccessScope) -> Option<Condition>
where E: ScopableEntity + EntityTrait,
E::Column: ColumnTrait + Copy;
}Expand description
Provides tenant filtering logic for scoped queries.
This trait abstracts the tenant filtering mechanism, allowing for future enhancements like hierarchical tenant structures (“effective tenants”) without changing calling code.
§Current Implementation
SimpleTenantFilter uses direct tenant_id IN (...) filtering.
§Future Enhancement
A HierarchicalTenantFilter could query “effective tenant IDs” from
a tenant hierarchy service and expand the filter accordingly.
Required Methods§
Sourcefn tenant_condition<E>(scope: &AccessScope) -> Option<Condition>
fn tenant_condition<E>(scope: &AccessScope) -> Option<Condition>
Build a condition for tenant filtering based on the scope.
Returns:
Noneif no tenant filtering needed (no tenant IDs in scope)Some(deny_all)if entity has no tenant column but tenants requestedSome(filter)with appropriate tenant IN clause
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.