Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop
This commit is contained in:
commit
75d9d58c48
|
@ -314,6 +314,8 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
||||
include_graphs_dependencies();
|
||||
|
||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||
|
||||
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -546,31 +548,40 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||
|
||||
foreach ($network_interfaces as $interface_name => $interface) {
|
||||
if (!empty($interface['traffic'])) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out']
|
||||
);
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
$permission = false;
|
||||
|
||||
$graph_url = '';
|
||||
if (!defined('METACONSOLE')) {
|
||||
$graph_url = $config['homeurl'] .
|
||||
"operation/agentes/interface_traffic_graph_win.php?" .
|
||||
"params=$params_encoded";
|
||||
if ($strict_user) {
|
||||
if (tags_check_acl_by_module($interface['traffic']['in'], $config['id_user'], 'RR') === true
|
||||
&& tags_check_acl_by_module($interface['traffic']['out'], $config['id_user'], 'RR') === true)
|
||||
$permission = true;
|
||||
}
|
||||
else if (!empty($server_data)) {
|
||||
$graph_url = ui_meta_get_url_console_child(
|
||||
$server_data, null, null, null, null,
|
||||
"operation/agentes/interface_traffic_graph_win.php?" .
|
||||
"params=$params_encoded");
|
||||
else {
|
||||
$permission = check_acl($config['id_user'], $agent["id_grupo"], "RR");
|
||||
}
|
||||
|
||||
$graph_link = "<a href=\"javascript:winopeng('$graph_url','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
if ($permission) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out']
|
||||
);
|
||||
|
||||
if (defined('METACONSOLE') && !empty($server_id))
|
||||
$params["server"] = $server_id;
|
||||
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$url = ui_get_full_url("operation/agentes/interface_traffic_graph_win.php", false, false, false);
|
||||
$graph_url = "$url?params=$params_encoded";
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
|
||||
$graph_link = "<a href=\"javascript:winopeng('$graph_url','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
|
|
|
@ -29,6 +29,7 @@ include_once($config['homedir'] . "/include/functions_clippy.php");
|
|||
|
||||
check_login ();
|
||||
|
||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
$id_agente = get_parameter_get ("id_agente", -1);
|
||||
|
||||
|
@ -415,17 +416,33 @@ if (!empty($network_interfaces)) {
|
|||
|
||||
foreach ($network_interfaces as $interface_name => $interface) {
|
||||
if (!empty($interface['traffic'])) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out']
|
||||
);
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
$graph_link = "<a href=\"javascript:winopeng('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
$permission = false;
|
||||
|
||||
if ($strict_user) {
|
||||
if (tags_check_acl_by_module($interface['traffic']['in'], $config['id_user'], 'RR') === true
|
||||
&& tags_check_acl_by_module($interface['traffic']['out'], $config['id_user'], 'RR') === true)
|
||||
$permission = true;
|
||||
}
|
||||
else {
|
||||
$permission = check_acl($config['id_user'], $agent["id_grupo"], "RR");
|
||||
}
|
||||
|
||||
if ($permission) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out']
|
||||
);
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
$graph_link = "<a href=\"javascript:winopeng('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
|
|
|
@ -21,31 +21,37 @@ if (! isset($_SESSION['id_usuario'])) {
|
|||
|
||||
// Global & session management
|
||||
require_once ('../../include/config.php');
|
||||
require_once ('../../include/auth/mysql.php');
|
||||
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
||||
require_once ($config['homedir'] . '/include/functions.php');
|
||||
require_once ($config['homedir'] . '/include/functions_db.php');
|
||||
require_once ($config['homedir'] . '/include/functions_reporting.php');
|
||||
require_once ($config['homedir'] . '/include/functions_graph.php');
|
||||
require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
|
||||
require_once ($config['homedir'] . '/include/functions_modules.php');
|
||||
|
||||
// Hash login process
|
||||
if (! isset ($config['id_user']) && get_parameter("loginhash", 0)) {
|
||||
$loginhash_data = get_parameter("loginhash_data", "");
|
||||
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
|
||||
|
||||
if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) {
|
||||
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $loginhash_user;
|
||||
$config["id_user"] = $loginhash_user;
|
||||
|
||||
$hash_connection_data = true;
|
||||
}
|
||||
|
||||
}
|
||||
require_once ($config['homedir'] . '/include/functions_agents.php');
|
||||
require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||
|
||||
check_login();
|
||||
|
||||
$params_json = base64_decode((string) get_parameter('params'));
|
||||
$params = json_decode($params_json, true);
|
||||
|
||||
// Metaconsole connection to the node
|
||||
$server_id = (int) (isset($params['server']) ? $params['server'] : 0);
|
||||
if ($config["metaconsole"] && !empty($server_id)) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
|
||||
// Error connecting
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
echo "<html>";
|
||||
echo "<body>";
|
||||
ui_print_error_message(__('There was a problem connecting with the node'));
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo'));
|
||||
|
@ -54,9 +60,6 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
|
|||
|
||||
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
|
||||
|
||||
$params_json = base64_decode((string) get_parameter('params'));
|
||||
$params = json_decode($params_json, true);
|
||||
|
||||
$interface_name = (string) $params['interface_name'];
|
||||
$agent_id = (int) $params['agent_id'];
|
||||
$interface_traffic_modules = array(
|
||||
|
@ -106,6 +109,34 @@ $interface_traffic_modules = array(
|
|||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
|
||||
// ACL
|
||||
$permission = false;
|
||||
$agent_group = (int) agents_get_agent_group($agent_id);
|
||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
// The traffic modules should belong to the agent id
|
||||
$in_agent_id = (int) db_get_value("id_agente", "tagente_modulo", "id_agente_modulo", $params['traffic_module_in']);
|
||||
$out_agent_id = (int) db_get_value("id_agente", "tagente_modulo", "id_agente_modulo", $params['traffic_module_out']);
|
||||
$traffic_modules_belong_to_agent = $agent_id == $in_agent_id && $agent_id == $out_agent_id;
|
||||
|
||||
if (!empty($agent_group) && !empty($params['traffic_module_in'])
|
||||
&& !empty($params['traffic_module_out']) && $traffic_modules_belong_to_agent) {
|
||||
|
||||
if ($strict_user) {
|
||||
if (tags_check_acl_by_module($params['traffic_module_in'], $config['id_user'], 'RR') === true
|
||||
&& tags_check_acl_by_module($params['traffic_module_out'], $config['id_user'], 'RR') === true)
|
||||
$permission = true;
|
||||
}
|
||||
else {
|
||||
$permission = check_acl($config['id_user'], $agent_group, "RR");
|
||||
}
|
||||
}
|
||||
|
||||
if (!$permission) {
|
||||
require ($config['homedir'] . "/general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get input parameters
|
||||
$period = (int) get_parameter('period', SECONDS_1HOUR);
|
||||
$width = (int) get_parameter("width", 555);
|
||||
|
@ -165,16 +196,6 @@ $interface_traffic_modules = array(
|
|||
$side_layer_params['body_text'] .= '<form method="get" action="interface_traffic_graph_win.php">';
|
||||
$side_layer_params['body_text'] .= html_print_input_hidden("params", base64_encode($params_json), true);
|
||||
|
||||
if (isset($hash_connection_data)) {
|
||||
$side_layer_params['body_text'] .=
|
||||
html_print_input_hidden("loginhash", "auto", true);
|
||||
$side_layer_params['body_text'] .=
|
||||
html_print_input_hidden("loginhash_data", $loginhash_data, true);
|
||||
$side_layer_params['body_text'] .=
|
||||
html_print_input_hidden("loginhash_user",
|
||||
str_rot13($loginhash_user), true);
|
||||
}
|
||||
|
||||
// FORM TABLE
|
||||
|
||||
$table = html_get_predefined_table('transparent', 2);
|
||||
|
|
|
@ -86,7 +86,7 @@ if (is_ajax()) {
|
|||
'id_filter', 'tevent_filter', $values);
|
||||
|
||||
if ($exists) {
|
||||
echo 'error';
|
||||
echo 'duplicate';
|
||||
}
|
||||
else {
|
||||
$result = db_process_sql_insert('tevent_filter', $values);
|
||||
|
@ -664,8 +664,25 @@ else
|
|||
ui_toggle($events_filter, __('Event control filter'), '', !$open_filter);
|
||||
|
||||
// Error div for ajax messages
|
||||
echo "<div id='show_filter_error'>";
|
||||
echo "<div id='show_filter_error' style='display: none;'>";
|
||||
ui_print_error_message(__('Error creating filter.'), 'data-type_info_box="error_create_filter"');
|
||||
ui_print_error_message(__('Error creating filter is duplicated.'), 'data-type_info_box="duplicate_create_filter"');
|
||||
ui_print_success_message(__('Filter created.'), 'data-type_info_box="success_create_filter"');
|
||||
|
||||
ui_print_success_message(__('Filter updated.'), 'data-type_info_box="success_update_filter"');
|
||||
ui_print_error_message(__('Error updating filter.'), 'data-type_info_box="error_create_filter"');
|
||||
|
||||
echo "</div>";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(
|
||||
function() {
|
||||
$(".info_box").hide();
|
||||
$("#show_filter_error").show();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
$event_table = events_get_events_table($meta, $history);
|
||||
|
||||
|
@ -918,31 +935,55 @@ $(document).ready( function() {
|
|||
var id_filter_save;
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
"save_event_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"id_group" : $("#id_group").val(),
|
||||
"event_type" : $("#event_type").val(),
|
||||
"severity" : $("#severity").val(),
|
||||
"status" : $("#status").val(),
|
||||
"search" : $("#text-search").val(),
|
||||
"text_agent" : $("#text_id_agent").val(),
|
||||
"pagination" : $("#pagination").val(),
|
||||
"event_view_hr" : $("#text-event_view_hr").val(),
|
||||
"id_user_ack" : $("#id_user_ack").val(),
|
||||
"group_rep" : $("#group_rep").val(),
|
||||
"tag_with": Base64.decode($("#hidden-tag_with").val()),
|
||||
"tag_without": Base64.decode($("#hidden-tag_without").val()),
|
||||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"id_group_filter": $("#id_group").val()
|
||||
{
|
||||
"page" : "operation/events/events_list",
|
||||
"save_event_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"id_group" : $("#id_group").val(),
|
||||
"event_type" : $("#event_type").val(),
|
||||
"severity" : $("#severity").val(),
|
||||
"status" : $("#status").val(),
|
||||
"search" : $("#text-search").val(),
|
||||
"text_agent" : $("#text_id_agent").val(),
|
||||
"pagination" : $("#pagination").val(),
|
||||
"event_view_hr" : $("#text-event_view_hr").val(),
|
||||
"id_user_ack" : $("#id_user_ack").val(),
|
||||
"group_rep" : $("#group_rep").val(),
|
||||
"tag_with": Base64.decode($("#hidden-tag_with").val()),
|
||||
"tag_without": Base64.decode($("#hidden-tag_without").val()),
|
||||
"filter_only_alert" : $("#filter_only_alert").val(),
|
||||
"id_group_filter": $("#id_group").val()
|
||||
},
|
||||
function (data) {
|
||||
$(".info_box").hide();
|
||||
if (data == 'error') {
|
||||
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Error creating filter'); ?> </h3>');
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "error_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
else if (data == 'duplicate') {
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "duplicate_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
else {
|
||||
id_filter_save = data;
|
||||
$('#show_filter_error').html('<h3 class="suc"> <?php echo __('Filter created'); ?> </h3>');
|
||||
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "success_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1007,11 +1048,24 @@ $(document).ready( function() {
|
|||
"id_group_filter": $("#id_group").val()
|
||||
},
|
||||
function (data) {
|
||||
$(".info_box").hide();
|
||||
if (data == 'ok') {
|
||||
$('#show_filter_error').html('<h3 class="suc"> <?php echo __('Filter updated'); ?> </h3>');
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "success_update_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
else {
|
||||
$('#show_filter_error').html('<h3 class="error"> <?php echo __('Error updating filter'); ?> </h3>');
|
||||
$(".info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "error_create_filter") {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue