pub struct TemplateBody { /* private fields */ }
Expand description
Policy datatype. This is used for both templates (in which case it contains slots) and static policies (in which case it contains zero slots).
Implementations§
Source§impl TemplateBody
impl TemplateBody
Sourcepub fn annotation(&self, key: &AnyId) -> Option<&Annotation>
pub fn annotation(&self, key: &AnyId) -> Option<&Annotation>
Get data from an annotation.
Sourcepub fn annotations_arc(&self) -> &Arc<Annotations>
pub fn annotations_arc(&self) -> &Arc<Annotations>
Get shared ref to annotations
Sourcepub fn annotations(&self) -> impl Iterator<Item = (&AnyId, &Annotation)>
pub fn annotations(&self) -> impl Iterator<Item = (&AnyId, &Annotation)>
Get all annotation data.
Sourcepub fn principal_constraint(&self) -> &PrincipalConstraint
pub fn principal_constraint(&self) -> &PrincipalConstraint
Get the principal
scope constraint of this policy.
Sourcepub fn principal_constraint_expr(&self) -> Expr
pub fn principal_constraint_expr(&self) -> Expr
Get the principal
scope constraint as an expression.
This will be a boolean-valued expression: either true
(if the policy
just has principal,
), or an equality or hierarchy constraint
Sourcepub fn action_constraint(&self) -> &ActionConstraint
pub fn action_constraint(&self) -> &ActionConstraint
Get the action
scope constraint of this policy.
Sourcepub fn action_constraint_expr(&self) -> Expr
pub fn action_constraint_expr(&self) -> Expr
Get the action
scope constraint of this policy as an expression.
This will be a boolean-valued expression: either true
(if the policy
just has action,
), or an equality or hierarchy constraint
Sourcepub fn resource_constraint(&self) -> &ResourceConstraint
pub fn resource_constraint(&self) -> &ResourceConstraint
Get the resource
scope constraint of this policy.
Sourcepub fn resource_constraint_expr(&self) -> Expr
pub fn resource_constraint_expr(&self) -> Expr
Get the resource
scope constraint of this policy as an expression.
This will be a boolean-valued expression: either true
(if the policy
just has resource,
), or an equality or hierarchy constraint
Sourcepub fn non_scope_constraints(&self) -> &Expr
pub fn non_scope_constraints(&self) -> &Expr
Get the non-scope constraints of this policy.
This will be a conjunction of the policy’s when
conditions and the
negation of each of the policy’s unless
conditions.
Sourcepub fn non_scope_constraints_arc(&self) -> &Arc<Expr>
pub fn non_scope_constraints_arc(&self) -> &Arc<Expr>
Get the Arc owning the non scope constraints
Sourcepub fn condition(&self) -> Expr
pub fn condition(&self) -> Expr
Get the condition expression of this policy.
This will be a conjunction of the policy’s scope constraints (on principal, resource, and action); the policy’s “when” conditions; and the negation of each of the policy’s “unless” conditions.
Construct a Policy
from components that are already std::sync::Arc
allocated
Sourcepub fn new(
id: PolicyID,
loc: Option<Loc>,
annotations: Annotations,
effect: Effect,
principal_constraint: PrincipalConstraint,
action_constraint: ActionConstraint,
resource_constraint: ResourceConstraint,
non_scope_constraints: Expr,
) -> Self
pub fn new( id: PolicyID, loc: Option<Loc>, annotations: Annotations, effect: Effect, principal_constraint: PrincipalConstraint, action_constraint: ActionConstraint, resource_constraint: ResourceConstraint, non_scope_constraints: Expr, ) -> Self
Construct a Policy
from its components
Trait Implementations§
Source§impl Clone for TemplateBody
impl Clone for TemplateBody
Source§fn clone(&self) -> TemplateBody
fn clone(&self) -> TemplateBody
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TemplateBody
impl Debug for TemplateBody
Source§impl<'de> Deserialize<'de> for TemplateBody
impl<'de> Deserialize<'de> for TemplateBody
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>,
Source§impl Display for TemplateBody
impl Display for TemplateBody
Source§impl From<StaticPolicy> for TemplateBody
impl From<StaticPolicy> for TemplateBody
Source§fn from(p: StaticPolicy) -> Self
fn from(p: StaticPolicy) -> Self
Source§impl From<Template> for TemplateBody
impl From<Template> for TemplateBody
Source§impl From<TemplateBody> for Template
impl From<TemplateBody> for Template
Source§fn from(body: TemplateBody) -> Self
fn from(body: TemplateBody) -> Self
Source§impl Hash for TemplateBody
impl Hash for TemplateBody
Source§impl PartialEq for TemplateBody
impl PartialEq for TemplateBody
Source§impl Serialize for TemplateBody
impl Serialize for TemplateBody
impl Eq for TemplateBody
impl StructuralPartialEq for TemplateBody
Auto Trait Implementations§
impl Freeze for TemplateBody
impl RefUnwindSafe for TemplateBody
impl Send for TemplateBody
impl Sync for TemplateBody
impl Unpin for TemplateBody
impl UnwindSafe for TemplateBody
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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