tool_groups: match names case-insensitively, like capabilities::is_known
This commit is contained in:
parent
1d120289d1
commit
67fd164dfc
1 changed files with 5 additions and 3 deletions
|
|
@ -50,12 +50,14 @@ fn read_from(path: &Path) -> std::io::Result<BTreeMap<String, Vec<String>>> {
|
|||
Ok(map)
|
||||
}
|
||||
|
||||
/// True if `name` matches a recognised [`hive_sh4re::permissions::ToolGroup`]
|
||||
/// exactly (same comparison [`validate_groups`] uses).
|
||||
/// True if `name` matches a recognised [`hive_sh4re::permissions::ToolGroup`],
|
||||
/// case-insensitive (same comparison [`validate_groups`] uses, and the same
|
||||
/// comparison `capabilities::is_known` uses — a hand-edited `"Meta"` in the
|
||||
/// file should round-trip, not get pruned).
|
||||
fn is_known(name: &str) -> bool {
|
||||
hive_sh4re::permissions::ToolGroup::ALL
|
||||
.iter()
|
||||
.any(|g| <&str>::from(*g) == name)
|
||||
.any(|g| name.eq_ignore_ascii_case(<&str>::from(*g)))
|
||||
}
|
||||
|
||||
/// Drop any tool-group string in `map` that isn't a recognised
|
||||
|
|
|
|||
Loading…
Reference in a new issue