Fix visual console list groups filter - #2011

This commit is contained in:
enriquecd 2018-03-06 17:07:02 +01:00
parent ccad148875
commit 80fb004c96
2 changed files with 14 additions and 12 deletions

View File

@ -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()) {

View File

@ -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']);
}