pub enum Condition {
Eq {
left: Operand,
right: Operand,
},
Ne {
left: Operand,
right: Operand,
},
Lt {
left: Operand,
right: Operand,
},
Le {
left: Operand,
right: Operand,
},
Gt {
left: Operand,
right: Operand,
},
Ge {
left: Operand,
right: Operand,
},
In {
item: Operand,
set: Operand,
},
Exists {
attr: String,
},
All {
of: Vec<Condition>,
},
Any {
of: Vec<Condition>,
},
Not {
cond: Box<Condition>,
},
Call {
func: String,
args: Vec<Operand>,
},
}Expand description
Serializable ABAC condition, stored together with the grant.
Variants§
Eq
Ne
Lt
Le
Gt
Ge
In
item belongs to the list set.
Exists
The attribute exists.
All
Any
Not
Call
Function registered in the engine’s ConditionRegistry.
Implementations§
Source§impl Condition
impl Condition
pub fn eq(left: Operand, right: Operand) -> Self
pub fn ne(left: Operand, right: Operand) -> Self
pub fn lt(left: Operand, right: Operand) -> Self
pub fn le(left: Operand, right: Operand) -> Self
pub fn gt(left: Operand, right: Operand) -> Self
pub fn ge(left: Operand, right: Operand) -> Self
pub fn is_in(item: Operand, set: Operand) -> Self
pub fn exists(attr: impl Into<String>) -> Self
pub fn all(of: impl IntoIterator<Item = Condition>) -> Self
pub fn any(of: impl IntoIterator<Item = Condition>) -> Self
pub fn not(cond: Condition) -> Self
pub fn call( func: impl Into<String>, args: impl IntoIterator<Item = Operand>, ) -> Self
Sourcepub fn functions(&self) -> Vec<&str>
pub fn functions(&self) -> Vec<&str>
Names of the functions used, to validate against the registry before writing the grant.
pub fn evaluate( &self, ctx: &EvalContext<'_>, registry: &ConditionRegistry, ) -> Result<bool, ConditionError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Condition
impl<'de> Deserialize<'de> for Condition
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
impl StructuralPartialEq for Condition
Auto Trait Implementations§
impl Forget for Condition
impl Freeze for Condition
impl Move for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnsafeUnpin for Condition
impl UnwindSafe for Condition
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