Skip to main content

TenantFilterProvider

Trait TenantFilterProvider 

Source
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§

Source

fn tenant_condition<E>(scope: &AccessScope) -> Option<Condition>

Build a condition for tenant filtering based on the scope.

Returns:

  • None if no tenant filtering needed (empty tenant_ids)
  • Some(deny_all) if entity has no tenant column but tenants requested
  • Some(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.

Implementors§