Added pass field to groups in console. Ticket #153

This commit is contained in:
Arturo Gonzalez 2017-01-16 11:34:55 +01:00
parent 31d37e0905
commit d51225f86c
2 changed files with 33 additions and 15 deletions

View File

@ -34,6 +34,7 @@ enterprise_include_once ('meta/include/functions_agents_meta.php');
$icon = ""; $icon = "";
$name = ""; $name = "";
$id_parent = 0; $id_parent = 0;
$group_pass = "";
$alerts_disabled = 0; $alerts_disabled = 0;
$custom_id = ""; $custom_id = "";
$propagate = 0; $propagate = 0;
@ -55,6 +56,7 @@ if ($id_group) {
else { else {
$icon = $group["icon"].'.png'; $icon = $group["icon"].'.png';
} }
$group_pass = io_safe_output($group['password']);
$alerts_disabled = $group["disabled"]; $alerts_disabled = $group["disabled"];
$id_parent = $group["parent"]; $id_parent = $group["parent"];
$custom_id = $group["custom_id"]; $custom_id = $group["custom_id"];
@ -158,23 +160,36 @@ if ($acl_parent) {
$table->data[2][1] .= '</span>'; $table->data[2][1] .= '</span>';
} }
$table->data[3][0] = __('Alerts'); $i = 3;
$table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); 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[$i][0] = __('Alerts');
$table->data[4][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true); $table->data[$i][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true);
$i++;
$table->data[5][0] = __('Custom ID'); $table->data[$i][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true);
$table->data[5][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, 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[$i][0] = __('Custom ID');
$table->data[6][1] = html_print_input_text ('description', $description, '', 60, 255, true); $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[$i][0] = __('Description');
$table->data[7][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true); $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[$i][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true);
$table->data[8][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", 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'); $isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) {

View File

@ -178,6 +178,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
$name = (string) get_parameter ('name'); $name = (string) get_parameter ('name');
$icon = (string) get_parameter ('icon'); $icon = (string) get_parameter ('icon');
$id_parent = (int) get_parameter ('id_parent'); $id_parent = (int) get_parameter ('id_parent');
$group_pass = (string)get_parameter('group_pass');
$alerts_disabled = (bool) get_parameter ('alerts_disabled'); $alerts_disabled = (bool) get_parameter ('alerts_disabled');
$custom_id = (string) get_parameter ('custom_id'); $custom_id = (string) get_parameter ('custom_id');
$skin = (string) get_parameter ('skin'); $skin = (string) get_parameter ('skin');
@ -200,7 +201,8 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
'description' => $description, 'description' => $description,
'contact' => $contact, 'contact' => $contact,
'propagate' => $propagate, 'propagate' => $propagate,
'other' => $other 'other' => $other,
'password' => io_safe_input($group_pass)
); );
$result = db_process_sql_insert('tgrupo', $values); $result = db_process_sql_insert('tgrupo', $values);
@ -228,6 +230,7 @@ if ($update_group) {
$icon = (string) get_parameter ('icon'); $icon = (string) get_parameter ('icon');
$id_parent = (int) get_parameter ('id_parent'); $id_parent = (int) get_parameter ('id_parent');
$description = (string) get_parameter ('description'); $description = (string) get_parameter ('description');
$group_pass = (string)get_parameter('group_pass');
$alerts_enabled = (bool) get_parameter ('alerts_enabled'); $alerts_enabled = (bool) get_parameter ('alerts_enabled');
$custom_id = (string) get_parameter ('custom_id'); $custom_id = (string) get_parameter ('custom_id');
$propagate = (bool) get_parameter('propagate'); $propagate = (bool) get_parameter('propagate');
@ -241,9 +244,9 @@ if ($update_group) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = sprintf ('UPDATE tgrupo SET nombre = "%s", $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', 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; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":