2012-01-11 Vanessa Gil <vanessa.gil@artica.es>

* pandoradb.sql
	  godmode/netflow/nf_edit_form.php
	  godmode/netflow/nf_edit.php
	  godmode/netflow/nf_report.php
	  godmode/netflow/nf_report_form.php
	  godmode/netflow/nf_report_item.php
	  godmode/netflow/nf_reporting.php
	  operation/netflow/nf_view.php: netflow acls.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-01-11 15:02:27 +00:00
parent 0033539c4d
commit 5045d31a5f
9 changed files with 78 additions and 34 deletions

View File

@ -1,3 +1,13 @@
2012-01-11 Vanessa Gil <vanessa.gil@artica.es>
* pandoradb.sql
godmode/netflow/nf_edit_form.php
godmode/netflow/nf_edit.php
godmode/netflow/nf_report.php
godmode/netflow/nf_report_form.php
godmode/netflow/nf_report_item.php
godmode/netflow/nf_reporting.php
operation/netflow/nf_view.php: netflow acls.
2012-01-11 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_api.php: Added new functions

View File

@ -61,7 +61,6 @@ if ($delete) {
__('Not deleted. Error deleting data'));
}
if ($multiple_delete) {
$ids = (array)get_parameter('delete_multiple', array());
@ -93,13 +92,16 @@ if ($multiple_delete) {
__('Not deleted. Error deleting data'));
}
$filter = array ();
// Get group list that user has access
$groups_user = users_get_groups ($config['id_user'], "AW", false, true);
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$filters = db_get_all_rows_filter ('tnetflow_filter', $filter);
$groups_id = array();
foreach($groups_user as $key => $groups){
$groups_id[] = $groups['id_grupo'];
}
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',',$groups_id).")";
$filters = db_get_all_rows_sql($sql);
if ($filters === false)
$filters = array ();

View File

