More spring cleaning for privs, add test

This commit is contained in:
2024-08-07 23:00:38 +02:00
parent 1bb1c133e8
commit 011bcf9edc
3 changed files with 377 additions and 285 deletions

View File

@@ -172,13 +172,10 @@ pub(crate) fn yn(b: bool) -> &'static str {
}
#[inline]
pub(crate) fn rev_yn(s: &str) -> bool {
pub(crate) fn rev_yn(s: &str) -> Option<bool> {
match s.to_lowercase().as_str() {
"y" => true,
"n" => false,
_ => {
log::warn!("Invalid value for privilege: {}", s);
false
}
"y" => Some(true),
"n" => Some(false),
_ => None,
}
}