pub struct RequestContext {
pub request_id: String,
pub tenant_context: Option<TenantContext>,
}
Expand description
Request context for SCIM operations.
Provides request tracking for logging and auditing purposes. Optionally includes tenant context for multi-tenant operations.
Fields§
§request_id: String
Unique identifier for this request
tenant_context: Option<TenantContext>
Optional tenant context for multi-tenant operations
Implementations§
Source§impl RequestContext
impl RequestContext
Sourcepub fn new(request_id: String) -> Self
pub fn new(request_id: String) -> Self
Create a new request context with a specific request ID.
Sourcepub fn with_generated_id() -> Self
pub fn with_generated_id() -> Self
Create a new request context with a generated request ID.
Sourcepub fn with_tenant(request_id: String, tenant_context: TenantContext) -> Self
pub fn with_tenant(request_id: String, tenant_context: TenantContext) -> Self
Create a new request context with tenant information.
Sourcepub fn with_tenant_generated_id(tenant_context: TenantContext) -> Self
pub fn with_tenant_generated_id(tenant_context: TenantContext) -> Self
Create a new request context with generated ID and tenant information.
Sourcepub fn is_multi_tenant(&self) -> bool
pub fn is_multi_tenant(&self) -> bool
Check if this is a multi-tenant request.
Sourcepub fn isolation_level(&self) -> Option<&IsolationLevel>
pub fn isolation_level(&self) -> Option<&IsolationLevel>
Get the isolation level for this request.
Sourcepub fn can_perform_operation(&self, operation: &str) -> bool
pub fn can_perform_operation(&self, operation: &str) -> bool
Check if the tenant has permission for a specific operation.
Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§fn clone(&self) -> RequestContext
fn clone(&self) -> RequestContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RequestContext
impl Debug for RequestContext
Auto Trait Implementations§
impl Freeze for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnwindSafe for RequestContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> TenantValidator for T
impl<T> TenantValidator for T
Source§fn validate_tenant_context(
&self,
expected_tenant_id: &str,
context: &RequestContext,
) -> Result<(), String>
fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>
Validate that the context has the expected tenant.
Source§fn validate_single_tenant_context(
&self,
context: &RequestContext,
) -> Result<(), String>
fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>
Validate that the context is for single-tenant operation.
Source§fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
Extract tenant context or return error for multi-tenant operations.