add 'exact' parameter to extract_acl_node_data
so that we can return acls for a single path Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
		
				
					committed by
					
						 Dietmar Maurer
						Dietmar Maurer
					
				
			
			
				
	
			
			
			
						parent
						
							2072aeaee6
						
					
				
				
					commit
					11b6391c83
				
			| @ -41,6 +41,7 @@ fn extract_acl_node_data( | |||||||
|     node: &acl::AclTreeNode, |     node: &acl::AclTreeNode, | ||||||
|     path: &str, |     path: &str, | ||||||
|     list: &mut Vec<AclListItem>, |     list: &mut Vec<AclListItem>, | ||||||
|  |     exact: bool, | ||||||
| ) { | ) { | ||||||
|     for (user, roles) in &node.users { |     for (user, roles) in &node.users { | ||||||
|         for (role, propagate) in roles { |         for (role, propagate) in roles { | ||||||
| @ -64,9 +65,12 @@ fn extract_acl_node_data( | |||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |     if exact { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|     for (comp, child) in &node.children { |     for (comp, child) in &node.children { | ||||||
|         let new_path = format!("{}/{}", path, comp); |         let new_path = format!("{}/{}", path, comp); | ||||||
|         extract_acl_node_data(child, &new_path, list); |         extract_acl_node_data(child, &new_path, list, exact); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -93,7 +97,7 @@ pub fn read_acl( | |||||||
|     let (tree, _digest) = acl::config()?; |     let (tree, _digest) = acl::config()?; | ||||||
|  |  | ||||||
|     let mut list: Vec<AclListItem> = Vec::new(); |     let mut list: Vec<AclListItem> = Vec::new(); | ||||||
|     extract_acl_node_data(&tree.root, "", &mut list); |     extract_acl_node_data(&tree.root, "", &mut list, false); | ||||||
|  |  | ||||||
|     Ok(list) |     Ok(list) | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user