Module multitenancy

Module multitenancy 

Source
Expand description

Multi-Tenancy Support for Authorization

Provides tenant isolation, cross-tenant sharing, and per-tenant quotas.

§Features

  • Tenant Isolation: Logical partitioning by tenant_id
  • Cross-Tenant Sharing: Explicit permission grants across tenants
  • Per-Tenant Quotas: Resource limits and rate limiting
  • Audit Logging: Track all cross-tenant access

§Example

use oxify_authz::multitenancy::{TenantContext, MultiTenantEngine, TenantQuota};

let tenant_ctx = TenantContext::new("tenant-123");
let engine = MultiTenantEngine::new();

// Set tenant quota
let quota = TenantQuota::new("tenant-123").with_max_tuples(1000);
engine.set_quota(quota).await?;

// Check quota before operations
let can_create = engine.check_tuple_quota("tenant-123").await?;
assert!(can_create);

// Increment usage
engine.increment_tuple_count("tenant-123").await?;

Structs§

CrossTenantAccess
Cross-tenant access record for auditing
MultiTenantEngine
Multi-tenant authorization engine
Resource
Resource identifier
TenantContext
Tenant context for multi-tenancy
TenantQuota
Tenant quotas and limits
TenantRelationTuple
Tenant-specific relation tuple
TenantResource
Tenant-aware resource