pub struct CapabilityService { /* private fields */ }Expand description
Service for managing and validating capabilities
Implementations§
Source§impl CapabilityService
impl CapabilityService
Sourcepub fn with_config(config: CapabilityConfig) -> Self
pub fn with_config(config: CapabilityConfig) -> Self
Create a capability service with custom config
Sourcepub fn check_capability(
&self,
cap_set: &CapabilitySet,
resource_type: &ResourceType,
action: &Action,
scope: Option<&str>,
) -> bool
pub fn check_capability( &self, cap_set: &CapabilitySet, resource_type: &ResourceType, action: &Action, scope: Option<&str>, ) -> bool
Check if a capability set allows a specific action
Sourcepub fn grant_capabilities(
&self,
existing_caps: &CapabilitySet,
new_caps: Vec<Capability>,
) -> CapabilitySet
pub fn grant_capabilities( &self, existing_caps: &CapabilitySet, new_caps: Vec<Capability>, ) -> CapabilitySet
Grant capabilities to a principal (returns updated capability set)
Sourcepub fn revoke_capabilities(
&self,
existing_caps: &CapabilitySet,
caps_to_revoke: Vec<Capability>,
) -> CapabilitySet
pub fn revoke_capabilities( &self, existing_caps: &CapabilitySet, caps_to_revoke: Vec<Capability>, ) -> CapabilitySet
Revoke capabilities from a principal
Sourcepub fn attenuate_capabilities(
&self,
cap_set: &CapabilitySet,
restrictions: Vec<Capability>,
) -> CapabilitySet
pub fn attenuate_capabilities( &self, cap_set: &CapabilitySet, restrictions: Vec<Capability>, ) -> CapabilitySet
Create an attenuated capability set for safer operations
Sourcepub fn create_preset_capability_set(
preset: PresetCapabilitySet,
) -> CapabilitySet
pub fn create_preset_capability_set( preset: PresetCapabilitySet, ) -> CapabilitySet
Create predefined capability sets for common use cases
Auto Trait Implementations§
impl Freeze for CapabilityService
impl RefUnwindSafe for CapabilityService
impl Send for CapabilityService
impl Sync for CapabilityService
impl Unpin for CapabilityService
impl UnwindSafe for CapabilityService
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