pub struct MultiTenantEngine { /* private fields */ }Expand description
Multi-tenant authorization engine
Implementations§
Source§impl MultiTenantEngine
impl MultiTenantEngine
pub fn new() -> Self
Sourcepub async fn set_quota(&self, quota: TenantQuota) -> Result<()>
pub async fn set_quota(&self, quota: TenantQuota) -> Result<()>
Create or update tenant quota
Sourcepub async fn check_tuple_quota(&self, tenant_id: &str) -> Result<bool>
pub async fn check_tuple_quota(&self, tenant_id: &str) -> Result<bool>
Check if tenant can create a tuple
Sourcepub async fn check_permission_quota(&self, tenant_id: &str) -> Result<bool>
pub async fn check_permission_quota(&self, tenant_id: &str) -> Result<bool>
Check if tenant can perform permission check
Sourcepub async fn increment_tuple_count(&self, tenant_id: &str) -> Result<()>
pub async fn increment_tuple_count(&self, tenant_id: &str) -> Result<()>
Increment tuple count for tenant
Sourcepub async fn decrement_tuple_count(&self, tenant_id: &str) -> Result<()>
pub async fn decrement_tuple_count(&self, tenant_id: &str) -> Result<()>
Decrement tuple count for tenant
Sourcepub async fn log_cross_tenant_access(
&self,
access: CrossTenantAccess,
) -> Result<()>
pub async fn log_cross_tenant_access( &self, access: CrossTenantAccess, ) -> Result<()>
Log cross-tenant access
Sourcepub async fn get_cross_tenant_log(&self) -> Result<Vec<CrossTenantAccess>>
pub async fn get_cross_tenant_log(&self) -> Result<Vec<CrossTenantAccess>>
Get cross-tenant access log
Sourcepub async fn reset_all_rate_limits(&self) -> Result<()>
pub async fn reset_all_rate_limits(&self) -> Result<()>
Reset rate limits for all tenants (called every minute)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiTenantEngine
impl !RefUnwindSafe for MultiTenantEngine
impl Send for MultiTenantEngine
impl Sync for MultiTenantEngine
impl Unpin for MultiTenantEngine
impl !UnwindSafe for MultiTenantEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more