Ensure query auth level checks are logically correct
This commit is contained in:
parent
c57c313c47
commit
7e2eae32c5
2 changed files with 5 additions and 5 deletions
|
@ -26,10 +26,10 @@ impl Auth {
|
||||||
pub fn check(&self, level: Level) -> bool {
|
pub fn check(&self, level: Level) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Auth::No => matches!(level, Level::No),
|
Auth::No => matches!(level, Level::No),
|
||||||
Auth::Kv => matches!(level, Level::No | Level::Kv),
|
Auth::Sc(_, _, _) => matches!(level, Level::No | Level::Sc),
|
||||||
Auth::Ns(_) => matches!(level, Level::No | Level::Kv | Level::Ns),
|
Auth::Db(_, _) => matches!(level, Level::No | Level::Sc | Level::Db),
|
||||||
Auth::Db(_, _) => matches!(level, Level::No | Level::Kv | Level::Ns | Level::Db),
|
Auth::Ns(_) => matches!(level, Level::No | Level::Sc | Level::Db | Level::Ns),
|
||||||
Auth::Sc(_, _, _) => true,
|
Auth::Kv => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ fn process(
|
||||||
) -> Session {
|
) -> Session {
|
||||||
// Create session
|
// Create session
|
||||||
let conf = Session {
|
let conf = Session {
|
||||||
au: Auth::No,
|
au: Auth::default(),
|
||||||
ip: ip.map(|v| v.to_string()),
|
ip: ip.map(|v| v.to_string()),
|
||||||
or,
|
or,
|
||||||
id,
|
id,
|
||||||
|
|
Loading…
Reference in a new issue