pub struct ValidatorActionId { /* private fields */ }
Expand description
Contains information about actions used by the validator. The contents of
the struct are the same as the schema entity type structure, but the
member_of
relation is reversed to instead be descendants
.
Implementations§
Source§impl ValidatorActionId
impl ValidatorActionId
Sourcepub fn new(
name: EntityUID,
principal_entity_types: impl IntoIterator<Item = EntityType>,
resource_entity_types: impl IntoIterator<Item = EntityType>,
descendants: impl IntoIterator<Item = EntityUID>,
context: Type,
attribute_types: Attributes,
attributes: BTreeMap<SmolStr, PartialValueSerializedAsExpr>,
) -> Self
pub fn new( name: EntityUID, principal_entity_types: impl IntoIterator<Item = EntityType>, resource_entity_types: impl IntoIterator<Item = EntityType>, descendants: impl IntoIterator<Item = EntityUID>, context: Type, attribute_types: Attributes, attributes: BTreeMap<SmolStr, PartialValueSerializedAsExpr>, ) -> Self
Construct a new ValidatorActionId
.
This constructor assumes that descendants
has TC already computed.
That is, caller is responsible for TC.
Sourcepub fn descendants(&self) -> impl Iterator<Item = &EntityUID>
pub fn descendants(&self) -> impl Iterator<Item = &EntityUID>
Iterator over the actions that are members of this action
Sourcepub fn principals(&self) -> impl Iterator<Item = &EntityType>
pub fn principals(&self) -> impl Iterator<Item = &EntityType>
Returns an iterator over all the principals that this action applies to
Sourcepub fn resources(&self) -> impl Iterator<Item = &EntityType>
pub fn resources(&self) -> impl Iterator<Item = &EntityType>
Returns an iterator over all the resources that this action applies to
Sourcepub fn context_type(&self) -> &Type
pub fn context_type(&self) -> &Type
The Type
that this action requires for its context.
This always returns a closed record type.
Sourcepub fn applies_to_principals(&self) -> impl Iterator<Item = &EntityType>
pub fn applies_to_principals(&self) -> impl Iterator<Item = &EntityType>
The ast::EntityType
s that can be the principal
for this action.
Sourcepub fn applies_to_resources(&self) -> impl Iterator<Item = &EntityType>
pub fn applies_to_resources(&self) -> impl Iterator<Item = &EntityType>
The ast::EntityType
s that can be the resource
for this action.
Sourcepub fn is_applicable_principal_type(&self, ty: &EntityType) -> bool
pub fn is_applicable_principal_type(&self, ty: &EntityType) -> bool
Is the given principal type applicable for this spec?
Sourcepub fn is_applicable_resource_type(&self, ty: &EntityType) -> bool
pub fn is_applicable_resource_type(&self, ty: &EntityType) -> bool
Is the given resource type applicable for this spec?
Sourcepub fn attribute_types(&self) -> &Attributes
pub fn attribute_types(&self) -> &Attributes
Attribute types for this action
Sourcepub fn attributes(
&self,
) -> impl Iterator<Item = (&SmolStr, &PartialValueSerializedAsExpr)>
pub fn attributes( &self, ) -> impl Iterator<Item = (&SmolStr, &PartialValueSerializedAsExpr)>
Attribute values for this action
Trait Implementations§
Source§impl Clone for ValidatorActionId
impl Clone for ValidatorActionId
Source§fn clone(&self) -> ValidatorActionId
fn clone(&self) -> ValidatorActionId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ValidatorActionId
impl Debug for ValidatorActionId
Source§impl Serialize for ValidatorActionId
impl Serialize for ValidatorActionId
Source§impl TCNode<EntityUID> for ValidatorActionId
impl TCNode<EntityUID> for ValidatorActionId
Source§fn add_edge_to(&mut self, k: EntityUID)
fn add_edge_to(&mut self, k: EntityUID)
k
.Source§fn out_edges(&self) -> Box<dyn Iterator<Item = &EntityUID> + '_>
fn out_edges(&self) -> Box<dyn Iterator<Item = &EntityUID> + '_>
Source§fn has_edge_to(&self, e: &EntityUID) -> bool
fn has_edge_to(&self, e: &EntityUID) -> bool
k
.Auto Trait Implementations§
impl Freeze for ValidatorActionId
impl RefUnwindSafe for ValidatorActionId
impl Send for ValidatorActionId
impl Sync for ValidatorActionId
impl Unpin for ValidatorActionId
impl UnwindSafe for ValidatorActionId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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