diff --git a/src/models/menu.rs b/src/models/menu.rs index cb622ea..2cd23c5 100644 --- a/src/models/menu.rs +++ b/src/models/menu.rs @@ -199,11 +199,11 @@ pub async fn allowed_menu(_language: Option<&String>, _client_id: Option<&String } fn load_valid_children(_tree: Option>, _allowed_menu_items: Vec) -> Vec { - if _tree.is_none() { - return Vec::new() - } - let mut menus: Vec = Vec::new(); - let _tree: Vec = _tree.unwrap(); + if _tree.is_none() { + return Vec::new() + } + let mut menus: Vec = Vec::new(); + let _tree: Vec = _tree.unwrap(); for _tree_value in _tree { let _allowed_item: Option = _allowed_menu_items.to_owned().into_iter().find(|_item: &MenuItem| _item.internal_id.is_some() && _item.internal_id == _tree_value.node_id); if _allowed_item.is_some() { @@ -230,6 +230,15 @@ fn load_valid_children(_tree: Option>, _allowed_menu_items: Vec>, _allowed_menu_items: Vec bool { + if let Some(children) = &menu.children { + for child in children { + if child.action_id.is_some() && child.action_id.unwrap() > 0 { + return true; + } + if has_action_in_childrens(child) { + return true; + } + } + } + false +}