pub struct TemporalPolicy { /* private fields */ }Expand description
Time-based access control policy.
Implementations§
Source§impl TemporalPolicy
impl TemporalPolicy
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
Get the policy description.
Sourcepub fn with_description(self, description: String) -> Self
pub fn with_description(self, description: String) -> Self
Set the policy description.
Sourcepub fn expires_at(self, expires_at: DateTime<Utc>) -> Self
pub fn expires_at(self, expires_at: DateTime<Utc>) -> Self
Set the expiration time.
Sourcepub fn add_permission(self, permission: TemporalPermission) -> Self
pub fn add_permission(self, permission: TemporalPermission) -> Self
Add a temporal permission to this policy.
Sourcepub fn is_active_at(&self, time: DateTime<Utc>) -> bool
pub fn is_active_at(&self, time: DateTime<Utc>) -> bool
Check if the policy is active at the given time.
Sourcepub fn valid_permissions(&self) -> Vec<&Permission>
pub fn valid_permissions(&self) -> Vec<&Permission>
Get all valid permissions at the current time.
Sourcepub fn valid_permissions_at(&self, time: DateTime<Utc>) -> Vec<&Permission>
pub fn valid_permissions_at(&self, time: DateTime<Utc>) -> Vec<&Permission>
Get all valid permissions at the given time.
Sourcepub fn stats(&self) -> PolicyStats
pub fn stats(&self) -> PolicyStats
Get policy statistics.
Trait Implementations§
Source§impl Clone for TemporalPolicy
impl Clone for TemporalPolicy
Source§fn clone(&self) -> TemporalPolicy
fn clone(&self) -> TemporalPolicy
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 moreAuto Trait Implementations§
impl Freeze for TemporalPolicy
impl !RefUnwindSafe for TemporalPolicy
impl Send for TemporalPolicy
impl Sync for TemporalPolicy
impl Unpin for TemporalPolicy
impl !UnwindSafe for TemporalPolicy
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