pub enum AccessCondition {
TimeRange {
start_hour: u8,
end_hour: u8,
timezone: String,
},
IpWhitelist(Vec<String>),
UserAttribute {
attribute: String,
value: String,
operator: ComparisonOperator,
},
ResourceAttribute {
attribute: String,
value: String,
operator: ComparisonOperator,
},
And(Vec<AccessCondition>),
Or(Vec<AccessCondition>),
Not(Box<AccessCondition>),
}
Expand description
Access conditions for dynamic permission evaluation
Variants§
TimeRange
Time-based access (only allow during certain hours)
IpWhitelist(Vec<String>)
Location-based access
UserAttribute
User attribute condition
ResourceAttribute
Resource attribute condition
And(Vec<AccessCondition>)
Combine multiple conditions
Or(Vec<AccessCondition>)
Not(Box<AccessCondition>)
Implementations§
Source§impl AccessCondition
impl AccessCondition
Sourcepub fn evaluate(&self, context: &AccessContext) -> bool
pub fn evaluate(&self, context: &AccessContext) -> bool
Evaluate the condition against the given context
Trait Implementations§
Source§impl Clone for AccessCondition
impl Clone for AccessCondition
Source§fn clone(&self) -> AccessCondition
fn clone(&self) -> AccessCondition
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 AccessCondition
impl Debug for AccessCondition
Source§impl<'de> Deserialize<'de> for AccessCondition
impl<'de> Deserialize<'de> for AccessCondition
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 Hash for AccessCondition
impl Hash for AccessCondition
Source§impl PartialEq for AccessCondition
impl PartialEq for AccessCondition
Source§impl Serialize for AccessCondition
impl Serialize for AccessCondition
impl Eq for AccessCondition
impl StructuralPartialEq for AccessCondition
Auto Trait Implementations§
impl Freeze for AccessCondition
impl RefUnwindSafe for AccessCondition
impl Send for AccessCondition
impl Sync for AccessCondition
impl Unpin for AccessCondition
impl UnwindSafe for AccessCondition
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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