2010-09-23 14:34:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// Global variables
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
check_login ();
|
|
|
|
|
|
|
|
if (! give_acl ($config['id_user'], 0, "PM")) {
|
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/admin_access_logs.php: added hooks to enterprise code, and added
new filter with more options.
* include/functions_db.php: erase the deprecated function "audit_db", and
added in function "pandora_audit" two new parameters $user_id, $ip for
pass this values when it are differents to the default values. Finally
replaced the depecrated "audit_db" for "pandora_audit".
* include/functions_events.php, include/functions_filemanager.php,
include/ajax/reporting.ajax.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/alert_list.ajax.php, include/help/es/modu_group_list.php,
include/functions_incidents.php, index.php, extensions/agents_modules.php,
extensions/insert_data.php, extensions/system_info.php,
extensions/dbmanager.php, extensions/update_manager/settings.php,
extensions/pandora_logs.php, extensions/plugin_registration.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/incidents/incident_statistics.php, operation/extensions.php,
operation/visual_console/render_view.php,
operation/agentes/status_monitor.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php, operation/agentes/alerts_status.php,
operation/agentes/estado_generalagente.php,
operation/agentes/custom_fields.php, operation/agentes/estado_agente.php,
operation/agentes/networkmap.topology.php,
operation/agentes/networkmap.groups.php, operation/agentes/sla_view.php,
operation/agentes/gis_view.php, operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/graphs.php,
operation/agentes/agent_fields.php, operation/agentes/tactical.php,
operation/agentes/group_view.php, operation/agentes/networkmap.php,
operation/servers/view_server.php,operation/servers/view_server_detail.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/render_view.php, operation/events/event_statistics.php,
operation/events/sound_events.php, operation/events/events_validate.php,
operation/events/events_list.php, operation/events/events_marquee.php,
operation/events/events.php, operation/reporting/reporting_xml.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
mobile/operation/agents/view_agents.php, mobile/index.php,
godmode/groups/modu_group_list.php, godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php, godmode/groups/group_list.php,
godmode/extensions.php, godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php, godmode/db/db_info.php,
godmode/db/db_event.php, godmode/db/db_purge.php,
godmode/agentes/fields_manager.php, godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php,
godmode/agentes/configure_field.php, godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_export.php, godmode/servers/recon_script.php,
godmode/servers/manage_export_form.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_commands.php, godmode/snmpconsole/snmp_alert.php,
godmode/snmpconsole/snmp_filters.php, godmode/setup/file_manager.php,
godmode/setup/os.list.php, godmode/setup/news.php,
godmode/setup/gis_step_2.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/setup/os.php,
godmode/setup/performance.php, godmode/setup/setup_auth.php,
godmode/setup/gis.php, godmode/setup/os.builder.php,
godmode/setup/setup_visuals.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/users/configure_profile.php,
godmode/gis_maps/configure_gis_map.php, godmode/gis_maps/index.php,
godmode/massive/massive_add_alerts.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_delete_agents.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/massive/massive_edit_agents.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_delete_alerts.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_components_form_common.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.preview.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/map_builder_wizard.php,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/graph_builder.php,
godmode/reporting/visual_console_builder.preview.php,
godmode/reporting/graph_builder.graph_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/graphs.php, godmode/reporting/graph_builder.preview.php:
Replaced the depecrated "audit_db" for "pandora_audit".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3467 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-10-27 12:47:07 +02:00
|
|
|
pandora_audit("ACL Violation",
|
2010-09-23 14:34:06 +02:00
|
|
|
"Trying to access Profile Management");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header
|
|
|
|
print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "", true);
|
|
|
|
|
|
|
|
$new_profile = (bool) get_parameter ('new_profile');
|
|
|
|
$create_profile = (bool) get_parameter ('create_profile');
|
|
|
|
$delete_profile = (bool) get_parameter ('delete_profile');
|
|
|
|
$update_profile = (bool) get_parameter ('update_profile');
|
|
|
|
$id_profile = (int) get_parameter ('id');
|
|
|
|
|
|
|
|
// Profile deletion
|
|
|
|
if ($delete_profile) {
|
|
|
|
// Delete profile
|
2010-10-27 18:02:53 +02:00
|
|
|
$profile = get_db_row('tperfil', 'id_perfil', $id_profile);
|
2010-09-23 14:34:06 +02:00
|
|
|
$sql = sprintf ('DELETE FROM tperfil WHERE id_perfil = %d', $id_profile);
|
|
|
|
$ret = process_sql ($sql);
|
|
|
|
if ($ret === false) {
|
|
|
|
echo '<h3 class="error">'.__('There was a problem deleting the profile').'</h3>';
|
2010-10-27 18:02:53 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
pandora_audit("Profile management",
|
|
|
|
"Delete profile ".safe_input($profile['name']));
|
|
|
|
|
2010-09-23 14:34:06 +02:00
|
|
|
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
|
|
|
|
echo '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list">« Back</a>';
|
|
|
|
}
|
|
|
|
|
|
|
|
//Delete profile from user data
|
|
|
|
$sql = sprintf ('DELETE FROM tusuario_perfil WHERE id_perfil = %d', $id_profile);
|
|
|
|
process_sql ($sql);
|
|
|
|
|
|
|
|
$id_profile = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update profile
|
|
|
|
if ($update_profile) {
|
|
|
|
$name = get_parameter ("name");
|
|
|
|
$incident_view = (bool) get_parameter ("incident_view");
|
|
|
|
$incident_edit = (bool) get_parameter ("incident_edit");
|
|
|
|
$incident_management = (bool) get_parameter ("incident_management");
|
|
|
|
$agent_view = (bool) get_parameter ("agent_view");
|
|
|
|
$agent_edit = (bool) get_parameter ("agent_edit");
|
|
|
|
$alert_edit = (bool) get_parameter ("alert_edit");
|
|
|
|
$user_management = (bool) get_parameter ("user_management");
|
|
|
|
$db_management = (bool) get_parameter ("db_management");
|
|
|
|
$alert_management = (bool) get_parameter ("alert_management");
|
|
|
|
$pandora_management = (bool) get_parameter ("pandora_management");
|
|
|
|
|
|
|
|
$sql = sprintf ('UPDATE tperfil SET
|
|
|
|
name = "%s", incident_view = %d, incident_edit = %d,
|
|
|
|
incident_management = %d, agent_view = %d, agent_edit = %d,
|
|
|
|
alert_edit = %d, user_management = %d, db_management = %d,
|
|
|
|
alert_management = %d, pandora_management = %d WHERE id_perfil = %d',
|
|
|
|
$name, $incident_view, $incident_edit, $incident_management,
|
|
|
|
$agent_view, $agent_edit, $alert_edit, $user_management,
|
|
|
|
$db_management, $alert_management, $pandora_management,
|
|
|
|
$id_profile);
|
|
|
|
$ret = process_sql ($sql);
|
|
|
|
if ($ret !== false) {
|
2010-10-27 18:02:53 +02:00
|
|
|
$info = 'Name: ' . $name . ' Incident view: ' . $incident_view .
|
|
|
|
' Incident edit: ' . $incident_edit . ' Incident management: ' . $incident_management .
|
|
|
|
' Agent view: ' . $agent_view . ' Agent edit: ' . $agent_edit .
|
|
|
|
' Alert edit: ' . $alert_edit . ' User management: ' . $user_management .
|
|
|
|
' DB management: ' . $db_management . ' Alert management: ' . $alert_management .
|
|
|
|
' Pandora Management: ' . $pandora_management;
|
|
|
|
pandora_audit("User management",
|
|
|
|
"Update profile ".safe_input($name), false, false, $info);
|
|
|
|
|
2010-09-23 14:34:06 +02:00
|
|
|
echo '<h3 class="suc">'.__('Successfully updated').'</h3>';
|
|
|
|
echo '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list">« Back</a>';
|
2010-10-27 18:02:53 +02:00
|
|
|
}
|
|
|
|
else {
|
2010-09-23 14:34:06 +02:00
|
|
|
echo '<h3 class="error"'.__('There was a problem updating this profile').'</h3>';
|
|
|
|
}
|
|
|
|
$id_profile = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create profile
|
|
|
|
if ($create_profile) {
|
|
|
|
$name = get_parameter ("name");
|
|
|
|
$incident_view = (bool) get_parameter ("incident_view");
|
|
|
|
$incident_edit = (bool) get_parameter ("incident_edit");
|
|
|
|
$incident_management = (bool) get_parameter ("incident_management");
|
|
|
|
$agent_view = (bool) get_parameter ("agent_view");
|
|
|
|
$agent_edit = (bool) get_parameter ("agent_edit");
|
|
|
|
$alert_edit = (bool) get_parameter ("alert_edit");
|
|
|
|
$user_management = (bool) get_parameter ("user_management");
|
|
|
|
$db_management = (bool) get_parameter ("db_management");
|
|
|
|
$alert_management = (bool) get_parameter ("alert_management");
|
|
|
|
$pandora_management = (bool) get_parameter ("pandora_management");
|
|
|
|
|
|
|
|
$sql = sprintf ('INSERT INTO tperfil
|
|
|
|
(name, incident_view, incident_edit, incident_management, agent_view,
|
|
|
|
agent_edit, alert_edit, user_management, db_management,
|
|
|
|
alert_management, pandora_management)
|
|
|
|
VALUES ("%s", %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)',
|
|
|
|
$name, $incident_view, $incident_edit, $incident_management,
|
|
|
|
$agent_view, $agent_edit, $alert_edit, $user_management,
|
|
|
|
$db_management, $alert_management, $pandora_management);
|
|
|
|
|
|
|
|
$ret = process_sql ($sql, 'insert_id');
|
|
|
|
if ($ret !== false) {
|
|
|
|
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
|
|
|
echo '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list">« Back</a>';
|
2010-10-27 18:02:53 +02:00
|
|
|
|
|
|
|
$info = 'Name: ' . $name . ' Incident view: ' . $incident_view .
|
|
|
|
' Incident edit: ' . $incident_edit . ' Incident management: ' . $incident_management .
|
|
|
|
' Agent view: ' . $agent_view . ' Agent edit: ' . $agent_edit .
|
|
|
|
' Alert edit: ' . $alert_edit . ' User management: ' . $user_management .
|
|
|
|
' DB management: ' . $db_management . ' Alert management: ' . $alert_management .
|
|
|
|
' Pandora Management: ' . $pandora_management;
|
|
|
|
pandora_audit("User management",
|
|
|
|
"Created profile ".safe_input($name), false, false, $info);
|
|
|
|
}
|
|
|
|
else {
|
2010-09-23 14:34:06 +02:00
|
|
|
echo '<h3 class="error">'.__('There was a problem creating this profile').'</h3>';
|
|
|
|
}
|
|
|
|
$id_profile = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edit profile
|
|
|
|
if ($id_profile || $new_profile) {
|
|
|
|
|
|
|
|
if ($new_profile) {
|
|
|
|
$name = '';
|
|
|
|
$incident_view = 0;
|
|
|
|
$incident_edit = 0;
|
|
|
|
$incident_management = 0;
|
|
|
|
$agent_view = 0;
|
|
|
|
$agent_edit = 0;
|
|
|
|
$alert_edit = 0;
|
|
|
|
$user_management = 0;
|
|
|
|
$db_management = 0;
|
|
|
|
$alert_management = 0;
|
|
|
|
$pandora_management = 0;
|
|
|
|
|
|
|
|
$page_title = __('Create profile');
|
2010-10-27 18:02:53 +02:00
|
|
|
}
|
|
|
|
else {
|
2010-09-23 14:34:06 +02:00
|
|
|
$profile = get_db_row ('tperfil', 'id_perfil', $id_profile);
|
|
|
|
|
|
|
|
if ($profile === false) {
|
|
|
|
echo '<h3 class="error">'.__('There was a problem loading profile').'</h3></table>';
|
|
|
|
include ("general/footer.php");
|
|
|
|
exit;
|
|
|
|
}
|
2010-10-27 18:02:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$id_audit = pandora_audit("User management",
|
|
|
|
"Edit profile ".safe_input($name));
|
|
|
|
enterprise_include_once('include/functions_audit.php');
|
|
|
|
$info = 'Name: ' . $name . ' Incident view: ' . $incident_view .
|
|
|
|
' Incident edit: ' . $incident_edit . ' Incident management: ' . $incident_management .
|
|
|
|
' Agent view: ' . $agent_view . ' Agent edit: ' . $agent_edit .
|
|
|
|
' Alert edit: ' . $alert_edit . ' User management: ' . $user_management .
|
|
|
|
' DB management: ' . $db_management . ' Alert management: ' . $alert_management .
|
|
|
|
' Pandora Management: ' . $pandora_management;
|
|
|
|
enterprise_hook('pandora_audit_enterprise', array($id_audit, $info));
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-23 14:34:06 +02:00
|
|
|
$name = $profile["name"];
|
|
|
|
$incident_view = (bool) $profile["incident_view"];
|
|
|
|
$incident_edit = (bool) $profile["incident_edit"];
|
|
|
|
$incident_management = (bool) $profile["incident_management"];
|
|
|
|
$agent_view = (bool) $profile["agent_view"];
|
|
|
|
$agent_edit = (bool) $profile["agent_edit"];
|
|
|
|
$alert_edit = (bool) $profile["alert_edit"];
|
|
|
|
$user_management = (bool) $profile["user_management"];
|
|
|
|
$db_management = (bool) $profile["db_management"];
|
|
|
|
$alert_management = (bool) $profile["alert_management"];
|
|
|
|
$pandora_management = (bool) $profile["pandora_management"];
|
|
|
|
|
|
|
|
$page_title = __('Update profile');
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->width = '400px';
|
|
|
|
$table->class = 'databox';
|
|
|
|
$table->size = array ();
|
|
|
|
$table->style = array ();
|
|
|
|
$table->style[0] = 'font-weight: bold';
|
|
|
|
$table->data = array ();
|
|
|
|
|
|
|
|
$table->data[0][0] = __('Profile name');
|
|
|
|
$table->data[0][1] = print_input_text ('name', $name, '', 30, 60, true);
|
|
|
|
$table->data[1][0] = __('View incidents');
|
|
|
|
$table->data[1][1] = print_checkbox ('incident_view', 1, $incident_view, true);
|
|
|
|
$table->data[2][0] = __('Edit incidents');
|
|
|
|
$table->data[2][1] = print_checkbox ('incident_edit', 1, $incident_edit, true);
|
|
|
|
$table->data[3][0] = __('Manage incidents');
|
|
|
|
$table->data[3][1] = print_checkbox ('incident_management', 1, $incident_management, true);
|
|
|
|
$table->data[4][0] = __('View agents');
|
|
|
|
$table->data[4][1] = print_checkbox ('agent_view', 1, $agent_view, true);
|
|
|
|
$table->data[5][0] = __('Edit agents');
|
|
|
|
$table->data[5][1] = print_checkbox ('agent_edit', 1, $agent_edit, true);
|
|
|
|
$table->data[6][0] = __('Edit alerts');
|
|
|
|
$table->data[6][1] = print_checkbox ('alert_edit', 1, $alert_edit, true);
|
|
|
|
$table->data[7][0] = __('Manage alerts');
|
|
|
|
$table->data[7][1] = print_checkbox ('alert_management', 1, $alert_management, true);
|
|
|
|
$table->data[8][0] = __('Manage users');
|
|
|
|
$table->data[8][1] = print_checkbox ('user_management', 1, $user_management, true);
|
|
|
|
$table->data[9][0] = __('Manage Database');
|
|
|
|
$table->data[9][1] = print_checkbox ('db_management', 1, $db_management, true);
|
|
|
|
$table->data[10][0] = __('Pandora management');
|
|
|
|
$table->data[10][1] = print_checkbox ('pandora_management', 1, $pandora_management, true);
|
|
|
|
|
2010-09-30 12:51:09 +02:00
|
|
|
echo '<form method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_profile">';
|
2010-09-23 14:34:06 +02:00
|
|
|
|
|
|
|
print_table ($table);
|
|
|
|
|
|
|
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
|
|
if ($new_profile) {
|
|
|
|
print_submit_button (__('Add'), "crt", false, 'class="sub wand"');
|
|
|
|
print_input_hidden ('create_profile', 1);
|
|
|
|
} else {
|
|
|
|
print_input_hidden ('id', $id_profile);
|
|
|
|
print_input_hidden ('update_profile', 1);
|
|
|
|
print_submit_button (__('Update'), "upd", false, 'class="sub upd"');
|
|
|
|
}
|
|
|
|
echo "</div></form>";
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|