@ -24,7 +24,7 @@ include_once ("include/functions_groups.php");
check_login ();
if (! check_acl ($config["id_user"], 0, "AW")) {
if (! check_acl ($config["id_user"], 0, "IW")) {
db_pandora_audit("ACL Violation",
"Trying to access event viewer");
require ("general/noaccess.php");
@ -49,7 +49,7 @@ ui_print_page_header (__('Netflow Filter'), "images/networkmap/so_cisco_new.png"
if ($id) {
$filter = netflow_filter_get_filter ($id);
$assign_group = $filter['group'];
$assign_group = $filter['id_group'];
$name = $filter['id_name'];
$ip_dst = $filter['ip_dst'];
$ip_src = $filter['ip_src'];
@ -60,7 +60,7 @@ if ($id) {
} else {
$name = '';
$assign_group = 'none';
$assign_group = '';
$ip_dst = '';
$ip_src = '';
$dst_port = '';
@ -85,16 +85,13 @@ if ($update) {
$result = db_process_sql_update ('tnetflow_filter',
array ('id_sg' => $id,
'id_name' => $name,
'group' => $assign_group,
'id_group' => $assign_group,
'aggregate' => $aggregate,
'ip_dst' => $ip_dst,
'ip_src' => $ip_src,
'dst_port' => $dst_port,
'src_port' => $src_port,
'show_packets' => $show_packets,
'show_bytes' => $show_bytes,
'show_bps' => $show_bps,
'show_bpp' => $show_bpp, ),
'output' => $output),
array ('id_sg' => $id));
ui_print_result_message ($result,
@ -118,7 +115,7 @@ if ($create){
} else {
$values = array (
'id_name'=>$name,
'group' => $assign_group,
'id_group' => $assign_group,
'ip_dst'=>$ip_dst,
'ip_src'=>$ip_src,
'dst_port'=>$dst_port,
@ -148,8 +145,8 @@ $table->data[0][1] = html_print_input_text ('name', $name, false, 20, 80, true);
$own_info = get_user_info ($config['id_user']);
$table->data[1][0] = '<b>'.__('Group').'</b>';
$table->data[1][1] = html_print_select_groups($config['id_user'], "AW",
$own_info['is_admin'], 'assign_group', $assign_group, '', __('None'), -1, true,
$table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
$own_info['is_admin'], 'assign_group', $assign_group, '', '', -1, true,
false, false);
$table->data[2][0] = '<b>'.__('Filter:').'</b>';

View File

@ -78,13 +78,27 @@ if ($multiple_delete) {
__('Not deleted. Error deleting data'));
}
/*
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$reports = db_get_all_rows_filter ('tnetflow_report', $filter);
*/
// Get group list that user has access
$groups_user = users_get_groups ($config['id_user'], "IW", false, true);
html_debug_print($groups_user);
$groups_id = array();
foreach($groups_user as $key => $groups){
$groups_id[] = $groups['id_grupo'];
}
html_debug_print($groups_id);
$sql = "SELECT * FROM tnetflow_report WHERE id_group IN (".implode(',',$groups_id).")";
html_debug_print($sql);
$reports = db_get_all_rows_sql($sql);
if ($reports === false)
$reports = array();

View File

@ -38,11 +38,11 @@ if ($id) {
$report = netflow_reports_get_reports ($id);
$name = $report['id_name'];
$description = $report['description'];
$group = $report['group'];
$group = $report['id_group'];
} else {
$name = '';
$group = 'none';
$group = '';
$description = '';
}
@ -50,7 +50,7 @@ if ($update) {
$id = get_parameter('id');
$name = (string) get_parameter ('name');
$description = get_parameter ('description');
$group = get_parameter('group','none');
$group = get_parameter('id_group');
if ($name == '') {
ui_print_error_message (__('Not updated. Blank name'));
@ -58,7 +58,7 @@ if ($update) {
$result = db_process_sql_update ('tnetflow_report',
array (
'id_name' => $name,
'group' => $group,
'id_group' => $group,
'description' => $description,
),
array ('id_report' => $id));
@ -67,7 +67,7 @@ if ($update) {
if ($create){
$name = (string) get_parameter ('name');
$group = (int) get_parameter ('group');
$group = (int) get_parameter ('id_group');
$description = get_parameter('description','');
if($name == db_get_value('id_name', 'tnetflow_report', 'id_name', $name)){
@ -75,7 +75,7 @@ if ($create){
} else {
$values = array (
'id_name' => $name,
'group' => $group,
'id_group' => $group,
'description' => $description,
);
$result = db_process_sql_insert('tnetflow_report', $values);
@ -124,7 +124,7 @@ $table->data[0][1] = html_print_input_text ('name', $name, false, 30, 80, true);
$own_info = get_user_info ($config['id_user']);
$table->data[1][0] = '<b>'.__('Group').'</b>';
$table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
$own_info['is_admin'], 'group', $group, '', __('None'), -1, true,
$own_info['is_admin'], 'id_group', $group, '','', -1, true,
false, false);
$table->data[2][0] = '<b>'.__('Description').'</b>';

View File

@ -59,8 +59,8 @@ if ($id_rc) {
}
if ($update) {
$name_filter = get_parameter('id_filter');
$id_filter = db_get_value('id_sg', 'tnetflow_filter', 'id_name', $name_filter);
$id_filter = get_parameter('id_filter');
$name_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id_filter);
$max_val = get_parameter('max','2');
$show_graph = get_parameter('show_graph','');
@ -79,8 +79,9 @@ if ($update) {
}
if ($create){
$name_filter = get_parameter('id_filter');
$id_filter = db_get_value('id_sg', 'tnetflow_filter', 'id_name', $name_filter);
$id_filter = get_parameter('id_filter');
$name_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id_filter);
$max_val = get_parameter('max','2');
$show_graph = get_parameter('show_graph','');
@ -111,8 +112,16 @@ $filters = netflow_get_filters ();
if ($filters === false) {
$filters = array ();
}
html_debug_print($filters);
// Get group list that user has access
$groups_user = users_get_groups ($config['id_user'], "IW", false, true);
$groups_id = array();
foreach($groups_user as $key => $groups){
$groups_id[] = $groups['id_grupo'];
}
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',',$groups_id).")";
$table->data[0][0] = '<b>'.__('Filters').'</b>';
$table->data[0][1] = html_print_select($filters, 'id_filter', $name_filter, '', '', 0, true);
$table->data[0][1] = html_print_select_from_sql($sql, 'id_filter', $name_filter, '', '', 0, true);
$table->data[1][0] = '<b>'.__('Max values aggregated').'</b>';
$max_values = array ('2' => '2',

View File

@ -23,7 +23,7 @@ include_once("include/functions_html.php");
check_login ();
if (! check_acl ($config["id_user"], 0, "IR")) {
if (! check_acl ($config["id_user"], 0, "AR")) {
db_pandora_audit("ACL Violation",
"Trying to access event viewer");
require ("general/noaccess.php");
@ -33,12 +33,24 @@ if (! check_acl ($config["id_user"], 0, "IR")) {
//Header
ui_print_page_header (__('Netflow Reporting'), "images/networkmap/so_cisco_new.png", false, "", false);
/*
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
*/
// Get group list that user has access
$groups_user = users_get_groups ($config['id_user'], "AR", false, true);
$groups_id = array();
foreach($groups_user as $key => $groups){
$groups_id[] = $groups['id_grupo'];
}
//$sql = "SELECT * FROM tnetflow_report WHERE 'group' IN (\"".implode('","',$groups_id)."\")";
$sql = "SELECT * FROM tnetflow_report WHERE id_group IN (".implode(',',$groups_id).")";
$reports = db_get_all_rows_sql($sql);
$reports = db_get_all_rows_filter ('tnetflow_report', $filter);
if ($reports == false){
$reports = array();
}

View File

@ -279,7 +279,7 @@ if ($id!=''){
$sql = "SELECT * FROM tnetflow_filter WHERE id_sg = '".$id_filter."'";
$result = db_get_row_sql($sql,false,true);
$assign_group = $result['group'];
$assign_group = $result['id_group'];
$ip_dst = $result['ip_dst'];
$ip_src = $result['ip_src'];
$dst_port = $result['dst_port'];

View File

@ -1287,7 +1287,7 @@ CREATE TABLE IF NOT EXISTS `ttag_event` (
CREATE TABLE IF NOT EXISTS `tnetflow_filter` (
`id_sg` int(10) unsigned NOT NULL auto_increment,
`id_name` varchar(60) NOT NULL default '0',
`group` varchar(60),
`id_group` int(10),
`ip_dst` varchar(100),
`ip_src` varchar(100),
`dst_port` varchar(100),
@ -1305,7 +1305,7 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report` (
`id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_name` varchar(150) NOT NULL default '',
`description` TEXT NOT NULL,
`group` varchar(60),
`id_group` int(10),
PRIMARY KEY(`id_report`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;