performance improvements in visual console list is called indiscriminately to the function get_acl
This commit is contained in:
parent
57990d80a8
commit
638d7ced30
|
@ -258,15 +258,11 @@ $table->head = array ();
|
||||||
$table->head[0] = __('Map name');
|
$table->head[0] = __('Map name');
|
||||||
$table->head[1] = __('Group');
|
$table->head[1] = __('Group');
|
||||||
$table->head[2] = __('Items');
|
$table->head[2] = __('Items');
|
||||||
|
$table->head[3] = __('Copy');
|
||||||
|
$table->head[4] = __('Delete');
|
||||||
|
$table->size[3] = "6%";
|
||||||
|
$table->size[4] = "6%";
|
||||||
|
|
||||||
// Fix: IW was the old ACL for report editing, now is RW
|
|
||||||
//Only for RW flag
|
|
||||||
if ($vconsoles_write || $vconsoles_manage) {
|
|
||||||
$table->head[3] = __('Copy');
|
|
||||||
$table->head[4] = __('Delete');
|
|
||||||
$table->size[3] = "6%";
|
|
||||||
$table->size[4] = "6%";
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->align = array ();
|
$table->align = array ();
|
||||||
$table->align[0] = 'left';
|
$table->align[0] = 'left';
|
||||||
|
@ -299,25 +295,22 @@ if ($own_info['is_admin'] || $vconsoles_read) {
|
||||||
$maps = visual_map_get_user_layouts (0,false,$filters,false);
|
$maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||||
unset($filters['offset']);
|
unset($filters['offset']);
|
||||||
unset($filters['limit']);
|
unset($filters['limit']);
|
||||||
$total_maps = count(visual_map_get_user_layouts(0,false,$filters,false));
|
$total_maps = count($maps);
|
||||||
}else{
|
}else{
|
||||||
$maps = visual_map_get_user_layouts (0,false,$filters);
|
$maps = visual_map_get_user_layouts (0,false,$filters, false);
|
||||||
unset($filters['offset']);
|
unset($filters['offset']);
|
||||||
unset($filters['limit']);
|
unset($filters['limit']);
|
||||||
$total_maps = count(visual_map_get_user_layouts(0,false,$filters));
|
$total_maps = count($maps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$maps = visual_map_get_user_layouts ($config['id_user'], false,
|
$maps = visual_map_get_user_layouts ($config['id_user'], false, $filters, false);
|
||||||
$filters, false);
|
|
||||||
unset($filters['offset']);
|
unset($filters['offset']);
|
||||||
unset($filters['limit']);
|
unset($filters['limit']);
|
||||||
$total_maps = count(visual_map_get_user_layouts ($config['id_user'], false,
|
$total_maps = count($maps);
|
||||||
$filters, false));
|
|
||||||
}
|
}
|
||||||
if (!$maps && !is_metaconsole()) {
|
if (!$maps && !is_metaconsole()) {
|
||||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
|
$total = count(visual_map_get_user_layouts ($config['id_user'], false, false, false));
|
||||||
false, false));
|
|
||||||
if(!$total){
|
if(!$total){
|
||||||
require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
|
require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
|
||||||
} else {
|
} else {
|
||||||
|
@ -328,8 +321,7 @@ if (!$maps && !is_metaconsole()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (!$maps && is_metaconsole()) {
|
elseif (!$maps && is_metaconsole()) {
|
||||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
|
$total = count(visual_map_get_user_layouts ($config['id_user'], false, false, false));
|
||||||
false, false));
|
|
||||||
if(!$total){
|
if(!$total){
|
||||||
ui_print_info_message(
|
ui_print_info_message(
|
||||||
array(
|
array(
|
||||||
|
@ -345,14 +337,18 @@ elseif (!$maps && is_metaconsole()) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui_pagination ($total_maps, $url, $offset, $pagination);
|
ui_pagination ($total_maps, $url, $offset, $pagination);
|
||||||
|
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
// ACL for the visual console permission
|
// ACL for the visual console permission
|
||||||
$vconsole_write = check_acl ($config['id_user'],
|
$vconsole_write = false;
|
||||||
$map['id_group'], "VW");
|
$vconsole_manage = false;
|
||||||
$vconsole_manage = check_acl ($config['id_user'],
|
if(isset($map['vw'])){
|
||||||
$map['id_group'], "VM");
|
$vconsole_write = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($map['vm'])){
|
||||||
|
$vconsole_manage = true;
|
||||||
|
}
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
|
@ -369,7 +365,6 @@ else {
|
||||||
|
|
||||||
// Fix: IW was the old ACL for report editing, now is RW
|
// Fix: IW was the old ACL for report editing, now is RW
|
||||||
if ($vconsole_write || $vconsole_manage) {
|
if ($vconsole_write || $vconsole_manage) {
|
||||||
|
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
$data[3] = '<a class="copy_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
|
$data[3] = '<a class="copy_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
|
||||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
||||||
|
@ -379,6 +374,11 @@ else {
|
||||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
$data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
$data[3] = '';
|
||||||
|
$data[4] = '';
|
||||||
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
|
|
|
@ -3364,7 +3364,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
||||||
*
|
*
|
||||||
* @return array A list of layouts the user can see.
|
* @return array A list of layouts the user can see.
|
||||||
*/
|
*/
|
||||||
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true, $favourite = false) {
|
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false,
|
||||||
|
$returnAllGroup = true, $favourite = false) {
|
||||||
if (! is_array ($filter)){
|
if (! is_array ($filter)){
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
} else {
|
} else {
|
||||||
|
@ -3386,20 +3387,19 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
||||||
$where .= "is_favourite = 1";
|
$where .= "is_favourite = 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($returnAllGroup) {
|
if ($returnAllGroup) {
|
||||||
$groups = users_get_groups ($id_user, 'VR');
|
$groups = users_get_groups ($id_user, 'VR', true, true);
|
||||||
} else {
|
} else {
|
||||||
if(!empty($filter['group'])) {
|
if(!empty($filter['group'])) {
|
||||||
$permissions_group = users_get_groups ($id_user, 'VR', false);
|
$permissions_group = users_get_groups ($id_user, 'VR', false, true);
|
||||||
if(empty($permissions_group)){
|
if(empty($permissions_group)){
|
||||||
$permissions_group = users_get_groups ($id_user, 'VM', false);
|
$permissions_group = users_get_groups ($id_user, 'VM', false, true);
|
||||||
}
|
}
|
||||||
$groups = array_intersect_key($filter['group'], $permissions_group);
|
$groups = array_intersect_key($filter['group'], $permissions_group);
|
||||||
} else {
|
} else {
|
||||||
$groups = users_get_groups ($id_user, 'VR', false);
|
$groups = users_get_groups ($id_user, 'VR', false, true);
|
||||||
if(empty($groups)) {
|
if(empty($groups)) {
|
||||||
$groups = users_get_groups ($id_user, 'VM', false);
|
$groups = users_get_groups ($id_user, 'VM', false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($filter['group']);
|
unset($filter['group']);
|
||||||
|
@ -3420,9 +3420,9 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
||||||
if ($where == '') {
|
if ($where == '') {
|
||||||
$where = array();
|
$where = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$layouts = db_get_all_rows_filter ('tlayout', $where);
|
$layouts = db_get_all_rows_filter ('tlayout', $where);
|
||||||
|
|
||||||
if ($layouts == false)
|
if ($layouts == false)
|
||||||
return array ();
|
return array ();
|
||||||
|
|
||||||
|
@ -3432,6 +3432,17 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
||||||
$retval[$layout['id']] = $layout['name'];
|
$retval[$layout['id']] = $layout['name'];
|
||||||
else
|
else
|
||||||
$retval[$layout['id']] = $layout;
|
$retval[$layout['id']] = $layout;
|
||||||
|
|
||||||
|
//add_perms
|
||||||
|
if ($groups[$layout['id_group']]['vconsole_view']){
|
||||||
|
$retval[$layout['id']]['vr'] = $groups[$layout['id_group']]['vconsole_view'];
|
||||||
|
}
|
||||||
|
if ($groups[$layout['id_group']]['vconsole_edit']){
|
||||||
|
$retval[$layout['id']]['vw'] = $groups[$layout['id_group']]['vconsole_edit'];
|
||||||
|
}
|
||||||
|
if ($groups[$layout['id_group']]['vconsole_management']){
|
||||||
|
$retval[$layout['id']]['vm'] = $groups[$layout['id_group']]['vconsole_management'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
|
@ -3486,8 +3497,8 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_
|
||||||
if ($data['type'] == 0) {
|
if ($data['type'] == 0) {
|
||||||
$stcount++;
|
$stcount++;
|
||||||
if ($data["id_layout_linked"] == 0 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) {
|
if ($data["id_layout_linked"] == 0 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) {
|
||||||
$stcount_u++;
|
$stcount_u++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($stcount == 0 || $stcount_u == $stcount) {
|
if ($stcount == 0 || $stcount_u == $stcount) {
|
||||||
|
@ -3568,9 +3579,9 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$status = VISUAL_MAP_STATUS_NORMAL;
|
$status = VISUAL_MAP_STATUS_NORMAL;
|
||||||
if (count($elements_in_child) == 0) {
|
if (count($elements_in_child) == 0) {
|
||||||
$status = VISUAL_MAP_STATUS_UNKNOWN;
|
$status = VISUAL_MAP_STATUS_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue