pub struct CapabilitySet {
pub capabilities: Vec<Capability>,
pub metadata: Option<HashMap<String, Value>>,
}Expand description
A set of capabilities granted to a principal
Fields§
§capabilities: Vec<Capability>The capabilities in this set
metadata: Option<HashMap<String, Value>>Optional metadata about this capability set
Implementations§
Source§impl CapabilitySet
impl CapabilitySet
Sourcepub fn with_metadata(metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(metadata: HashMap<String, Value>) -> Self
Create a capability set with metadata
Sourcepub fn add_capability(&mut self, capability: Capability)
pub fn add_capability(&mut self, capability: Capability)
Add a capability to this set
Sourcepub fn remove_capability(&mut self, capability: &Capability)
pub fn remove_capability(&mut self, capability: &Capability)
Remove a capability from this set
Sourcepub fn has_capability(&self, capability: &Capability) -> bool
pub fn has_capability(&self, capability: &Capability) -> bool
Check if this set contains a specific capability
Sourcepub fn allows(
&self,
resource_type: &ResourceType,
action: &Action,
scope: Option<&str>,
) -> bool
pub fn allows( &self, resource_type: &ResourceType, action: &Action, scope: Option<&str>, ) -> bool
Check if this set allows a specific action on a resource
Sourcepub fn capabilities_for_resource(
&self,
resource_type: &ResourceType,
) -> Vec<&Capability>
pub fn capabilities_for_resource( &self, resource_type: &ResourceType, ) -> Vec<&Capability>
Get all capabilities for a specific resource type
Sourcepub fn attenuate(&self, restrictions: Vec<Capability>) -> CapabilitySet
pub fn attenuate(&self, restrictions: Vec<Capability>) -> CapabilitySet
Create an attenuated capability set (more restrictive)
Sourcepub fn union(&self, other: &CapabilitySet) -> CapabilitySet
pub fn union(&self, other: &CapabilitySet) -> CapabilitySet
Combine this capability set with another (union)
Sourcepub fn intersection(&self, other: &CapabilitySet) -> CapabilitySet
pub fn intersection(&self, other: &CapabilitySet) -> CapabilitySet
Create intersection of this set with another
Trait Implementations§
Source§impl Clone for CapabilitySet
impl Clone for CapabilitySet
Source§fn clone(&self) -> CapabilitySet
fn clone(&self) -> CapabilitySet
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 CapabilitySet
impl Debug for CapabilitySet
Source§impl Default for CapabilitySet
impl Default for CapabilitySet
Source§impl<'de> Deserialize<'de> for CapabilitySet
impl<'de> Deserialize<'de> for CapabilitySet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CapabilitySet
impl RefUnwindSafe for CapabilitySet
impl Send for CapabilitySet
impl Sync for CapabilitySet
impl Unpin for CapabilitySet
impl UnwindSafe for CapabilitySet
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> 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