From c5648f1920c7f880ab24597df04b050d6389ee8a Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 4 May 2022 18:11:43 +0200 Subject: [PATCH] config: acl tree: allow path components to be paths too will be used for namespaces Signed-off-by: Thomas Lamprecht --- pbs-config/src/acl.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pbs-config/src/acl.rs b/pbs-config/src/acl.rs index 611fdfd92..25e819266 100644 --- a/pbs-config/src/acl.rs +++ b/pbs-config/src/acl.rs @@ -602,15 +602,17 @@ impl AclTree { for (pos, comp) in path.iter().enumerate() { let last_comp = (pos + 1) == path.len(); - node = match node.children.get(*comp) { - Some(n) => n, - None => return role_map, // path not found - }; + for scomp in comp.split('/') { + node = match node.children.get(scomp) { + Some(n) => n, + None => return role_map, // path not found + }; - let new_map = node.extract_roles(auth_id, last_comp); - if !new_map.is_empty() { - // overwrite previous maptings - role_map = new_map; + let new_map = node.extract_roles(auth_id, last_comp); + if !new_map.is_empty() { + // overwrite previous mappings + role_map = new_map; + } } }