Enum scratchstack_aspen::Principal
source · pub enum Principal {
Any,
Specified(SpecifiedPrincipal),
}
Expand description
A principal statement in an Aspen policy.
Principal enums are immutable.
Variants§
Any
Any principal (wildcard: *
)
Specified(SpecifiedPrincipal)
A set of principals specified by a source and a list of identifiers for that source.
Implementations§
source§impl Principal
impl Principal
sourcepub fn is_any(&self) -> bool
pub fn is_any(&self) -> bool
Indicates whether this Principal is Principal::Any.
sourcepub fn specified(&self) -> Option<&SpecifiedPrincipal>
pub fn specified(&self) -> Option<&SpecifiedPrincipal>
If this Principal is Principal::Specified, returns the SpecifiedPrincipal. Otherwise returns None
.
sourcepub fn matches(&self, actor: &PrincipalActor) -> bool
pub fn matches(&self, actor: &PrincipalActor) -> bool
Indicates whether this Principal matches an identity from the PrincipalActor.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Principal
impl<'de> Deserialize<'de> for Principal
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
source§impl From<SpecifiedPrincipal> for Principal
impl From<SpecifiedPrincipal> for Principal
source§fn from(sp: SpecifiedPrincipal) -> Self
fn from(sp: SpecifiedPrincipal) -> Self
Converts to this type from the input type.