feat: Anfrage-Log mit Tokens, Dauer, Engine und Instanz, Aufbewahrung, Key-Recht metrics (Schema 2, #1050)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -11,12 +11,16 @@ use crate::{Store, db};
|
||||
pub struct Rights {
|
||||
/// Erlaubte Modell-Namen; `*` erlaubt alle.
|
||||
pub models: Vec<String>,
|
||||
/// Darf `GET /gateway/v1/metrics` lesen. Ältere Keys ohne dieses Feld: nein.
|
||||
#[serde(default)]
|
||||
pub metrics: bool,
|
||||
}
|
||||
|
||||
impl Default for Rights {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
models: vec!["*".to_string()],
|
||||
metrics: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,6 +196,7 @@ mod tests {
|
||||
fn rechte_pruefen_modellnamen() {
|
||||
let r = Rights {
|
||||
models: vec!["bonsai".to_string()],
|
||||
metrics: false,
|
||||
};
|
||||
assert!(r.allows("bonsai"));
|
||||
assert!(!r.allows("anderes"));
|
||||
|
||||
Reference in New Issue
Block a user