Merge branch 'develop' into feature/NewView

This commit is contained in:
m-lopez-f 2015-04-13 09:09:04 +02:00
commit 4158afde8c
42 changed files with 911 additions and 491 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.0dev-150408
Version: 6.0dev-150413
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150408"
pandora_version="6.0dev-150413"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0dev';
use constant AGENT_BUILD => '150408';
use constant AGENT_BUILD => '150413';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150408
%define release 150413
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150408
%define release 150413
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150408}
{150413}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150408)")
#define PANDORA_VERSION ("6.0dev(Build 150413)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0dev(Build 150408))"
VALUE "ProductVersion", "(6.0dev(Build 150413))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150408
Version: 6.0dev-150413
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150408"
pandora_version="6.0dev-150413"
package_pear=0
package_pandora=1

View File

@ -159,6 +159,9 @@ if ($create_downtime || $update_downtime) {
else if ($type_execution == 'once' && $datetime_from >= $datetime_to) {
ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end date must be higher than the start date'));
}
else if ($type_execution == 'once' && $datetime_to <= $now) {
ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end date must be higher than the current time'));
}
else if ($type_execution == 'periodically'
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))) {
@ -216,7 +219,6 @@ if ($create_downtime || $update_downtime) {
'description' => $description,
'date_from' => $datetime_from,
'date_to' => $datetime_to,
'executed' => 0,
'id_group' => $id_group,
'only_alerts' => 0,
'monday' => $monday,
@ -307,18 +309,22 @@ if ($id_downtime > 0) {
$type_downtime = $result['type_downtime'];
$type_execution = $result['type_execution'];
$type_periodicity = $result['type_periodicity'];
$executed = $result['executed'];
if ($id_group == 0)
$id_group = $result['id_group'];
}
// when the planned down time is in execution, only action to postpone on once type is enabled and the other are disabled.
$disabled_in_execution = $executed ? 1 : 0;
$table->class = 'databox_color';
$table->width = '98%';
$table->data = array ();
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text ('name', $name, '', 25, 40, true);
$table->data[0][1] = html_print_input_text ('name', $name, '', 25, 40, true, $disabled_in_execution);
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(false, "AW", true, 'id_group', $id_group, '', '', 0, true);
$table->data[1][1] = html_print_select_groups(false, "AW", true, 'id_group', $id_group, '', '', 0, true, false, true, '', $disabled_in_execution);
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 3, 35, $description, '', true);
@ -329,11 +335,12 @@ $table->data[3][1] = html_print_select(array('quiet' => __('Quiet'),
'disable_agents' => __('Disabled Agents'),
'disable_agents_alerts' => __('Disabled only Alerts')),
'type_downtime', $type_downtime, 'change_type_downtime()', '', 0, true, false, true,
'');
'', $disabled_in_execution);
$table->data[4][0] = __('Execution');
$table->data[4][1] = html_print_select(array('once' => __('Once'),
'periodically' => __('Periodically')),
'type_execution', $type_execution, 'change_type_execution();', '', 0, true);
'type_execution', $type_execution, 'change_type_execution();', '', 0, true,
false, true, '', $disabled_in_execution);
$days = array_combine(range(1, 31), range(1, 31));
$table->data[5][0] = __('Configure the time') . "&nbsp;" . ui_print_help_icon ('planned_downtime_time', true);;
@ -345,9 +352,9 @@ $table->data[5][1] = "
__('From:') .
"</td>
<td>".
html_print_input_text ('once_date_from', $once_date_from, '', 10, 10, true) .
html_print_input_text ('once_date_from', $once_date_from, '', 10, 10, true, $disabled_in_execution) .
ui_print_help_tip(__('Date format in Pandora is year/month/day'), true) .
html_print_input_text ('once_time_from', $once_time_from, '', 9, 9, true) .
html_print_input_text ('once_time_from', $once_time_from, '', 9, 9, true, $disabled_in_execution) .
ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds'), true) .
"</td>
</tr>
@ -372,7 +379,8 @@ $table->data[5][1] = "
'weekly' => __('Weekly'),
'monthly' => __('Monthly')),
'type_periodicity', $type_periodicity,
'change_type_periodicity();', '', 0, true) .
'change_type_periodicity();', '', 0, true,
false, true, '', $disabled_in_execution) .
"</td>
</tr>
<tr>
@ -380,25 +388,25 @@ $table->data[5][1] = "
<table id='weekly_item' style='display: none;'>
<tr>
<td>" . __('Mon') .
html_print_checkbox ('monday', 1, $monday, true) .
html_print_checkbox ('monday', 1, $monday, true, $disabled_in_execution) .
"</td>
<td>" . __('Tue') .
html_print_checkbox ('tuesday', 1, $tuesday, true) .
html_print_checkbox ('tuesday', 1, $tuesday, true, $disabled_in_execution) .
"</td>
<td>" . __('Wed') .
html_print_checkbox ('wednesday', 1, $wednesday, true) .
html_print_checkbox ('wednesday', 1, $wednesday, true, $disabled_in_execution) .
"</td>
<td>" . __('Thu') .
html_print_checkbox ('thursday', 1, $thursday, true) .
html_print_checkbox ('thursday', 1, $thursday, true, $disabled_in_execution) .
"</td>
<td>" . __('Fri') .
html_print_checkbox ('friday', 1, $friday, true) .
html_print_checkbox ('friday', 1, $friday, true, $disabled_in_execution) .
"</td>
<td>" . __('Sat') .
html_print_checkbox ('saturday', 1, $saturday, true) .
html_print_checkbox ('saturday', 1, $saturday, true, $disabled_in_execution) .
"</td>
<td>" . __('Sun') .
html_print_checkbox ('sunday', 1, $sunday, true) .
html_print_checkbox ('sunday', 1, $sunday, true, $disabled_in_execution) .
"</td>
</tr>
</table>
@ -407,12 +415,14 @@ $table->data[5][1] = "
<td>" . __('From day:') . "</td>
<td>".
html_print_select($days,
'periodically_day_from', $periodically_day_from, '', '', 0, true) .
'periodically_day_from', $periodically_day_from, '', '', 0, true,
false, true, '', $disabled_in_execution) .
"</td>
<td>" . __('To day:') . "</td>
<td>".
html_print_select($days,
'periodically_day_to', $periodically_day_to, '', '', 0, true) .
'periodically_day_to', $periodically_day_to, '', '', 0, true,
false, true, '', $disabled_in_execution) .
"</td>
<td>" . ui_print_help_tip(__('The end day must be higher than the start day'), true) . "</td>
</tr>
@ -423,7 +433,7 @@ $table->data[5][1] = "
<td>".
html_print_input_text (
'periodically_time_from',
$periodically_time_from, '', 7, 7, true) .
$periodically_time_from, '', 7, 7, true, $disabled_in_execution) .
ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds').
".<br>".__('The end time must be higher than the start time'), true) .
"</td>
@ -431,7 +441,7 @@ $table->data[5][1] = "
<td>".
html_print_input_text (
'periodically_time_to',
$periodically_time_to, '', 7, 7, true) .
$periodically_time_to, '', 7, 7, true, $disabled_in_execution) .
ui_print_help_tip(__('Time format in Pandora is hours(24h):minutes:seconds').
".<br>".__('The end time must be higher than the start time'), true) .
"</td>
@ -498,7 +508,7 @@ if ($id_downtime > 0) {
}
$disabled_add_button = false;
if (empty($data)) {
if (empty($data) || $disabled_in_execution) {
$disabled_add_button = true;
}
@ -589,11 +599,13 @@ if ($id_downtime > 0) {
if (($type_downtime != 'disable_agents_alerts')
&& ($type_downtime != 'disable_agents')) {
$data[5] = '<a href="javascript:show_editor_module(' . $downtime["id_agente"] . ');">' .
$href = $executed ? 'javascript:void(0);' : 'javascript:show_editor_module(' . $downtime["id_agente"] . ');';
$data[5] = '<a href="' . $href . '">' .
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Delete'))) . "</a>";
}
$data[5] .= '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor'.
$href = $executed ? 'javascript:void(0);' : 'index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor';
$data[5] .= '<a href="' . $href .
'&amp;id_agent=' . $downtime["id_agente"] .
'&amp;delete_downtime_agent=1' .
'&amp;id_downtime_agent=' . $downtime["id"] .
@ -994,5 +1006,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
}
});
}
// Disable datepickers when it has readonly attribute
$('input.hasDatepicker[readonly]').disable();
});
</script>

