List all keys for an auth user.
(&self, auth_user_id: &str)
| 276 | |
| 277 | /// List all keys for an auth user. |
| 278 | pub fn list_for_user(&self, auth_user_id: &str) -> Vec<AuthApiKey> { |
| 279 | let now = now_secs(); |
| 280 | let keys = self.keys.read().unwrap_or_else(|p| p.into_inner()); |
| 281 | keys.values() |
| 282 | .filter(|k| k.auth_user_id == auth_user_id && k.is_valid(now)) |
| 283 | .cloned() |
| 284 | .collect() |
| 285 | } |
| 286 | |
| 287 | /// List all keys (admin view). |
| 288 | pub fn list_all(&self) -> Vec<AuthApiKey> { |