Struct TenantValidatingProvider

Source
pub struct TenantValidatingProvider<P> { /* private fields */ }
Expand description

Validation wrapper that ensures tenant context is properly handled.

This wrapper validates tenant contexts and provides clear error messages when operations are performed with incorrect tenant contexts.

Implementations§

Source§

impl<P> TenantValidatingProvider<P>

Source

pub fn new(provider: P) -> Self

Create a new validating provider wrapper.

Source

pub fn inner(&self) -> &P

Get reference to the inner provider.

Source

pub fn into_inner(self) -> P

Consume wrapper and return inner provider.

Trait Implementations§

Source§

impl<P> ResourceProvider for TenantValidatingProvider<P>
where P: ResourceProvider + Send + Sync, P::Error: Send + Sync + 'static,

Source§

type Error = AdapterError<<P as ResourceProvider>::Error>

Source§

fn create_resource( &self, resource_type: &str, data: Value, context: &RequestContext, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send

Create a resource for the tenant specified in the request context. Read more
Source§

fn get_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send

Get a resource by ID from the tenant specified in the request context. Read more
Source§

fn update_resource( &self, resource_type: &str, id: &str, data: Value, context: &RequestContext, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send

Update a resource in the tenant specified in the request context. Read more
Source§

fn delete_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Delete a resource from the tenant specified in the request context. Read more
Source§

fn list_resources( &self, resource_type: &str, query: Option<&ListQuery>, context: &RequestContext, ) -> impl Future<Output = Result<Vec<Resource>, Self::Error>> + Send

List resources from the tenant specified in the request context. Read more
Source§

fn find_resource_by_attribute( &self, resource_type: &str, attribute: &str, value: &Value, context: &RequestContext, ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send

Find a resource by attribute value within the tenant specified in the request context. Read more
Source§

fn resource_exists( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

Check if a resource exists within the tenant specified in the request context. Read more
Source§

fn conditional_update( &self, resource_type: &str, id: &str, data: Value, expected_version: &ScimVersion, context: &RequestContext, ) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Send
where Self: Sync,

Conditionally update a resource if the version matches. Read more
Source§

fn conditional_delete( &self, resource_type: &str, id: &str, expected_version: &ScimVersion, context: &RequestContext, ) -> impl Future<Output = Result<ConditionalResult<()>, Self::Error>> + Send
where Self: Sync,

Conditionally delete a resource if the version matches. Read more
Source§

fn get_versioned_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Send
where Self: Sync,

Get a resource with its version information. Read more
Source§

fn patch_resource( &self, resource_type: &str, id: &str, patch_request: &Value, context: &RequestContext, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
where Self: Sync,

Apply PATCH operations to a resource within the tenant specified in the request context. Read more
Source§

fn apply_patch_operation( &self, _resource_data: &mut Value, _operation: &Value, ) -> Result<(), Self::Error>

Apply a single PATCH operation to resource data. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ResourceProviderExt for T

Source§

fn create_single_tenant( &self, resource_type: &str, data: Value, request_id: Option<String>, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
where Self: Sync,

Convenience method for single-tenant resource creation. Read more
Source§

fn create_multi_tenant( &self, tenant_id: &str, resource_type: &str, data: Value, request_id: Option<String>, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
where Self: Sync,

Convenience method for multi-tenant resource creation. Read more
Source§

fn get_single_tenant( &self, resource_type: &str, id: &str, request_id: Option<String>, ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send
where Self: Sync,

Convenience method for single-tenant resource retrieval.
Source§

fn get_multi_tenant( &self, tenant_id: &str, resource_type: &str, id: &str, request_id: Option<String>, ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send
where Self: Sync,

Convenience method for multi-tenant resource retrieval.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TenantValidator for T

Source§

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>

Validate that the context is for single-tenant operation.
Source§

fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>

Extract tenant context or return error for multi-tenant operations.
Source§

impl<P> ToSingleTenant<P> for P

Source§

fn to_single_tenant(self) -> TenantValidatingProvider<P>

Convert to a provider that validates single-tenant contexts.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.