From 20aac21c84bf5ae209e5af91ea332614928a138d Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 16 Jan 2017 11:34:55 +0100 Subject: [PATCH] Added pass field to groups in console. Ticket #153 (cherry picked from commit d51225f86ccd0b9adeda84198f05d37004298916) --- .../godmode/groups/configure_group.php | 39 +++++++++++++------ pandora_console/godmode/groups/group_list.php | 9 +++-- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 8e3bca5800..5dc9b539b7 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -34,6 +34,7 @@ enterprise_include_once ('meta/include/functions_agents_meta.php'); $icon = ""; $name = ""; $id_parent = 0; +$group_pass = ""; $alerts_disabled = 0; $custom_id = ""; $propagate = 0; @@ -55,6 +56,7 @@ if ($id_group) { else { $icon = $group["icon"].'.png'; } + $group_pass = io_safe_output($group['password']); $alerts_disabled = $group["disabled"]; $id_parent = $group["parent"]; $custom_id = $group["custom_id"]; @@ -158,23 +160,36 @@ if ($acl_parent) { $table->data[2][1] .= ''; } -$table->data[3][0] = __('Alerts'); -$table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); +$i = 3; +if ($config['enterprise_installed']) { + $i = 4; + $table->data[3][0] = __('Group Password'); + $table->data[3][1] = html_print_input_password ('group_pass', $group_pass, '', 16, 255, true); +} -$table->data[4][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true); -$table->data[4][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true); +$table->data[$i][0] = __('Alerts'); +$table->data[$i][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); +$i++; -$table->data[5][0] = __('Custom ID'); -$table->data[5][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$table->data[$i][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true); +$table->data[$i][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true); +$i++; -$table->data[6][0] = __('Description'); -$table->data[6][1] = html_print_input_text ('description', $description, '', 60, 255, true); +$table->data[$i][0] = __('Custom ID'); +$table->data[$i][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$i++; -$table->data[7][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true); -$table->data[7][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true); +$table->data[$i][0] = __('Description'); +$table->data[$i][1] = html_print_input_text ('description', $description, '', 60, 255, true); +$i++; -$table->data[8][0] = __('Other') . ui_print_help_tip (__("Information accessible through the _group_other_ macro"), true); -$table->data[8][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", true); +$table->data[$i][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true); +$table->data[$i][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true); +$i++; + +$table->data[$i][0] = __('Other') . ui_print_help_tip (__("Information accessible through the _group_other_ macro"), true); +$table->data[$i][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", true); +$i++; $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) { diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 87bff77a0e..023ed6e84c 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -178,6 +178,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) { $name = (string) get_parameter ('name'); $icon = (string) get_parameter ('icon'); $id_parent = (int) get_parameter ('id_parent'); + $group_pass = (string)get_parameter('group_pass'); $alerts_disabled = (bool) get_parameter ('alerts_disabled'); $custom_id = (string) get_parameter ('custom_id'); $skin = (string) get_parameter ('skin'); @@ -200,7 +201,8 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) { 'description' => $description, 'contact' => $contact, 'propagate' => $propagate, - 'other' => $other + 'other' => $other, + 'password' => io_safe_input($group_pass) ); $result = db_process_sql_insert('tgrupo', $values); @@ -228,6 +230,7 @@ if ($update_group) { $icon = (string) get_parameter ('icon'); $id_parent = (int) get_parameter ('id_parent'); $description = (string) get_parameter ('description'); + $group_pass = (string)get_parameter('group_pass'); $alerts_enabled = (bool) get_parameter ('alerts_enabled'); $custom_id = (string) get_parameter ('custom_id'); $propagate = (bool) get_parameter('propagate'); @@ -241,9 +244,9 @@ if ($update_group) { switch ($config["dbtype"]) { case "mysql": $sql = sprintf ('UPDATE tgrupo SET nombre = "%s", - icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s" + icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s" WHERE id_grupo = %d', - $name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $id_group); + $name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $group_pass, $id_group); break; case "postgresql": case "oracle":