diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 02cbb7283c..c844ccc4d3 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -290,18 +290,22 @@ if (!defined('METACONSOLE')) { else { $url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination; } + + + + if ($own_info['is_admin'] || $vconsoles_read) { if($ag_group){ - $maps = visual_map_get_user_layouts (0,false,$filters,false); + $maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false); unset($filters['offset']); unset($filters['limit']); - $count_maps = visual_map_get_user_layouts (0,false,$filters,false); + $count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false); $total_maps = count($count_maps); }else{ - $maps = visual_map_get_user_layouts (0,false,$filters, false); + $maps = visual_map_get_user_layouts ($config['id_user'],false,$filters, false); unset($filters['offset']); unset($filters['limit']); - $count_maps = visual_map_get_user_layouts (0,false,$filters,false); + $count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false); $total_maps = count($count_maps); } } @@ -309,7 +313,7 @@ else { $maps = visual_map_get_user_layouts ($config['id_user'], false, $filters, false); unset($filters['offset']); unset($filters['limit']); - $count_maps = visual_map_get_user_layouts (0,false,$filters,false); + $count_maps = visual_map_get_user_layouts ($config['id_user'],false,$filters,false); $total_maps = count($count_maps); } if (!$maps && !is_metaconsole()) { diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index fbb0327986..0a975276f9 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -3602,6 +3602,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, */ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true, $favourite = false) { + if (! is_array ($filter)){ $filter = array (); } else { @@ -3626,10 +3627,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter if ($returnAllGroup) { $groups = users_get_groups ($id_user, 'VR', true, true); } else { - if(users_is_admin($id_user)){ - $groups = users_get_groups ($id_user, 'VR', true, true); - } - else{ + if(!empty($filter['group'])) { $permissions_group = users_get_groups ($id_user, 'VR', false, true); if(empty($permissions_group)){ @@ -3637,12 +3635,12 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter } $groups = array_intersect_key($filter['group'], $permissions_group); } else { - $groups = users_get_groups ($id_user, 'VR', false, true); + $groups = users_get_groups ($id_user, 'VR', true, true); if(empty($groups)) { - $groups = users_get_groups ($id_user, 'VM', false, true); + $groups = users_get_groups ($id_user, 'VM', true, true); } } - } + unset($filter['group']); }