View File

@ -499,6 +499,12 @@ else {
'delete_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete')));
}
elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once'){
$data[8] = '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor&amp;' .
'edit_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>';
$data[9]= "N/A";
}
else {
$data[8]= "N/A";
$data[9]= "N/A";

View File

@ -17,6 +17,18 @@ global $config;
require_once ($config['homedir'] . '/include/functions_visual_map.php');
// ACL for the general permission
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
require ("general/noaccess.php");
exit;
}
$pure = (int)get_parameter('pure', 0);
$hack_metaconsole = '';
if (defined('METACONSOLE'))
@ -31,110 +43,139 @@ $copy_layout = (bool) get_parameter ('copy_layout');
$delete_layout = (bool) get_parameter ('delete_layout');
$refr = (int) get_parameter('refr');
if ($delete_layout) {
db_process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
$result = db_process_sql_delete ('tlayout', array ('id' => $id_layout));
if ($result) {
db_pandora_audit( "Visual console builder", "Delete visual console #$id_layout");
ui_print_success_message(__('Successfully deleted'));
db_clean_cache();
if ($delete_layout || $copy_layout) {
// Visual console required
if (empty($id_layout)) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
require ("general/noaccess.php");
exit;
}
else {
db_pandora_audit( "Visual console builder", "Fail try to delete visual console #$id_layout");
ui_print_error_message(__('Not deleted. Error deleting data'));
$group_id = db_get_value("id_group", "tlayout", "id", $id_layout);
if ($group_id === false) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
require ("general/noaccess.php");
exit;
}
$id_layout = 0;
}
// ACL for the visual console
// $vconsole_read = check_acl ($config['id_user'], $group_id, "VR");
$vconsole_write = check_acl ($config['id_user'], $group_id, "VW");
$vconsole_manage = check_acl ($config['id_user'], $group_id, "VM");
if ($copy_layout) {
// Number of inserts
$ninsert = (int) 0;
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
require ("general/noaccess.php");
exit;
}
// Return from DB the source layout
$layout_src = db_get_all_rows_filter ("tlayout","id = " . $id_layout);
// Name of dst
$name_dst = get_parameter ("name_dst", $layout_src[0]['name'] . " copy");
// Create the new Console
$idGroup = $layout_src[0]['id_group'];
$background = $layout_src[0]['background'];
$height = $layout_src[0]['height'];
$width = $layout_src[0]['width'];
$visualConsoleName = $name_dst;
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background, 'height' => $height, 'width' => $width);
$result = db_process_sql_insert('tlayout', $values);
$idNewVisualConsole = $result;
if ($result) {
$ninsert = 1;
if ($delete_layout) {
db_process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
$result = db_process_sql_delete ('tlayout', array ('id' => $id_layout));
if ($result) {
db_pandora_audit( "Visual console builder", "Delete visual console #$id_layout");
ui_print_success_message(__('Successfully deleted'));
db_clean_cache();
}
else {
db_pandora_audit( "Visual console builder", "Fail try to delete visual console #$id_layout");
ui_print_error_message(__('Not deleted. Error deleting data'));
}
$id_layout = 0;
}
if ($copy_layout) {
// Number of inserts
$ninsert = (int) 0;
// Return from DB the items of the source layout
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
// Return from DB the source layout
$layout_src = db_get_all_rows_filter ("tlayout","id = " . $id_layout);
if (!empty($data_layout_src)) {
// Name of dst
$name_dst = get_parameter ("name_dst", $layout_src[0]['name'] . " copy");
// Create the new Console
$idGroup = $layout_src[0]['id_group'];
$background = $layout_src[0]['background'];
$height = $layout_src[0]['height'];
$width = $layout_src[0]['width'];
$visualConsoleName = $name_dst;
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background, 'height' => $height, 'width' => $width);
$result = db_process_sql_insert('tlayout', $values);
$idNewVisualConsole = $result;
if ($result) {
$ninsert = 1;
//By default the id parent 0 is always 0.
$id_relations = array(0 => 0);
// Return from DB the items of the source layout
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
for ($a=0; $a < count($data_layout_src); $a++) {
if (!empty($data_layout_src)) {
// Changing the source id by the new visual console id
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
//By default the id parent 0 is always 0.
$id_relations = array(0 => 0);
$old_id = $data_layout_src[$a]['id'];
// Unsetting the source's id
unset($data_layout_src[$a]['id']);
// Configure the cloned Console
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
$id_relations[$old_id] = 0;
if ($result !== false) {
$id_relations[$old_id] = $result;
}
if ($result)
$ninsert++;
}// for each item of console
$inserts = count($data_layout_src) + 1;
// If the number of inserts is correct, the copy is completed
if ($ninsert == $inserts) {
//Update the ids of parents
$items = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $idNewVisualConsole);
foreach ($items as $item) {
$new_parent = $id_relations[$item['parent_item']];
for ($a=0; $a < count($data_layout_src); $a++) {
db_process_sql_update('tlayout_data',
array('parent_item' => $new_parent), array('id' => $item['id']));
// Changing the source id by the new visual console id
$data_layout_src[$a]['id_layout'] = $idNewVisualConsole;
$old_id = $data_layout_src[$a]['id'];
// Unsetting the source's id
unset($data_layout_src[$a]['id']);
// Configure the cloned Console
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
$id_relations[$old_id] = 0;
if ($result !== false) {
$id_relations[$old_id] = $result;
}
if ($result)
$ninsert++;
}// for each item of console
$inserts = count($data_layout_src) + 1;
// If the number of inserts is correct, the copy is completed
if ($ninsert == $inserts) {
//Update the ids of parents
$items = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $idNewVisualConsole);
foreach ($items as $item) {
$new_parent = $id_relations[$item['parent_item']];
db_process_sql_update('tlayout_data',
array('parent_item' => $new_parent), array('id' => $item['id']));
}
ui_print_success_message(__('Successfully copied'));
db_clean_cache();
}
else {
ui_print_error_message(__('Not copied. Error copying data'));
}
}
else {
// If the array is empty the copy is completed
ui_print_success_message(__('Successfully copied'));
db_clean_cache();
}
else {
ui_print_error_message(__('Not copied. Error copying data'));
}
}
else {
// If the array is empty the copy is completed
ui_print_success_message(__('Successfully copied'));
db_clean_cache();
ui_print_error_message(__('Not copied. Error copying data'));
}
}
else {
ui_print_error_message(__('Not copied. Error copying data'));
}
}
$table->width = '98%';
@ -146,7 +187,7 @@ $table->head[2] = __('Items');
// Fix: IW was the old ACL for report editing, now is RW
//Only for RW flag
if (check_acl ($config['id_user'], 0, "RW")) {
if ($vconsoles_write || $vconsoles_manage) {
$table->head[3] = __('Copy');
$table->head[4] = __('Delete');
}
@ -159,9 +200,9 @@ $table->align[3] = 'center';
$table->align[4] = 'center';
// Only display maps of "All" group if user is administrator
// or has "RR" privileges, otherwise show only maps of user group
// or has "VR" privileges, otherwise show only maps of user group
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "RR"))
if ($own_info['is_admin'] || $vconsoles_read)
$maps = visual_map_get_user_layouts ();
else
$maps = visual_map_get_user_layouts ($config['id_user'], false, false, false);
@ -171,6 +212,9 @@ if (!$maps) {
}
else {
foreach ($maps as $map) {
// ACL for the visual console permission
$vconsole_write = check_acl ($config['id_user'], $map['id_group'], "VW");
$vconsole_manage = check_acl ($config['id_user'], $map['id_group'], "VM");
$data = array ();
@ -187,7 +231,7 @@ else {
$data[2] = db_get_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
// Fix: IW was the old ACL for report editing, now is RW
if (check_acl ($config['id_user'], 0, "RW")) {
if ($vconsole_write || $vconsole_manage) {
if (!defined('METACONSOLE')) {
$data[3] = '<a class="copy_visualmap" href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
@ -212,13 +256,11 @@ else {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
}
// Fix: IW was the old ACL to check for report editing, now is RW
//Only for RW flag
if (check_acl ($config['id_user'], 0, "RW")) {
if ($vconsoles_write || $vconsoles_manage) {
if (!defined('METACONSOLE'))
echo '<form action="index.php?sec=reporting&amp;sec2=godmode/reporting/visual_console_builder" method="post">';
else {
echo '<form action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '" method="post">';
echo '<form action="index.php?sec=screen&sec2=screens/screens&action=visualmap&action2=new&operation=new_visualmap&tab=data&pure=' . $pure . '" method="post">';
}
html_print_input_hidden ('edit_layout', 1);
html_print_submit_button (__('Create'), '', false, 'class="sub next"');

View File

@ -17,7 +17,26 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
if (empty($idVisualConsole)) {
// ACL for the a new visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], 0, "VR");
if (!isset($vconsole_write))
$vconsole_write = check_acl ($config['id_user'], 0, "VW");
if (!isset($vconsole_manage))
$vconsole_manage = check_acl ($config['id_user'], 0, "VM");
}
else {
// ACL for the existing visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], $idGroup, "VR");
if (!isset($vconsole_write))
$vconsole_write = check_acl ($config['id_user'], $idGroup, "VW");
if (!isset($vconsole_manage))
$vconsole_manage = check_acl ($config['id_user'], $idGroup, "VM");
}
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
@ -85,7 +104,7 @@ $groups = users_get_groups ($config['id_user'], 'RW');
$own_info = get_user_info($config['id_user']);
// Only display group "All" if user is administrator
// or has "RW" privileges
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "RW"))
if ($own_info['is_admin'] || $vconsole_write || $vconsole_manage)
$display_all_group = true;
else
$display_all_group = false;

View File

@ -17,7 +17,23 @@ global $config;
// Login check
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
// Visual console required
if (empty($visualConsole)) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
// ACL for the existing visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
if (!isset($vconsole_write))
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
if (!isset($vconsole_manage))
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");

View File

@ -17,7 +17,23 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
// Visual console required
if (empty($visualConsole)) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
// ACL for the existing visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
if (!isset($vconsole_write))
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
if (!isset($vconsole_manage))
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");

View File

@ -18,27 +18,13 @@ global $statusProcessInDB;
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
require_once ($config['homedir'] . '/include/functions_visual_map.php');
require_once($config['homedir'] . "/include/functions_agents.php");
enterprise_include_once('include/functions_visual_map.php');
$pure = (int)get_parameter('pure', 0);
if (!empty($idVisualConsole)) {
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
}
else {
$idVisualConsole = get_parameter('id_visual_console', 0);
}
$id_layout = 0;
// Retrieve the visual console id
set_unless_defined ($idVisualConsole, 0); // Set default
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
if (!defined('METACONSOLE')) {
$action_name_parameter = 'action';
@ -53,8 +39,57 @@ $action = get_parameterBetweenListValues($action_name_parameter,
$activeTab = get_parameterBetweenListValues('tab', array('data', 'list_elements', 'wizard', 'wizard_services', 'editor'), 'data');
// Visual console creation tab and actions
if (empty($idVisualConsole)) {
$visualConsole = null;
// General ACL
//$vconsole_read = check_acl ($config['id_user'], 0, "VR");
$vconsole_write = check_acl ($config['id_user'], 0, "VW");
$vconsole_manage = check_acl ($config['id_user'], 0, "VM");
}
// The visual console exists
else if ($activeTab != 'data' || ($activeTab == 'data' && $action != 'new')) {
// Load the visual console data
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
// The visual console should exist.
if (empty($visualConsole)) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
return;
}
// The default group id is 0
set_unless_defined ($visualConsole['id_group'], 0);
// ACL for the existing visual console
//$vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
}
else {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
return;
}
// This section is only to manage the visual console
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
$pure = (int) get_parameter ('pure', 0);
$refr = (int) get_parameter ('refr', $config['vc_refr']);
$id_layout = 0;
//Save/Update data in DB
global $statusProcessInDB;
@ -71,16 +106,30 @@ switch ($activeTab) {
case 'update':
case 'save':
$idGroup = get_parameter('id_group');
$background = get_parameter('background');
$visualConsoleName = get_parameter('name');
$idGroup = (int) get_parameter('id_group');
$background = (string) get_parameter('background');
$visualConsoleName = (string) get_parameter('name');
$values = array('name' => $visualConsoleName,
'id_group' => $idGroup, 'background' => $background);
// ACL for the new visual console
//$vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
$vconsole_write_new = check_acl ($config['id_user'], $idGroup, "VW");
$vconsole_manage_new = check_acl ($config['id_user'], $idGroup, "VM");
// The user should have permissions on the new group
if (!$vconsole_write_new && !$vconsole_manage_new) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
$values = array(
'name' => $visualConsoleName,
'id_group' => $idGroup,
'background' => $background
);
// If the background is changed the size is reseted
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
$background_now = $visualConsole['background'];
if ($background_now != $background && $background) {
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
@ -93,10 +142,18 @@ switch ($activeTab) {
$result = false;
if ($values['name'] != "" && $values['background'])
$result = db_process_sql_update('tlayout', $values, array('id' => $idVisualConsole));
if ($result !== false && $values['background']) {
if ($result !== false) {
db_pandora_audit( "Visual console builder", "Update visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true, 'message' => ui_print_success_message(__('Successfully update.'), '', true));
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
else {
db_pandora_audit( "Visual console builder", "Fail update visual console #$idVisualConsole");
@ -116,6 +173,14 @@ switch ($activeTab) {
$action = 'edit';
$statusProcessInDB = array('flag' => true,
'message' => ui_print_success_message(__('Successfully created.'), '', true));
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
@ -125,13 +190,9 @@ switch ($activeTab) {
}
break;
}
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
break;
case 'edit':
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
$visualConsoleName = $visualConsole['name'];
$idGroup = $visualConsole['id_group'];
$background = $visualConsole['background'];
@ -147,13 +208,11 @@ switch ($activeTab) {
json_encode(array())));
$delete_items = json_decode($delete_items_json, true);
$id_visual_console = (int)get_parameter(
'id_visual_console', 0);
if (!empty($delete_items)) {
$result = (bool)db_process_sql_delete(
'tlayout_data',
array('id_layout' => $id_visual_console,
array('id_layout' => $idVisualConsole,
'id' => $delete_items));
}
@ -187,6 +246,10 @@ switch ($activeTab) {
'height' => $height),
array('id' => $idVisualConsole));
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
//Update elements in visual map
$idsElements = db_get_all_rows_filter('tlayout_data',
array('id_layout' => $idVisualConsole), array('id'));
@ -246,12 +309,10 @@ switch ($activeTab) {
}
break;
}
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
$visualConsoleName = $visualConsole['name'];
$action = 'edit';
break;
case 'wizard':
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
$visualConsoleName = $visualConsole['name'];
$background = $visualConsole['background'];
switch ($action) {
@ -430,7 +491,6 @@ switch ($activeTab) {
}
break;
case 'wizard_services':
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
$visualConsoleName = $visualConsole['name'];
switch ($action) {
case 'update':
@ -453,9 +513,6 @@ switch ($activeTab) {
case 'new':
case 'update':
case 'edit':
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
$visualConsoleName = $visualConsole['name'];
$action = 'edit';
break;

View File

@ -17,7 +17,23 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
// Visual console required
if (empty($visualConsole)) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
// ACL for the existing visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
if (!isset($vconsole_write))
$vconsole_write = check_acl ($config['id_user'], $visualConsole['id_group'], "VW");
if (!isset($vconsole_manage))
$vconsole_manage = check_acl ($config['id_user'], $visualConsole['id_group'], "VM");
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");

View File

@ -17,14 +17,41 @@ global $config;
check_login ();
// Fix: IW was the old ACL to check for report editing, now is RW
if (! check_acl ($config['id_user'], 0, "RW")) {
$id_visual_console = get_parameter('id_visual_console', null);
// WARNING: CHECK THE ENTIRE FUNCTIONALITY
// Visual console id required
if (empty($id_visual_console)) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
// Get the group id for the ACL checks
$group_id = db_get_value('id_group', 'tlayout', 'id', $id_visual_console);
if ($group_id === false) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
// ACL for the existing visual console
// if (!isset($vconsole_read))
// $vconsole_read = check_acl ($config['id_user'], $group_id, "VR");
if (!isset($vconsole_write))
$vconsole_write = check_acl ($config['id_user'], $group_id, "VW");
if (!isset($vconsole_manage))
$vconsole_manage = check_acl ($config['id_user'], $group_id, "VM");
if (!$vconsole_write && !$vconsole_manage) {
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
//Fix ajax to avoid include the file, 'functions_graph.php'.
$ajax = true;
@ -39,8 +66,6 @@ enterprise_include_once('include/functions_visual_map.php');
$action = get_parameter('action');
$type = get_parameter('type');
$id_visual_console = get_parameter('id_visual_console', null);
$id_element = get_parameter('id_element', null);
$image = get_parameter('image', null);

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150408';
$build_version = 'PC150413';
$pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined.

View File

@ -1770,7 +1770,9 @@ function check_acl($id_user, $id_group, $access, $id_agent = 0) {
tperfil.report_view, tperfil.report_edit,
tperfil.report_management, tperfil.event_view,
tperfil.event_edit, tperfil.event_management,
tperfil.agent_disable
tperfil.agent_disable,
tperfil.map_view, tperfil.map_edit, tperfil.map_management,
tperfil.vconsole_view, tperfil.vconsole_edit, tperfil.vconsole_management
FROM tusuario_perfil, tperfil
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
AND tusuario_perfil.id_usuario = '%s'", $id_user);
@ -1785,7 +1787,9 @@ function check_acl($id_user, $id_group, $access, $id_agent = 0) {
tperfil.report_view, tperfil.report_edit,
tperfil.report_management, tperfil.event_view,
tperfil.event_edit, tperfil.event_management,
tperfil.agent_disable
tperfil.agent_disable,
tperfil.map_view, tperfil.map_edit, tperfil.map_management,
tperfil.vconsole_view, tperfil.vconsole_edit, tperfil.vconsole_management
FROM tusuario_perfil, tperfil
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
AND tusuario_perfil.id_usuario = '%s'

View File

@ -10,63 +10,71 @@
<p>The following list defines what ACL control allows in each feature at the console:</p>
<table cellpadding=4 cellspacing=0 style='background-color: #f0f0f0; border: 1px solid #acacac'>
<tr><th style='background-color: #cacaca'>Feature<Th style='background-color: #cacaca'>ACL Control
<table cellpadding=4 cellspacing=0 style='background-color: #f0f0f0;'>
<tr><th style='background-color: #cacaca'>Feature<th style='background-color: #cacaca'>ACL Control
<tr><td>View agent data (all tabs)<td>AR
<tr><td>Tactical view<td>AR
<tr><td>Network map view<td>AR
<tr><td>Group view<td>AR
<tr><td>Visual console edition<td>RW
<tr><td>Create report<td>RW
<tr><td>Create user custom-defined graph<td>RW
<tr><td>View report, visual map and/or custom graph<td>RR
<tr><td>Apply report template<td>RR
<tr><td>Create report template<td>RM
<tr><td>Create incident<td>IW
<tr><td>Read incident<td>IR
<tr><td>Delete Incident<td>IW
<tr><td>Become owner of another incident<td>IM
<tr><td>Delete incident of another user<td>IM
<tr><td>View event<td>ER
<tr><td>Validate/Comment event<td>EW
<tr><td>Delete event<td>EM
<tr><td>Execute response<td>EW
<tr><td>Create incident from event (Response)<td>EW&IW
<tr><td>Manage response<td>PM
<tr><td>Manage filters<td>EW
<tr><td>Customize event columns<td>PM
<tr><td>Change owner/Re-open event<td>EM
<tr><td>View user<td>AR
<tr><td>SNMP Console view<td>AR
<tr><td>Validate traps<td>IW
<tr><td>Message<td>IW
<tr><td>View the agent's data (all tabs)<td>AR
<tr><td>Tactical View<td>AR
<tr><td>Group View<td>AR
<tr><td>Visual console editing<td>RW
<tr><td>Creating reports<td>RW
<tr><td>Creating user-defined graphs<td>RW
<tr><td>Viewing reports, visual maps and custom graphs<td>RR
<tr><td>Applying report templates<td>RR
<tr><td>Creating report templates<td>RM
<tr><td>Creating incidents<td>IW
<tr><td>Reading incidents<td>IR
<tr><td>Deleting incidents<td>IW
<tr><td>Becoming the owner of another user's incidents<td>IM
<tr><td>Deleting another user's incidents<td>IM
<tr><td>Viewing events<td>ER
<tr><td>Validating and commenting events<td>EW
<tr><td>Deleting events<td>EM
<tr><td>Executing responses<td>EW
<tr><td>Creating incidents from events (response)<td>EW&IW
<tr><td>Managing responses<td>PM
<tr><td>Managing filters<td>EW
<tr><td>Customizing event columns<td>PM
<tr><td>Changing owners / reopen event<td>EM
<tr><td>Viewing users<td>AR
<tr><td>SNMP Console viewing<td>AR
<tr><td>Validating traps<td>IW
<tr><td>Messages<td>IW
<tr><td>Cron jobs <td>PM
<tr><td>Tree view <td>AR
<tr><td>Update manager (Operation & Admin) <td>PM
<tr><td>Update Manager (operation and administration) <td>PM
<tr><td>Extension Module Group<td>AR
<tr><td>Agent management<td>AW
<tr><td>Remote agent configuration management <td>AW
<tr><td>Assign alerts to agents<td>LW
<tr><td>Define, alter and delete alert templates, actions and commands<td>LM
<tr><td>Group management<td>PM
<tr><td>Create inventory modules<td>PM
<tr><td>Module management (includes all suboptions)<td>PM
<tr><td>Massive management operations <td>AW
<tr><td>Create agent<td>AW
<tr><td>Duplicate remote configurations<td>AW
<tr><td>Downtime management<td>AW
<tr><td>Alert management<td>LW
<tr><td>User management<td>UM
<tr><td>SNMP Console management (alerts and MIB load)<td>PM
<tr><td>Profile management<td>PM
<tr><td>Server management<td>PM
<tr><td>System audit<td>PM
<tr><td>Agent Management<td>AW
<tr><td>Remote Agent Configuration Management <td>AW
<tr><td>Assigning alerts to agents<td>LW
<tr><td>Defining, altering and deleting alert templates, actions and commands<td>LM
<tr><td>Group Management<td>PM
<tr><td>Creating inventory modules<td>PM
<tr><td>Module Management (includes all suboptions)<td>PM
<tr><td>Massive Management Operations <td>AW
<tr><td>Creating agents<td>AW
<tr><td>Duplicating remote configurations<td>AW
<tr><td>Downtime Management<td>AW
<tr><td>Alert Management<td>LW
<tr><td>User Management<td>UM
<tr><td>SNMP Console Management (alerts and MIB loading)<td>PM
<tr><td>Profile Management<td>PM
<tr><td>Server Management<td>PM
<tr><td>System Audit<td>PM
<tr><td>Setup<td>PM
<tr><td>Database maintance<td>DM
<tr><td>Administrator extension menu<td>PM
<tr><td>Search bar<td>AR
<tr><td>Policy management<td>AW
<tr><td>Disable agent/module/alert<td>AD
<tr><td>Database Maintenance<td>DM
<tr><td>Administrator Extension Menu<td>PM
<tr><td>Search Bar<td>AR
<tr><td>Policy Management<td>AW
<tr><td>Disabling agents / modules / alerts<td>AD
<tr><td>Alerts validation<td>LM&AR or AW&LW
<tr><td>Network-map view<td>MR
<tr><td>Network-map edition<td>MW
<tr><td>Deletion of owned network-map<td>MW
<tr><td>Deletion of any network-map<td>MM
<tr><td>Visual console view<td>VR
<tr><td>Visual console edition<td>VW
<tr><td>Deletion of owned visual console<td>VW
<tr><td>Deletion of any visual console<td>VM
</table>

View File

@ -13,16 +13,16 @@
<br>
<table cellpadding=4 cellspacing=0 style='background-color: #f0f0f0; border: 1px solid #acacac'>
<tr><th style='background-color: #cacaca'>Operacion<Th style='background-color: #cacaca'>Bit de acceso
<table cellpadding=4 cellspacing=0 style='background-color: #f0f0f0;'>
<tr><th style='background-color: #cacaca'>Operación<th style='background-color: #cacaca'>Bit de acceso
<tr><td>Ver datos agente (todas las vistas) <td>AR
<tr><td>Vista táctica <td>AR
<tr><td>Vista mapas de red <td>AR
<tr><td>Vista de grupos <td>AR
<tr><td>Crear un visual console <td>RW
<tr><td>Crear un informe <td>RW
<tr><td>Crear una grafica combinada <td>RW
<tr><td>Ver informe, mapa, grafica, etc <td>RR
<tr><td>Crear una gráfica combinada <td>RW
<tr><td>Ver informe, gráfica, etc <td>RR
<tr><td>Aplicar una plantilla de informe<td>RR
<tr><td>Crear una plantilla de informe<td>RM
<tr><td>Crear incidente <td>IW
@ -34,7 +34,7 @@
<tr><td>Validar/Comentar evento <td>EW
<tr><td>Borrar evento <td>EM
<tr><td>Ejecutar respuestas<td>EW
<tr><td>Crear incidencia a traves del evento (Respuesta) <td>EW&IW
<tr><td>Crear incidencia a través del evento (Respuesta) <td>EW&IW
<tr><td>Gestionar respuestas<td>PM
<tr><td>Gestionar filtros<td>EW
<tr><td>Personalizar columnas de eventos<td>PM
@ -47,13 +47,13 @@
<tr><td>Tree view <td>AR
<tr><td>Update manager (Operación y Administración) <td>PM
<tr><td>Extension Module Group<td>AR
<tr><td>Vista de gestion agente <td>AW
<tr><td>Vista de gestión agente <td>AW
<tr><td>Edición del agente y de su .conf <td>AW
<tr><td>Asignación de alertas ya creadas <td>LW
<tr><td>Definir, modificar plantillas, comandos y acciones <td>LM
<tr><td>Gestión de grupos <td>PM
<tr><td>Crear modulos de inventario <td>PM
<tr><td>Gestionar modulos (Incluidas todas las subopciones)<td>PM
<tr><td>Crear módulos de inventario <td>PM
<tr><td>Gestionar módulos (Incluidas todas las subopciones)<td>PM
<tr><td>Operaciones masivas <td>AW
<tr><td>Crear agente <td>AW
<tr><td>Duplicar configuración remota<td>AW
@ -63,13 +63,18 @@
<tr><td>Gestión de consola SNMP<td>PM
<tr><td>Gestión de perfiles<td>PM
<tr><td>Gestión de servidores<td>PM
<tr><td>Auditoría del sistema (edicion y visualizacion)<td>PM
<tr><td>Auditoría del sistema (edición y visualización)<td>PM
<tr><td>Setup (todas las solapas inferiores incl) <td>PM
<tr><td>Mantenimiento de la BBDD <td>DM
<tr><td>Extensiones administracion <td>PM
<tr><td>Barra busqueda <td>AR
<tr><td>Extensiones administración <td>PM
<tr><td>Barra búsqueda <td>AR
<tr><td>Gestión de Políticas<td>AW
<tr><td>Desactivar agente/módulo/alerta<td>AD
<tr><td>Validar alertas<td>LM&AR o AW&LW
<tr><td>Vista de mapas de red<td>MR
<tr><td>Edición de mapas de red<td>MW
<tr><td>Borrado de mapas de red propios<td>MW
<tr><td>Borrado de cualquier mapa de red<td>MM
</table>

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '6.0dev';
$build = '150408';
$build = '150413';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -16,12 +16,16 @@ require_once ('../include/functions_visual_map.php');
class Visualmap {
private $correct_acl = false;
private $acl = "RR";
private $acl = "VR";
private $id = 0;
private $visual_map = null;
private $visualmap = null;
function __construct() {
}
private function checkVisualmapACL($groupID = 0) {
$system = System::getInstance();
if ($system->checkACL($this->acl)) {
@ -39,17 +43,21 @@ class Visualmap {
}
public function show() {
$this->getFilters();
$this->visualmap = db_get_row('tlayout',
'id', $this->id);
if (empty($this->visualmap)) {
$this->show_fail_acl();
}
$this->checkVisualmapACL($this->visualmap['id_group']);
if (!$this->correct_acl) {
$this->show_fail_acl();
}
else {
$this->getFilters();
$this->visualmap = db_get_row('tlayout',
'id', $this->id);
$this->show_visualmap();
}
$this->show_visualmap();
}
private function show_fail_acl() {

View File

@ -18,7 +18,7 @@ ob_get_clean(); //Fixed unused javascript code.
class Visualmaps {
private $correct_acl = false;
private $acl = "RR";
private $acl = "VR";
private $default = true;
private $default_filters = array();

View File

@ -19,7 +19,34 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], $store_group, "AR")) {
// Networkmap id required
if (!isset($id_networkmap)) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
require ("general/noaccess.php");
exit;
}
// Get the group for ACL
if (!isset($store_group)) {
$store_group = db_get_value("store_group", "tnetwork_map", "id_networkmap", $id_networkmap);
if ($store_group === false) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
}
// ACL for the networkmap permission
if (!isset($networkmap_read))
$networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
if (!isset($networkmap_write))
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
if (!isset($networkmap_manage))
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
include ("general/noaccess.php");

View File

@ -19,7 +19,34 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], $store_group, "AR")) {
// Networkmap id required
if (!isset($id_networkmap)) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
require ("general/noaccess.php");
exit;
}
// Get the group for ACL
if (!isset($store_group)) {
$store_group = db_get_value("store_group", "tnetwork_map", "id_networkmap", $id_networkmap);
if ($store_group === false) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
}
// ACL for the networkmap permission
if (!isset($networkmap_read))
$networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
if (!isset($networkmap_write))
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
if (!isset($networkmap_manage))
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
include ("general/noaccess.php");

View File

@ -19,13 +19,6 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "AR")) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
include ("general/noaccess.php");
exit;
}
require_once ('include/functions_networkmap.php');
require_once ('include/functions_clippy.php');
@ -42,16 +35,54 @@ $update_networkmap = get_parameter ('update_networkmap', 0);
$recenter_networkmap = get_parameter ('recenter_networkmap', 0);
$hidden_options = get_parameter ('hidden_options', 1);
if ($delete_networkmap) {
$result = networkmap_delete_networkmap($id_networkmap);
$message = ui_print_result_message ($result,
__('Network map deleted successfully'),
__('Could not delete network map'), '', true);
// ACL checks //
// New networkmap.
if ($add_networkmap) {
// ACL for the new network map
// $networkmap_read = check_acl ($config['id_user'], 0, "MR");
$networkmap_write = check_acl ($config['id_user'], 0, "MW");
$networkmap_manage = check_acl ($config['id_user'], 0, "MM");
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
}
// The networkmap exist. Should have id and store goup.
else {
// Networkmap id required
if (empty($id_networkmap)) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
require ("general/noaccess.php");
exit;
}
// Get the group for ACL
$store_group = db_get_value("store_group", "tnetwork_map", "id_networkmap", $id_networkmap);
if ($store_group === false) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
$id_networkmap = 0;
// ACL for the general permission
$networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
include ("general/noaccess.php");
exit;
}
}
// Create
if ($add_networkmap) {
// Load variables
$layout = 'radial';
@ -100,81 +131,126 @@ if ($add_networkmap) {
'l2_network' => $l2_network
);
$id_networkmap = networkmap_create_networkmap($values);
$message = ui_print_result_message ($id_networkmap,
__('Network map created successfully'),
__('Could not create network map'), '', true);
}
if ($save_networkmap || $update_networkmap) {
// Load variables
$layout = (string) get_parameter ('layout', 'radial');
$depth = (string) get_parameter ('depth', 'all');
$nooverlap = (bool) get_parameter ('nooverlap', 0);
$modwithalerts = (int) get_parameter ('modwithalerts', 0);
$hidepolicymodules = (int) get_parameter ('hidepolicymodules', 0);
$zoom = (float) get_parameter ('zoom', 1);
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
$regen = (int) get_parameter ('regen', 0);
$show_snmp_modules = (int) get_parameter ('show_snmp_modules', 0);
$font_size = (int) get_parameter ('font_size', 12);
$text_filter = get_parameter ('text_filter', '');
$dont_show_subgroups = (bool)get_parameter ('dont_show_subgroups', 0);
$store_group = (int) get_parameter ('store_group', 0);
$group = (int) get_parameter ('group', 0);
$module_group = (int) get_parameter ('module_group', 0);
$center = (int) get_parameter ('center', 0);
$name = (string) get_parameter ('name', $activeTab);
$l2_network = (int) get_parameter ('l2_network', 0);
if ($save_networkmap) {
$result = networkmap_update_networkmap($id_networkmap,
array('name' => $name,
'type' => $activeTab,
'layout' => $layout,
'nooverlap' => $nooverlap,
'simple' => $simple,
'regenerate' => $regen,
'font_size' => $font_size,
'store_group' => $store_group,
'id_group' => $group,
'id_module_group' => $module_group,
'depth' => $depth,
'only_modules_with_alerts' => $modwithalerts,
'hide_policy_modules' => $hidepolicymodules,
'zoom' => $zoom,
'distance_nodes' => $ranksep,
'text_filter' => $text_filter,
'dont_show_subgroups' => $dont_show_subgroups,
'center' => $center,
'show_snmp_modules' => (int)$show_snmp_modules,
'l2_network' => (int)$l2_network));
// Exit when the networkmap was not created
if ($id_networkmap === false) {
return;
}
}
// Action in existing networkmap
else if ($delete_networkmap || $save_networkmap || $update_networkmap) {
// ACL for the network map
// if (!isset($networkmap_read))
// $networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
if (!isset($networkmap_write))
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
if (!isset($networkmap_manage))
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
// Actions //
// Not used now. The new behaviour is delete the map posting to the list.
if ($delete_networkmap) {
$result = networkmap_delete_networkmap($id_networkmap);
$message = ui_print_result_message ($result,
__('Network map saved successfully'),
__('Could not save network map'), '', true);
__('Network map deleted successfully'),
__('Could not delete network map'), '', true);
return;
}
}
$networkmaps = networkmap_get_networkmaps('','', true, $strict_user);
$nomaps = false;
if ($networkmaps === false) {
$nomaps = true;
}
// If the map id is not defined, we set the first id of the active type
if (!$nomaps && $id_networkmap == 0) {
$networkmaps_of_type = networkmap_get_networkmaps('', $activeTab);
if ($networkmaps_of_type !== false) {
$id_networkmap = reset(array_keys($networkmaps_of_type));
}
}
if (!$update_networkmap && !$save_networkmap && $id_networkmap != 0) {
$networkmap_data = networkmap_get_networkmap($id_networkmap);
// Save updates the db data, update only updates the view.
if ($save_networkmap || $update_networkmap) {
// Load variables
$layout = (string) get_parameter ('layout', 'radial');
$depth = (string) get_parameter ('depth', 'all');
$nooverlap = (bool) get_parameter ('nooverlap', 0);
$modwithalerts = (int) get_parameter ('modwithalerts', 0);
$hidepolicymodules = (int) get_parameter ('hidepolicymodules', 0);
$zoom = (float) get_parameter ('zoom', 1);
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
$regen = (int) get_parameter ('regen', 0);
$show_snmp_modules = (int) get_parameter ('show_snmp_modules', 0);
$font_size = (int) get_parameter ('font_size', 12);
$text_filter = get_parameter ('text_filter', '');
$dont_show_subgroups = (bool)get_parameter ('dont_show_subgroups', 0);
$store_group = (int) get_parameter ('store_group', 0);
$group = (int) get_parameter ('group', 0);
$module_group = (int) get_parameter ('module_group', 0);
$center = (int) get_parameter ('center', 0);
$name = (string) get_parameter ('name', $activeTab);
$l2_network = (int) get_parameter ('l2_network', 0);
if ($save_networkmap) {
// ACL for the new network map
$networkmap_read_new = check_acl ($config['id_user'], $store_group, "MR");
$networkmap_write_new = check_acl ($config['id_user'], $store_group, "MW");
$networkmap_manage_new = check_acl ($config['id_user'], $store_group, "MM");
if (!$networkmap_write_new && !$networkmap_manage_new) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
$result = networkmap_update_networkmap($id_networkmap,
array('name' => $name,
'type' => $activeTab,
'layout' => $layout,
'nooverlap' => $nooverlap,
'simple' => $simple,
'regenerate' => $regen,
'font_size' => $font_size,
'store_group' => $store_group,
'id_group' => $group,
'id_module_group' => $module_group,
'depth' => $depth,
'only_modules_with_alerts' => $modwithalerts,
'hide_policy_modules' => $hidepolicymodules,
'zoom' => $zoom,
'distance_nodes' => $ranksep,
'text_filter' => $text_filter,
'dont_show_subgroups' => $dont_show_subgroups,
'center' => $center,
'show_snmp_modules' => (int)$show_snmp_modules,
'l2_network' => (int)$l2_network));
$message = ui_print_result_message ($result,
__('Network map saved successfully'),
__('Could not save network map'), '', true);
if ($result) {
// Save the new ACL permisison
$networkmap_read = $networkmap_read_new;
$networkmap_write = $networkmap_write_new;
$networkmap_manage = $networkmap_manage_new;
}
}
}
}
if (!$update_networkmap && !$save_networkmap) {
$networkmap_data = networkmap_get_networkmap($id_networkmap);
if (empty($networkmap_data)) {
ui_print_error_message(__('There was an error loading the network map'));
return;
}
// Load variables
$layout = $networkmap_data['layout'];
$depth = $networkmap_data['depth'];
$nooverlap = (bool)$networkmap_data['nooverlap'];
@ -202,107 +278,128 @@ if ($recenter_networkmap) {
}
/* Main code */
$qs = http_build_query(array(
"sec" => "network",
"sec2" => "operation/agentes/networkmap_list"
));
$href = "index.php?$qs";
$buttons['list'] = array('active' => false, 'text' => "<a href=\"$href\">" .
html_print_image("images/list.png", true, array ("title" => __('List'))) ."</a>");
if ($pure == 1) {
$buttons['screen'] = array('active' => false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab='.$activeTab.'">' .
html_print_image("images/normal_screen.png", true, array ('title' => __('Normal screen'))) .'</a>');
$qs = http_build_query(array(
"sec" => "network",
"sec2" => "operation/agentes/networkmap",
"id_networkmap" => $id_networkmap,
"tab" => $activeTab
));
$href = "index.php?$qs";
$buttons['screen'] = array('active' => false, 'text' => "<a href=\"$href\">" .
html_print_image("images/normal_screen.png", true, array ('title' => __('Normal screen'))) ."</a>");
}
else {
$buttons['screen'] = array('active' => false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;pure=1&amp;tab='.$activeTab.'">' .
html_print_image("images/full_screen.png", true, array ('title' => __('Full screen'))) .'</a>');
}
if (($config['enterprise_installed']) && (!$strict_user)) {
$buttons['policies'] = array('active' => $activeTab == 'policies',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=policies&amp;pure='.$pure.'">' .
html_print_image("images/policies_mc.png", true, array ("title" => __('Policies view'))) .'</a>');
}
$buttons['groups'] = array('active' => $activeTab == 'groups',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=groups&amp;pure='.$pure.'">' .
html_print_image("images/group.png", true, array ("title" => __('Groups view'))) .'</a>');
$buttons['topology'] = array('active' => $activeTab == 'topology',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=topology&amp;pure='.$pure.'">' .
html_print_image("images/op_network.png", true, array ("title" => __('Topology view'))) .'</a>');
$buttons['dinamic'] = array('active' => $activeTab == 'dinamic',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=dinamic&amp;pure='.$pure.'">' .
html_print_image("images/dynamic_network_icon.png", true, array ("title" => __('Dynamic view'))) .'</a>');
if (!$strict_user) {
$buttons['radial_dinamic'] = array('active' => $activeTab == 'radial_dynamic',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=radial_dynamic&amp;pure='.$pure.'">' .
html_print_image("images/radial_dynamic_network_icon.png", true, array ("title" => __('Radial dynamic view'))) .'</a>');
}
$combolist = '<form name="query_sel" method="post" action="index.php?sec=network&sec2=operation/agentes/networkmap">';
$combolist .= html_print_select($networkmaps, 'id_networkmap', $id_networkmap, 'onchange:this.form.submit()', __('No selected'), 0, true, false, false, '', false, 'margin-top:4px; margin-left:3px; width:150px;');
$combolist .= html_print_input_hidden('hidden_options',$hidden_options, true);
$combolist .= '</form>';
$buttons['combolist'] = $combolist;
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$buttons['addmap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;add_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/add_mc.png", true, array ("title" => __('Add map'))) .'</a>');
$qs = http_build_query(array(
"sec" => "network",
"sec2" => "operation/agentes/networkmap",
"id_networkmap" => $id_networkmap,
"tab" => $activeTab,
"pure" => 1
));
$href = "index.php?$qs";
if (!$nomaps && $id_networkmap != 0) {
$buttons['deletemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;delete_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/delete_mc.png", true, array ("title" => __('Delete map'))) .'</a>');
$buttons['savemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;' .
'sec2=operation/agentes/networkmap&amp;' .
'id_networkmap=' . $id_networkmap . '&amp;' .
'save_networkmap=1&amp;' .
'tab=' . $activeTab . '&amp;' .
'save_networkmap=1&amp;' .
'name=' . $name . '&amp;' .
'store_group=' . $store_group . '&amp;' .
'group=' . $group . '&amp;' .
'layout=' . $layout . '&amp;' .
'nooverlap=' . $nooverlap . '&amp;' .
'simple=' . $simple . '&amp;' .
'regen=' . $regen . '&amp;' .
'zoom=' . $zoom . '&amp;' .
'ranksep=' . $ranksep . '&amp;' .
'font_size=' . $font_size . '&amp;' .
'depth=' . $depth . '&amp;' .
'modwithalerts=' . $modwithalerts . '&amp;' .
'text_filter=' . $text_filter . '&amp;' .
'dont_show_subgroups=' . $dont_show_subgroups . '&amp;' .
'hidepolicymodules=' . $hidepolicymodules . '&amp;' .
'module_group=' . $module_group . '&amp;' .
'pure=' . $pure . '&amp;' .
'hidden_options=' . (int)$hidden_options . '&amp;' .
'show_snmp_modules=' . (int)$show_snmp_modules . '&amp;' .
'l2_network=' . (int)$l2_network . '">' .
html_print_image("images/save_mc.png", true, array ("title" => __('Save map'))) .'</a>');
}
$buttons['screen'] = array('active' => false, 'text' => "<a href=\"$href\">" .
html_print_image("images/full_screen.png", true, array ('title' => __('Full screen'))) ."</a>");
}
if ($networkmap_write || $networkmap_manage) {
$qs = http_build_query(array(
"sec" => "network",
"sec2" => "operation/agentes/networkmap_list",
"id_networkmap" => $id_networkmap,
"delete_networkmap" => 1
));
$href = "index.php?$qs";
$buttons['deletemap'] = array('active' => false, 'text' => "<a href=\"$href\">" .
html_print_image("images/delete_mc.png", true, array ("title" => __('Delete map'))) ."</a>");
$qs = http_build_query(array(
"sec" => "network",
"sec2" => "operation/agentes/networkmap",
"id_networkmap" => $id_networkmap,
"save_networkmap" => 1,
"tab" => $activeTab,
"name" => $name,
"store_group" => $store_group,
"group" => $group,
"layout" => $layout,
"nooverlap" => $nooverlap,
"simple" => $simple,
"regen" => $regen,
"zoom" => $zoom,
"ranksep" => $$ranksep,
"font_size" => $font_size,
"depth" => $depth,
"modwithalerts" => $modwithalerts,
"text_filter" => $text_filter,
"dont_show_subgroups" => $dont_show_subgroups,
"hidepolicymodules" => $hidepolicymodules,
"module_group" => $module_group,
"hidden_options" => (int)$hidden_options,
"show_snmp_modules" => (int)$show_snmp_modules,
"l2_network" => (int)$l2_network,
"pure" => $pure
));
$href = "index.php?$qs";
$buttons['savemap'] = array('active' => false, 'text' => "<a href=\"$href\">" .
html_print_image("images/save_mc.png", true, array ("title" => __('Save map'))) .'</a>');
}
// Disabled. It's a waste of resources to check the ACL of every networkmap
// for only provide a shorthand feature.
// $combolist = '<form name="query_sel" method="post" action="index.php?sec=network&sec2=operation/agentes/networkmap">';
// $networkmaps = networkmap_get_networkmaps('','', true, $strict_user);
// if (empty($networkmaps))
// $networkmaps = array();
// $combolist .= html_print_select($networkmaps, 'id_networkmap', $id_networkmap,
// 'onchange:this.form.submit()', '', 0, true, false, false,
// '', false, 'margin-top:4px; margin-left:3px; width:150px;');
// $combolist .= html_print_input_hidden('hidden_options',$hidden_options, true);
// $combolist .= '</form>';
// $buttons['combolist'] = $combolist;
$title = '';
$icon = "images/op_network.png";
switch ($activeTab) {
case 'topology':
$title = __('Topology view');
$icon = "images/op_network.png";
break;
case 'groups':
$title = __('Groups view');
$icon = "images/group.png";
break;
case 'policies':
$title = __('Policies view');
$icon = "images/policies_mc.png";
break;
case 'dinamic':
$title = __('Dynamic view');
$icon = "images/dynamic_network_icon.png";
break;
case 'radial_dinamic':
case 'radial_dynamic':
$title = __('Radial dynamic view');
$icon = "images/radial_dynamic_network_icon.png";
break;
}
@ -311,7 +408,7 @@ if (!empty($name)) {
}
ui_print_page_header (__('Network map') . " - " . $title,
"images/op_network.png", false, "network_map", false, $buttons);
$icon, false, "network_map", false, $buttons);
if ((tags_has_user_acl_tags()) && (!$strict_user)) {
ui_print_tags_warning();
@ -321,12 +418,6 @@ if ($delete_networkmap || $add_networkmap || $save_networkmap) {
echo $message;
}
if ($id_networkmap == 0) {
echo "<div class='nf'>" .
__('There are no defined maps in this view') . "</div>";
return;
}
// CONFIGURATION FORM
echo "<br>";
@ -498,24 +589,22 @@ $options_form .= '</form>';
ui_toggle($options_form, __('Map options'), '', $hidden_options);
if ($id_networkmap != 0) {
switch ($activeTab) {
case 'groups':
require_once('operation/agentes/networkmap.groups.php');
break;
case 'policies':
require_once(ENTERPRISE_DIR . '/operation/policies/networkmap.policies.php');
break;
case 'dinamic':
require_once('operation/agentes/networkmap.dinamic.php');
break;
case 'radial_dynamic':
require_once('operation/agentes/networkmap.dinamic.php');
break;
default:
case 'topology':
require_once('operation/agentes/networkmap.topology.php');
break;
}
switch ($activeTab) {
case 'groups':
require_once('operation/agentes/networkmap.groups.php');
break;
case 'policies':
require_once(ENTERPRISE_DIR . '/operation/policies/networkmap.policies.php');
break;
case 'dinamic':
require_once('operation/agentes/networkmap.dinamic.php');
break;
case 'radial_dynamic':
require_once('operation/agentes/networkmap.dinamic.php');
break;
default:
case 'topology':
require_once('operation/agentes/networkmap.topology.php');
break;
}
?>

View File

@ -19,7 +19,34 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], $store_group, "AR")) {
// Networkmap id required
if (!isset($id_networkmap)) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
require ("general/noaccess.php");
exit;
}
// Get the group for ACL
if (!isset($store_group)) {
$store_group = db_get_value("store_group", "tnetwork_map", "id_networkmap", $id_networkmap);
if ($store_group === false) {
db_pandora_audit("ACL Violation",
"Trying to accessnode graph builder");
require ("general/noaccess.php");
exit;
}
}
// ACL for the networkmap permission
if (!isset($networkmap_read))
$networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
if (!isset($networkmap_write))
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
if (!isset($networkmap_manage))
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit("ACL Violation",
"Trying to access node graph builder");
include ("general/noaccess.php");

View File

@ -19,7 +19,12 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "AR")) {
// ACL for the general permission
$networkmaps_read = check_acl ($config['id_user'], 0, "MR");
$networkmaps_write = check_acl ($config['id_user'], 0, "MW");
$networkmaps_manage = check_acl ($config['id_user'], 0, "MM");
if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
db_pandora_audit("ACL Violation",
"Trying to access Networkmap builder");
if (is_ajax()) {
@ -45,10 +50,15 @@ if (is_ajax()) {
foreach ($ids_networkmap as $id) {
$store_group = (int) db_get_value('store_group', 'tnetwork_map', 'id_networkmap',$id_networkmap);
if (check_acl ($config['id_user'], $store_group, "RM")) {
// ACL
// $networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if ($networkmap_manage) {
$results[$id] = (bool) networkmap_delete_networkmap($id);
}
else if (check_acl ($config['id_user'], $store_group, "RW")) {
else if ($networkmap_write) {
$results[$id] = (bool) networkmap_delete_user_networkmap($config['id_user'], $id);
}
}
@ -74,12 +84,16 @@ $id_networkmap = get_parameter ('id_networkmap', 0);
$delete_networkmap = get_parameter ('delete_networkmap', 0);
if ($delete_networkmap) {
if (is_user_admin ($config['id_user'])){
// ACL
// $networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
if ($networkmap_manage || is_user_admin ($config['id_user'])) {
$result = networkmap_delete_networkmap($id_networkmap);
}
elseif (check_acl ($config['id_user'], 0, "RM")) {
$result = networkmap_delete_networkmap($id_networkmap);
}elseif (check_acl ($config['id_user'], 0, "RW")) {
else if ($networkmap_write) {
$result = networkmap_delete_user_networkmap($config['id_user'], $id_networkmap);
}
$message = ui_print_result_message ($result,
@ -138,14 +152,13 @@ $table->style[1] = 'text-align: center;';
$table->style[2] = 'text-align: center;';
$table->style[3] = 'text-align: center;';
$table->style[4] = 'text-align: center;';
$table->style[5] = 'text-align: center;';
$table->size = array();
$table->size[0] = '80%';
$table->size[1] = '60px';
$table->size[2] = '30px';
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
if ($networkmaps_write || $networkmaps_manage) {
$table->size[3] = '30px';
$table->size[4] = '30px';
}
@ -154,11 +167,10 @@ $table->head = array();
$table->head[0] = __('Name');
$table->head[1] = __('Type');
$table->head[2] = __('Group');
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
$table->head[3] = __('Edit');
$table->head[4] = __('Delete');
if ($networkmaps_write || $networkmaps_manage) {
$table->head[3] = __('Delete');
// Checkbox to select all the another checkboxes
$table->head[5] = html_print_checkbox('check_delete_all', 0, false, true);
$table->head[4] = html_print_checkbox('check_delete_all', 0, false, true);
}
$id_groups = array_keys(users_get_groups());
@ -187,32 +199,32 @@ else {
$table->data = array();
foreach ($network_maps as $network_map) {
// ACL
if (!check_acl ($config['id_user'], $network_map['store_group'], "RR"))
$networkmap_read = check_acl ($config['id_user'], $store_group, "MR");
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
// ACL
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage)
continue;
// If enterprise not loaded then skip this code
if ($network_map['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
if ($network_map['type'] == 'policies' && !defined('PANDORA_ENTERPRISE'))
continue;
if (($network_map['type'] == 'radial_dynamic' || $network_map['type'] == 'policies') && ($strict_user)) {
if (($network_map['type'] == 'radial_dynamic' || $network_map['type'] == 'policies') && $strict_user) {
continue;
}
$data = array();
$data[0] = '<b><a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=view&id_networkmap=' . $network_map['id_networkmap'] . '">' . $network_map['name'] . '</a></b>';
$data[0] = '<b><a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=' . $network_map['type']
. '&id_networkmap=' . $network_map['id_networkmap'] . '">' . $network_map['name'] . '</a></b>';
$data[1] = $network_map['type'];
$data[2] = ui_print_group_icon ($network_map['store_group'], true);
if (check_acl ($config['id_user'], $network_map['store_group'], "RW") || check_acl ($config['id_user'], $network_map['store_group'], "RM")) {
$data[3] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=edit&edit_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Config') . '">' . html_print_image("images/config.png", true) . '</a>';
$data[4] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap_list&delete_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Delete') . '" onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
if ($networkmap_write || $networkmap_manage) {
$data[3] = '<a href="index.php?sec=network&sec2=operation/agentes/networkmap_list&delete_networkmap=1&id_networkmap=' . $network_map['id_networkmap'] . '" alt="' . __('Delete') . '" onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
// The value of the checkbox will be the networkmap id to recover it in js to perform the massive deletion
$data[5] = html_print_checkbox('check_delete', $network_map['id_networkmap'], false, true);
}
else {
$data[3] = '';
$data[4] = '';
$data[5] = '';
$data[4] = html_print_checkbox('check_delete', $network_map['id_networkmap'], false, true);
}
$table->data[] = $data;
@ -222,7 +234,7 @@ else {
}
// Create networkmap form
if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0, "RM")) {
if ($networkmaps_write || $networkmaps_manage) {
$table_manage = new StdClass();
$table_manage->width = "100%";
$table_manage->style = array();

View File

@ -74,7 +74,12 @@ $bheight = $layout["height"];
$pure_url = "&pure=" . $config["pure"];
if (! check_acl ($config["id_user"], $id_group, "RR")) {
// ACL
$vconsole_read = check_acl ($config["id_user"], $id_group, "VR");
$vconsole_write = check_acl ($config["id_user"], $id_group, "VW");
$vconsole_manage = check_acl ($config["id_user"], $id_group, "VM");
if (! $vconsole_read) {
db_pandora_audit("ACL Violation",
"Trying to access visual console without group access");
require ("general/noaccess.php");
@ -89,7 +94,7 @@ $options['consoles_list']['text'] =
html_print_image ("images/visual_console.png", true,
array ("title" => __('Visual consoles list'))) . '</a>';
if (check_acl ($config["id_user"], $id_group, "RW")) {
if ($vconsole_write || $vconsole_manage) {
$url_base = 'index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&action=';
$hash = md5($config["dbpass"] . $id_layout . $config["id_user"]);
@ -123,7 +128,7 @@ if (check_acl ($config["id_user"], $id_group, "RW")) {
$options['view']['text'] = '<a href="index.php?sec=reporting&sec2=operation/visual_console/render_view&id=' . $id_layout . '&refr=' . $view_refresh . '">' . html_print_image ("images/operation.png", true, array ("title" => __('View'))) .'</a>';
$options['view']['active'] = true;
if (!defined('METACONSOLE')) {
if (! defined('METACONSOLE')) {
if ($config["pure"] == 0) {
$options['pure']['text'] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.((int)get_parameter('refr', 0)).'&amp;pure=1">' . html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode')))
. "</a>";
@ -138,18 +143,15 @@ if (!defined('METACONSOLE')) {
$options = array('view' => $options['view'], 'pure' => $options['pure']);
}
$options['pure']['active'] = false;
}
//Set the hidden value for the javascript
if (defined('METACONSOLE')) {
html_print_input_hidden('metaconsole', 1);
}
else {
//Set the hidden value for the javascript
html_print_input_hidden('metaconsole', 0);
ui_print_page_header ($layout_name, "images/visual_console.png", false, '', false, $options);
}
else {
//Set the hidden value for the javascript
html_print_input_hidden('metaconsole', 1);
}
visual_map_print_visual_map ($id_layout);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150408
%define release 150413
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150408
%define release 150413
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','6.0dev'),
('db_scheme_build','PD150408'),
('db_scheme_build','PD150413'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150408
Version: 6.0dev-150413
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150408"
pandora_version="6.0dev-150413"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0dev";
my $pandora_build = "150408";
my $pandora_build = "150413";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150408
%define release 150413
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150408
%define release 150413
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "6.0dev PS150408";
my $version = "6.0dev PS150413";
# Pandora server configuration
my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "6.0dev PS150408";
my $version = "6.0dev PS150413";
# save program name for logging
my $progname = basename($0);