From aa71c6bf4abf11aae8093db0315050708ea0c438 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 18:27:07 +0200 Subject: [PATCH 1/2] Include source error message when failing --load Fixes #59 --- bin/bffhd/main.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs index 4507d90..6c4dd02 100644 --- a/bin/bffhd/main.rs +++ b/bin/bffhd/main.rs @@ -122,17 +122,14 @@ fn main() -> anyhow::Result<()> { unimplemented!() } else if matches.is_present("load") { let bffh = Diflouroborane::new(config)?; - if bffh - .users - .load_file(matches.value_of("load").unwrap()) - .is_ok() - { - tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); - } else { + if let Err(error) = bffh.users.load_file(matches.value_of("load").unwrap()) { tracing::error!( - "failed to load users from {}", - matches.value_of("load").unwrap() + "failed to load users from {}: {}", + matches.value_of("load").unwrap(), + error, ); + } else { + tracing::info!("loaded users from {}", matches.value_of("load").unwrap()); } return Ok(()); } else { From 689c2b5353dc5c21730102a70fc9b1a5c310b636 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Fri, 20 May 2022 18:27:54 +0200 Subject: [PATCH 2/2] Add a duplicate user example table --- test/duplicate-users.toml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/duplicate-users.toml diff --git a/test/duplicate-users.toml b/test/duplicate-users.toml new file mode 100644 index 0000000..d08c92d --- /dev/null +++ b/test/duplicate-users.toml @@ -0,0 +1,8 @@ +[UniqueUser] +roles = ["foorole", "barrole"] + +[DuplicateUser] +roles = ["somerole"] + +[DuplicateUser] +roles = ["different", "roles"]