From 4ab7b1a135c66ad11f8b0b297ac506cffd1b7568 Mon Sep 17 00:00:00 2001 From: Luis Date: Wed, 7 Apr 2021 08:11:35 +0000 Subject: [PATCH 1/2] Ent 6952 bug group creation user admin no all --- pandora_console/godmode/groups/configure_group.php | 12 +++++++----- pandora_console/godmode/groups/group_list.php | 14 +++++++------- .../godmode/wizards/DiscoveryTaskList.class.php | 2 +- .../include/class/TreeGroupEdition.class.php | 9 +++++++++ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 7b9b43ed41..08e2c2e9f3 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -149,12 +149,12 @@ if ($id_group) { $table->data[2][1] .= html_print_select_groups( false, 'AR', - true, + false, 'id_parent', $id_parent, '', - '', - '', + __('None'), + -1, true, false, true, @@ -174,7 +174,9 @@ if ($id_group) { 'name' => 'id_parent', 'selected' => $id_parent, 'return' => true, - 'returnAllGroup' => true, + 'returnAllGroup' => false, + 'nothing' => __('None'), + 'nothing_value' => -1, ] ); $table->data[2][1] .= ''; @@ -182,7 +184,7 @@ if ($id_group) { if ($acl_parent) { $table->data[2][1] .= ' '; - $table->data[2][1] .= html_print_image('images/groups_small/'.groups_get_icon($id_parent).'.png', true); + $table->data[2][1] .= html_print_image('images/groups_small/'.( $id_parent != 0 ? groups_get_icon($id_parent) : 'without_group').'.png', true); $table->data[2][1] .= ''; } diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 137796cd6e..74ea0af8fe 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -59,11 +59,11 @@ if (is_ajax() === true) { if ($get_group_json === true) { $id_group = (int) get_parameter('id_group'); - if ($id_group === 0) { + if ($id_group === 0 || $id_group === -1) { $group = [ 'id_grupo' => 0, - 'nombre' => 'All', - 'icon' => 'world', + 'nombre' => 'None', + 'icon' => '', 'parent' => 0, 'disabled' => 0, 'custom_id' => null, @@ -472,7 +472,7 @@ if ($update_group) { $values = [ 'nombre' => $name, 'icon' => empty($icon) ? '' : substr($icon, 0, -4), - 'parent' => $id_parent, + 'parent' => $id_parent == -1 ? 0 : $id_parent, 'disabled' => !$alerts_enabled, 'custom_id' => $custom_id, 'id_skin' => $skin, @@ -719,7 +719,7 @@ if ($tab == 'tree') { if (users_can_manage_group_all('AR') === false) { $user_groups_acl = users_get_groups(false, 'AR'); - $groups_acl = implode(',', $user_groups_ACL); + $groups_acl = implode('","', $user_groups_acl); if (empty($groups_acl) === true) { return ui_print_info_message( [ @@ -729,7 +729,7 @@ if ($tab == 'tree') { ); } - $acl = 'AND t.id_grupo IN ('.$groups_acl.')'; + $acl = 'AND t.nombre IN ("'.$groups_acl.'")'; } $form = "
"; @@ -908,7 +908,7 @@ if ($tab == 'tree') { } } -if (check_acl($config['id_user'], 0, 'PM') === true) { +if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { echo ''; echo '
'; html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"'); diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index f94c3f0e8a..384abd4db4 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -1494,7 +1494,7 @@ class DiscoveryTaskList extends HTML if (is_array($data['modules'])) { // Alphabetically sort. - ksort($data['modules'], SORT_STRING | SORT_FLAG_CASE); + ksort($data['modules'], (SORT_STRING | SORT_FLAG_CASE)); $simple_data = array_merge( $simple_data, diff --git a/pandora_console/include/class/TreeGroupEdition.class.php b/pandora_console/include/class/TreeGroupEdition.class.php index 9aa6effb5b..490a682865 100644 --- a/pandora_console/include/class/TreeGroupEdition.class.php +++ b/pandora_console/include/class/TreeGroupEdition.class.php @@ -139,6 +139,15 @@ class TreeGroupEdition extends TreeGroup } ); + // Filter groups that user has permission. + $groups = array_filter( + $groups, + function ($group) { + global $config; + return check_acl($config['id_user'], $group['id'], 'AR'); + } + ); + usort($groups, ['Tree', 'cmpSortNames']); return $groups; } From 4920dc96217dfd5a54161914863835870bfbda4a Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 7 Apr 2021 10:17:32 +0200 Subject: [PATCH 2/2] Revert "Merge branch 'ent-7040-forzar-URL-publica-meta' into 'develop'" This reverts merge request !3860 --- pandora_console/include/functions_ui.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index b35d7d74a2..e90b88a146 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4272,16 +4272,16 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me } } else { if ($proxy) { - if (is_metaconsole() && $metaconsole_root) { - $fullurl .= ENTERPRISE_DIR.'/meta'; - } - $fullurl .= '/'; } else { if ($add_name_php_file) { $fullurl .= $_SERVER['SCRIPT_NAME']; } else { $fullurl .= $config['homeurl_static'].'/'; + + if (is_metaconsole() && $metaconsole_root) { + $fullurl .= 'enterprise/meta/'; + } } } }