diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7d729c331c..0fc4dbe4ed 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2012-01-12 Vanessa Gil + godmode/netflow/nf_edit.php + godmode/netflow/nf_report.php + godmode/netflow/nf_report_form.php + godmode/netflow/nf_report_item.php + include/functions_netflow.php + operation/netflow/nf_view.php + operation/netflow/nf_reporting.php: changes netflow acl. + 2012-01-12 Junichi Satoh * godmode/admin_access_logs.php: Fixed user filtering does not work. diff --git a/pandora_console/godmode/netflow/nf_edit.php b/pandora_console/godmode/netflow/nf_edit.php index 682d3dd977..95be1c1856 100644 --- a/pandora_console/godmode/netflow/nf_edit.php +++ b/pandora_console/godmode/netflow/nf_edit.php @@ -92,8 +92,9 @@ if ($multiple_delete) { __('Not deleted. Error deleting data')); } +$own_info = get_user_info ($config['id_user']); // Get group list that user has access -$groups_user = users_get_groups ($config['id_user'], "AW", false, true); +$groups_user = users_get_groups ($config['id_user'], "AW", $own_info['is_admin'], true); $groups_id = array(); foreach($groups_user as $key => $groups){ diff --git a/pandora_console/godmode/netflow/nf_report.php b/pandora_console/godmode/netflow/nf_report.php index cc5cd50697..232dd9f576 100644 --- a/pandora_console/godmode/netflow/nf_report.php +++ b/pandora_console/godmode/netflow/nf_report.php @@ -78,17 +78,9 @@ 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); -*/ - +$own_info = get_user_info ($config['id_user']); // Get group list that user has access -$groups_user = users_get_groups ($config['id_user'], "IW", false, true); +$groups_user = users_get_groups ($config['id_user'], "IW", $own_info['is_admin'], true); $groups_id = array(); foreach($groups_user as $key => $groups){ diff --git a/pandora_console/godmode/netflow/nf_report_form.php b/pandora_console/godmode/netflow/nf_report_form.php index 4657a9bc2b..8bbab2bbc2 100644 --- a/pandora_console/godmode/netflow/nf_report_form.php +++ b/pandora_console/godmode/netflow/nf_report_form.php @@ -35,7 +35,7 @@ $update = (string)get_parameter('update', 0); $create = (string)get_parameter('create', 0); if ($id) { - $permission = netflow_check_report_group ($id); + $permission = netflow_check_report_group ($id, false); if (!$permission) { //no tiene permisos para acceder a un informe require ("general/noaccess.php"); return; diff --git a/pandora_console/godmode/netflow/nf_report_item.php b/pandora_console/godmode/netflow/nf_report_item.php index 6f0a15725d..b14eb7d54e 100644 --- a/pandora_console/godmode/netflow/nf_report_item.php +++ b/pandora_console/godmode/netflow/nf_report_item.php @@ -112,9 +112,9 @@ if ($filters === false) { $filters = array (); } -$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); +$own_info = get_user_info ($config['id_user']); // Get group list that user has access -$groups_user = users_get_groups ($config['id_user'], "IW", $is_admin, true); +$groups_user = users_get_groups ($config['id_user'], "IW", $own_info['is_admin'], true); $groups_id = array(); foreach($groups_user as $key => $groups){ $groups_id[] = $groups['id_grupo']; diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index a7a98cc2cc..3683775ad5 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -87,14 +87,22 @@ function netflow_check_filter_group ($id_sg) { return false; } -//permite validar si un informe pertenece a un grupo permitido para el usuario +/* Permite validar si un informe pertenece a un grupo permitido para el usuario. + * Si mode = false entonces es modo godmode y solo puede ver el grupo All el admin + * Si es modo operation (mode = true) entonces todos pueden ver el grupo All + */ -function netflow_check_report_group ($id_report) { +function netflow_check_report_group ($id_report, $mode=false) { global $config; - $id_group = db_get_value('id_group', 'tnetflow_report', 'id_report', $id_report); + if (!$mode) { + $own_info = get_user_info ($config['id_user']); + $mode = $own_info['is_admin']; + } + $id_group = db_get_value('id_group', 'tnetflow_report', 'id_report', $id_report); + // Get group list that user has access - $groups_user = users_get_groups ($config['id_user'], "IW", false, true); + $groups_user = users_get_groups ($config['id_user'], "IW", $mode, true); $groups_id = array(); $has_permission = false; @@ -105,6 +113,7 @@ function netflow_check_report_group ($id_report) { return false; } + /** * Get a filter. * @@ -115,32 +124,12 @@ function netflow_check_report_group ($id_report) { * @return array A netflow filter matching id and filter. */ function netflow_filter_get_filter ($id_sg, $filter = false, $fields = false) { - global $config; - -/* - $id_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id_sg); - // Get group list that user has access - $groups_user = users_get_groups ($config['id_user'], "AR", false, true); - $groups_id = array(); - $has_permission = false; - - foreach($groups_user as $key => $groups){ - if ($groups['id_grupo'] == $id_group) - $has_permission = true; - } -*/ - //if ($has_permission) { if (! is_array ($filter)) $filter = array (); $filter['id_sg'] = (int) $id_sg; return db_get_row_filter ('tnetflow_filter', $filter, $fields); -/* - } else { - return false; - } -*/ } /** diff --git a/pandora_console/operation/netflow/nf_reporting.php b/pandora_console/operation/netflow/nf_reporting.php index b1989f0e32..b8927e8cae 100644 --- a/pandora_console/operation/netflow/nf_reporting.php +++ b/pandora_console/operation/netflow/nf_reporting.php @@ -41,7 +41,7 @@ $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_user = users_get_groups ($config['id_user'], "AR", true, true); $groups_id = array(); foreach($groups_user as $key => $groups){ diff --git a/pandora_console/operation/netflow/nf_view.php b/pandora_console/operation/netflow/nf_view.php index 17ded01d03..f38e8bbb2f 100644 --- a/pandora_console/operation/netflow/nf_view.php +++ b/pandora_console/operation/netflow/nf_view.php @@ -33,7 +33,7 @@ if (! check_acl ($config["id_user"], 0, "AR")) { $id = io_safe_input (get_parameter('id')); if ($id) { - $permission = netflow_check_report_group ($id); + $permission = netflow_check_report_group ($id, true); if (!$permission) { //no tiene permisos para acceder a un informe require ("general/noaccess.php"); return;