pub struct AccessControlManager { /* private fields */ }Expand description
Access control manager
Implementations§
Source§impl AccessControlManager
impl AccessControlManager
Sourcepub fn can_access_feature(
&self,
holder: &TokenHolder,
feature: AiFeature,
) -> Result<bool>
pub fn can_access_feature( &self, holder: &TokenHolder, feature: AiFeature, ) -> Result<bool>
Verify if a token holder can access a feature
§Errors
Returns an error if the access tier is invalid or not configured.
Sourcepub fn record_usage(
&mut self,
holder: &TokenHolder,
feature: AiFeature,
) -> Result<()>
pub fn record_usage( &mut self, holder: &TokenHolder, feature: AiFeature, ) -> Result<()>
Record feature usage for a token holder
§Errors
Returns an error if:
- The access tier is invalid or not configured
- The daily or monthly quota is exceeded
- The feature is not available for the tier
Sourcepub fn get_available_features(&self, tier: AccessTier) -> Vec<AiFeature>
pub fn get_available_features(&self, tier: AccessTier) -> Vec<AiFeature>
Get available features for a tier
Sourcepub fn register_custom_agent(
&mut self,
holder: &TokenHolder,
agent: CustomAgentConfig,
) -> Result<()>
pub fn register_custom_agent( &mut self, holder: &TokenHolder, agent: CustomAgentConfig, ) -> Result<()>
Register a custom agent for a token
§Errors
Returns an error if:
- The access tier is invalid or not configured
- Custom agents are not available for the tier
- The maximum number of custom agents is exceeded
Sourcepub fn get_custom_agents(&self, token_id: Uuid) -> Vec<&CustomAgentConfig>
pub fn get_custom_agents(&self, token_id: Uuid) -> Vec<&CustomAgentConfig>
Get custom agents for a token
Sourcepub fn get_tier_config(&self, tier: AccessTier) -> Option<&TierConfig>
pub fn get_tier_config(&self, tier: AccessTier) -> Option<&TierConfig>
Get tier configuration
Sourcepub fn update_tier_config(&mut self, config: TierConfig)
pub fn update_tier_config(&mut self, config: TierConfig)
Update tier configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AccessControlManager
impl RefUnwindSafe for AccessControlManager
impl Send for AccessControlManager
impl Sync for AccessControlManager
impl Unpin for AccessControlManager
impl UnwindSafe for AccessControlManager
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().