diff --git a/pandora_console/extras/mr/47.sql b/pandora_console/extras/mr/47.sql index fa5d161a0c..aa07478947 100644 --- a/pandora_console/extras/mr/47.sql +++ b/pandora_console/extras/mr/47.sql @@ -1,9 +1,14 @@ START TRANSACTION; +ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_user` VARCHAR(60); +ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_pass` VARCHAR(45); +ALTER TABLE `tperfil` DROP COLUMN `incident_view`; +ALTER TABLE `tperfil` DROP COLUMN `incident_edit`; +ALTER TABLE `tperfil` DROP COLUMN `incident_management`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field16` TEXT NOT NULL AFTER `al_field15`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field17` TEXT NOT NULL AFTER `al_field16`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field18` TEXT NOT NULL AFTER `al_field17`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field19` TEXT NOT NULL AFTER `al_field18`; ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field20` TEXT NOT NULL AFTER `al_field19`; -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 3a22bd4f90..6096c8143d 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 @@ -1532,6 +1532,8 @@ ALTER TABLE `tusuario` MODIFY COLUMN `default_event_filter` int(10) unsigned NOT ADD CONSTRAINT `fk_filter_id` FOREIGN KEY `fk_filter_id` (`id_filter`) REFERENCES `tevent_filter` (`id_filter`) ON DELETE SET NULL ON UPDATE RESTRICT, DROP FOREIGN KEY `fk_id_filter`, DROP INDEX `fk_id_filter`; +ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_user` VARCHAR(60); +ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_pass` VARCHAR(45); -- --------------------------------------------------------------------- @@ -4030,3 +4032,6 @@ DELETE FROM `tconfig` WHERE `token` = 'ipam_installed'; DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id'; +ALTER TABLE `tperfil` DROP COLUMN `incident_view`; +ALTER TABLE `tperfil` DROP COLUMN `incident_edit`; +ALTER TABLE `tperfil` DROP COLUMN `incident_management`; \ No newline at end of file diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index 9a5e4168b4..5a45058c58 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.php @@ -88,7 +88,6 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'LM') || check_acl($config['id_user'], 0, 'UM') || check_acl($config['id_user'], 0, 'LW') - || check_acl($config['id_user'], 0, 'IW') || check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'DW') ) { diff --git a/pandora_console/godmode/agentes/agent_incidents.php b/pandora_console/godmode/agentes/agent_incidents.php index 16cdd9370c..3917c2f81a 100644 --- a/pandora_console/godmode/agentes/agent_incidents.php +++ b/pandora_console/godmode/agentes/agent_incidents.php @@ -39,7 +39,7 @@ $offset = (int) get_parameter('offset', 0); // See if id_agente is set (either POST or GET, otherwise -1 $id_agent = (int) get_parameter('id_agente'); -$groups = users_get_groups($config['id_user'], 'IR'); +$groups = users_get_groups($config['id_user'], 'AR'); $filter = ' AND id_agent = '.$id_agent; $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent; @@ -55,7 +55,7 @@ $params = [ agents_get_name($id_agent), ]; -$result = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents', $params, false, 'json', ','); +$result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ','); $result = json_decode($result, true); diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 459b12d1ac..e6e7dcfbad 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -43,7 +43,7 @@ if (is_ajax()) { if ($get_integria_ticket_custom_types) { $ticket_type_id = get_parameter('ticket_type_id'); - $api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_fields', $ticket_type_id, false, 'json'); + $api_call = integria_api_call(null, null, null, null, 'get_incident_fields', $ticket_type_id, false, 'json'); echo $api_call; return; diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php index 5b68afaf37..4c921525e6 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -15,7 +15,7 @@ global $config; check_login(); -$gis_w = check_acl($config['id_user'], 0, 'MW'); +$gis_w = check_acl($config['id_user'], 0, 'MW', false, true, true); $gis_m = check_acl($config['id_user'], 0, 'MM'); $access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW'); @@ -490,7 +490,7 @@ if (users_can_manage_group_all('MM') === true) { $table->data[2][0] = __('Group'); $table->data[2][1] = html_print_select_groups( false, - 'IW', + 'AR', $return_all_group, 'map_group_id', $map_group_id, diff --git a/pandora_console/godmode/netflow/nf_item_list.php b/pandora_console/godmode/netflow/nf_item_list.php index 558cbb339c..d7a267aed6 100644 --- a/pandora_console/godmode/netflow/nf_item_list.php +++ b/pandora_console/godmode/netflow/nf_item_list.php @@ -20,15 +20,6 @@ require_once $config['homedir'].'/include/functions_html.php'; check_login(); -if (! check_acl($config['id_user'], 0, 'IW')) { - db_pandora_audit( - 'ACL Violation', - 'Trying to access event viewer' - ); - include 'general/noaccess.php'; - return; -} - // id report $id = (int) get_parameter('id'); diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_integria.php index 58a3d054ae..d97921ff43 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_integria.php @@ -41,8 +41,10 @@ if (is_ajax()) { $integria_pass = get_parameter('integria_pass', ''); $integria_api_hostname = get_parameter('api_hostname', ''); $integria_api_pass = get_parameter('api_pass', ''); + $user_level_conf = get_parameter('user_level_conf', 0); + $user_level_conf_bool = $user_level_conf === 'true' ? true : false; - $login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', []); + $login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', [], false, '', '', $user_level_conf_bool); if ($login_result != false) { echo json_encode(['login' => 1]); @@ -53,7 +55,7 @@ if (is_ajax()) { return; } -$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []); +$has_connection = integria_api_call(null, null, null, null, 'get_login', []); if ($has_connection === false && $config['integria_enabled']) { ui_print_error_message(__('Integria IMS API is not reachable')); @@ -86,7 +88,7 @@ if (get_parameter('update_config', 0) == 1) { ); } - $ticket_types = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', '', false, 'json'); + $ticket_types = integria_api_call(null, null, null, null, 'get_types', '', false, 'json'); $types_string = ''; @@ -216,19 +218,19 @@ $integria_users_values = []; $integria_types_values = []; $integria_status_values = []; -$integria_groups_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', []); +$integria_groups_csv = integria_api_call(null, null, null, null, 'get_groups', []); get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values); -$integria_status_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', []); +$integria_status_csv = integria_api_call(null, null, null, null, 'get_incidents_status', []); get_array_from_csv_data_pair($integria_status_csv, $integria_status_values); -$integria_criticity_levels_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', []); +$integria_criticity_levels_csv = integria_api_call(null, null, null, null, 'get_incident_priorities', []); get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values); -$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []); +$integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []); $csv_array = explode("\n", $integria_users_csv); @@ -238,7 +240,7 @@ foreach ($csv_array as $csv_line) { } } -$integria_types_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', []); +$integria_types_csv = integria_api_call(null, null, null, null, 'get_types', []); get_array_from_csv_data_pair($integria_types_csv, $integria_types_values); @@ -267,6 +269,12 @@ $table_remote->class = 'databox filters'; $table_remote->size['name'] = '30%'; $table_remote->style['name'] = 'font-weight: bold'; +// Enable eHorus user configuration. +$row = []; +$row['name'] = ('Integria configuration at user level'); +$row['control'] = html_print_checkbox_switch('integria_user_level_conf', 1, $config['integria_user_level_conf'], true); +$table_remote->data['integria_user_level_conf'] = $row; + // Integria user. $row = []; $row['name'] = __('User'); @@ -629,6 +637,29 @@ echo ''; + \ No newline at end of file diff --git a/pandora_console/operation/incidents/incident_statistics.php b/pandora_console/operation/incidents/incident_statistics.php index af1867264f..b4966c1b96 100755 --- a/pandora_console/operation/incidents/incident_statistics.php +++ b/pandora_console/operation/incidents/incident_statistics.php @@ -18,12 +18,6 @@ require_once $config['homedir'].'/include/functions_graph.php'; check_login(); -if (! check_acl($config['id_user'], 0, 'IR') && ! check_acl($config['id_user'], 0, 'IW') && ! check_acl($config['id_user'], 0, 'IM')) { - db_pandora_audit('ACL Violation', 'Trying to access Incident section'); - include 'general/noaccess.php'; - exit; -} - ui_print_page_header(__('Incidents').' » '.__('Statistics'), 'images/book_edit.png', false, '', false, ''); if (!$config['integria_enabled']) { diff --git a/pandora_console/operation/incidents/integriaims_export_csv.php b/pandora_console/operation/incidents/integriaims_export_csv.php index d4be4443d6..04e0970ab4 100644 --- a/pandora_console/operation/incidents/integriaims_export_csv.php +++ b/pandora_console/operation/incidents/integriaims_export_csv.php @@ -20,14 +20,6 @@ require_once '../../include/functions_integriaims.php'; check_login(); -if (! check_acl($config['id_user'], 0, 'IR') && ! check_acl($config['id_user'], 0, 'IW') && ! check_acl($config['id_user'], 0, 'IM')) { - // Doesn't have access to this page. - db_pandora_audit('ACL Violation', 'Trying to access IntegriaIMS ticket creation'); - include 'general/noaccess.php'; - exit; -} - - // API calls. $status_incident = integriaims_get_details('status'); $group_incident = integriaims_get_details('group'); diff --git a/pandora_console/operation/incidents/list_integriaims_incidents.php b/pandora_console/operation/incidents/list_integriaims_incidents.php index a352300cd2..eadf892b04 100644 --- a/pandora_console/operation/incidents/list_integriaims_incidents.php +++ b/pandora_console/operation/incidents/list_integriaims_incidents.php @@ -18,13 +18,6 @@ require_once 'include/functions_integriaims.php'; check_login(); -if (! check_acl($config['id_user'], 0, 'IR')) { - // Doesn't have access to this page. - db_pandora_audit('ACL Violation', 'Trying to access IntegriaIMS ticket creation'); - include 'general/noaccess.php'; - exit; -} - // Header tabs. $onheader = integriaims_tabs('list_tab'); ui_print_page_header( @@ -43,7 +36,7 @@ if ($config['integria_enabled'] == 0) { } // Check connection to Integria IMS API. -$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []); +$has_connection = integria_api_call(null, null, null, null, 'get_login', []); if ($has_connection === false) { ui_print_error_message(__('Integria IMS API is not reachable')); @@ -70,10 +63,10 @@ $delete_incident = get_parameter('delete_incident'); if ($delete_incident) { // Call Integria IMS API method to delete an incident. $result_api_call_delete = integria_api_call( - $config['integria_hostname'], - $config['integria_user'], - $config['integria_pass'], - $config['integria_api_pass'], + null, + null, + null, + null, 'delete_incident', [$delete_incident] ); @@ -266,9 +259,7 @@ $table->head[4] = __('Prior'); $table->head[5] = __('Updated/Started'); $table->head[6] = __('Creator'); $table->head[7] = __('Owner'); -if (check_acl($config['id_user'], 0, 'IW') || check_acl($config['id_user'], 0, 'IM')) { - $table->head[8] = ''; -} +$table->head[8] = ''; $table->data = []; $i = 0; @@ -294,18 +285,14 @@ foreach ($incidents_paginated as $key => $value) { $table->data[$i][7] = $array_get_incidents[$key][5]; $table->data[$i][8] = ''; $table->cellclass[$i][8] = 'action_buttons'; - if (check_acl($config['id_user'], 0, 'IW')) { - $table->data[$i][8] .= ''; - $table->data[$i][8] .= html_print_image('images/config.png', true, ['title' => __('Edit')]); - $table->data[$i][8] .= ''; - } + $table->data[$i][8] .= ''; + $table->data[$i][8] .= html_print_image('images/config.png', true, ['title' => __('Edit')]); + $table->data[$i][8] .= ''; - if (check_acl($config['id_user'], 0, 'IM')) { - $table->data[$i][8] .= ''; - $table->data[$i][8] .= html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']); - $table->data[$i][8] .= ''; - } + $table->data[$i][8] .= ''; + $table->data[$i][8] .= html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']); + $table->data[$i][8] .= ''; $i++; } @@ -320,13 +307,11 @@ if (empty($table->data) === true) { } // Show button to create incident. -if (check_acl($config['id_user'], 0, 'IR')) { - echo '
'; -} +echo ''; // Datapicker library for show calendar. ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 9013cd7c32..1d8178f1af 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -270,9 +270,9 @@ if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, ' $own_info = get_user_info($config['id_user']); if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { - $own_groups = array_keys(users_get_groups($config['id_user'], 'IR')); + $own_groups = array_keys(users_get_groups($config['id_user'], 'MR')); } else { - $own_groups = array_keys(users_get_groups($config['id_user'], 'IR', false)); + $own_groups = array_keys(users_get_groups($config['id_user'], 'MR', false)); } foreach ($gisMaps as $gisMap) { @@ -281,10 +281,6 @@ if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, ' continue; } - if (! check_acl($config['id_user'], $gisMap['group_id'], 'IR')) { - continue; - } - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['text'] = mb_substr(io_safe_output($gisMap['map_name']), 0, 15); $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['id'] = mb_substr(io_safe_output($gisMap['map_name']), 0, 15); $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['title'] = io_safe_output($gisMap['map_name']); @@ -462,30 +458,25 @@ $sub['operation/users/user_edit_notifications']['refr'] = 0; // Incidents. -if (check_acl($config['id_user'], 0, 'IR') - || check_acl($config['id_user'], 0, 'IW') - || check_acl($config['id_user'], 0, 'IM') -) { - $temp_sec2 = $sec2; - $sec2 = 'incident'; - $sec2sub = 'operation/incidents/incident_statistics'; - $sub[$sec2]['text'] = __('Incidents'); - $sub[$sec2]['id'] = 'Incidents'; - $sub[$sec2]['type'] = 'direct'; - $sub[$sec2]['subtype'] = 'nolink'; - $sub[$sec2]['refr'] = 0; - $sub[$sec2]['subsecs'] = [ - 'operation/incidents/incident_detail', - 'operation/integria_incidents', - ]; +$temp_sec2 = $sec2; +$sec2 = 'incident'; +$sec2sub = 'operation/incidents/incident_statistics'; +$sub[$sec2]['text'] = __('Incidents'); +$sub[$sec2]['id'] = 'Incidents'; +$sub[$sec2]['type'] = 'direct'; +$sub[$sec2]['subtype'] = 'nolink'; +$sub[$sec2]['refr'] = 0; +$sub[$sec2]['subsecs'] = [ + 'operation/incidents/incident_detail', + 'operation/integria_incidents', +]; - $sub2 = []; - $sub2[$sec2sub]['text'] = __('Integria IMS statistics'); - $sub2['operation/incidents/list_integriaims_incidents']['text'] = __('Integria IMS ticket list'); +$sub2 = []; +$sub2[$sec2sub]['text'] = __('Integria IMS statistics'); +$sub2['operation/incidents/list_integriaims_incidents']['text'] = __('Integria IMS ticket list'); - $sub[$sec2]['sub2'] = $sub2; - $sec2 = $temp_sec2; -} +$sub[$sec2]['sub2'] = $sub2; +$sec2 = $temp_sec2; // Messages. diff --git a/pandora_console/operation/netflow/nf_live_view.php b/pandora_console/operation/netflow/nf_live_view.php index dae0c9457a..a27686f8a7 100644 --- a/pandora_console/operation/netflow/nf_live_view.php +++ b/pandora_console/operation/netflow/nf_live_view.php @@ -370,7 +370,7 @@ if (is_metaconsole()) { ).''; $own_info = get_user_info($config['id_user']); echo '