From 7e2eae32c5599e8b09ed842d4473ba6ad0961063 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 1 Apr 2022 00:36:23 +0100 Subject: [PATCH] Ensure query auth level checks are logically correct --- lib/src/dbs/auth.rs | 8 ++++---- src/net/conf.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/dbs/auth.rs b/lib/src/dbs/auth.rs index 3d3c64d3..a2097c8e 100644 --- a/lib/src/dbs/auth.rs +++ b/lib/src/dbs/auth.rs @@ -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, } } } diff --git a/src/net/conf.rs b/src/net/conf.rs index 8ff54cfc..8426c44f 100644 --- a/src/net/conf.rs +++ b/src/net/conf.rs @@ -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,