Ensure query auth level checks are logically correct

This commit is contained in:
Tobie Morgan Hitchcock 2022-04-01 00:36:23 +01:00
parent c57c313c47
commit 7e2eae32c5
2 changed files with 5 additions and 5 deletions

View file

@ -26,10 +26,10 @@ impl Auth {
pub fn check(&self, level: Level) -> bool {
match self {
Auth::No => matches!(level, Level::No),
Auth::Kv => matches!(level, Level::No | Level::Kv),
Auth::Ns(_) => matches!(level, Level::No | Level::Kv | Level::Ns),
Auth::Db(_, _) => matches!(level, Level::No | Level::Kv | Level::Ns | Level::Db),
Auth::Sc(_, _, _) => true,
Auth::Sc(_, _, _) => matches!(level, Level::No | Level::Sc),
Auth::Db(_, _) => matches!(level, Level::No | Level::Sc | Level::Db),
Auth::Ns(_) => matches!(level, Level::No | Level::Sc | Level::Db | Level::Ns),
Auth::Kv => true,
}
}
}

View file

@ -32,7 +32,7 @@ fn process(
) -> Session {
// Create session
let conf = Session {
au: Auth::No,
au: Auth::default(),
ip: ip.map(|v| v.to_string()),
or,
id,