add creation date and expiration date to access keys

This commit is contained in:
Alex Auvolat
2025-04-17 11:09:21 +02:00
parent 2f21181ccb
commit c56b7e20c3
10 changed files with 225 additions and 33 deletions
+14 -1
View File
@@ -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