diff --git a/pandora_console/extras/mr/35.sql b/pandora_console/extras/mr/35.sql index 86236df36f..3a002f44f8 100644 --- a/pandora_console/extras/mr/35.sql +++ b/pandora_console/extras/mr/35.sql @@ -1,5 +1,6 @@ START TRANSACTION; +ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0; ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL; -COMMIT; \ No newline at end of file +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 0c95628752..bbc07ad08c 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` ( `generation_method` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0, `filter` TEXT, + `id_group_map` INT(10) UNSIGNED NOT NULL default 0, + PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index dda25538ee..56172331c6 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1453,6 +1453,20 @@ function networkmap_delete_nodes($id_map) } +/** + * Delete relations given id_map + * + * @param integer $id_map + * @return integer result + */ +function networkmap_delete_relations($id_map) +{ + $result = db_process_sql_delete('trel_item', ['id_map' => $id_map]); + + return $result; +} + + function get_networkmaps($id) { $groups = array_keys(users_get_groups(null, 'IW')); diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 7f698d8653..d719df08cd 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -81,8 +81,8 @@ if ($edit_networkmap) { $id_group = $values['id_group']; // ACL for the network map. - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -95,6 +95,9 @@ if ($edit_networkmap) { $name = io_safe_output($values['name']); + // Id group of the map itself, not data source. + $id_group_map = $values['id_group_map']; + $description = $values['description']; $filter = json_decode($values['filter'], true); @@ -267,8 +270,8 @@ if ($not_found) { $config['id_user'], 'AR', true, - 'id_group', - $id_group, + 'id_group_map', + $id_group_map, '', '', '', @@ -329,6 +332,28 @@ if ($not_found) { $table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask'); $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); + $table->data['source_data_group'][0] = __('Source group'); + $table->data['source_data_group'][1] = html_print_select_groups( + $config['id_user'], + 'AR', + true, + 'id_group', + $id_group, + '', + '', + '', + true + ); + $table->data['source_data_group'][1] .= html_print_image( + 'images/error.png', + true, + [ + 'id' => 'group_change_warning', + 'title' => __('Source id group changed. All elements in networkmap will be lost.'), + 'style' => 'display : none', + ] + ); + $table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:'); $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox( 'dont_show_subgroups', @@ -379,7 +404,7 @@ if ($not_found) { $table->data['kval'][0] = __('Default ideal node separation'); $table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true); - echo '