mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-21 18:36:35 +00:00
add creation date and expiration date to access keys
This commit is contained in:
@@ -113,7 +113,7 @@ impl AdminApiToken {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this represents a deleted bucket
|
||||
/// Returns true if this represents a deleted admin token
|
||||
pub fn is_deleted(&self) -> bool {
|
||||
self.state.is_deleted()
|
||||
}
|
||||
@@ -137,6 +137,19 @@ impl AdminApiToken {
|
||||
}
|
||||
}
|
||||
|
||||
impl AdminApiTokenParams {
|
||||
pub fn is_expired(&self, ts_now: u64) -> bool {
|
||||
match *self.expiration.get() {
|
||||
None => false,
|
||||
Some(exp) => ts_now >= exp,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_scope(&self, endpoint: &str) -> bool {
|
||||
self.scope.get().0.iter().any(|x| x == "*" || x == endpoint)
|
||||
}
|
||||
}
|
||||
|
||||
impl Entry<EmptyKey, String> for AdminApiToken {
|
||||
fn partition_key(&self) -> &EmptyKey {
|
||||
&EmptyKey
|
||||
|
||||
Reference in New Issue
Block a user