mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php: now in the source code pick more info in the audit for actions to create, update and delete agent, and in other hand for the actions to create, update, duplicate and delete module. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3472 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
1d290a54b7
commit
0d5ef13ad7
@ -1,3 +1,10 @@
|
|||||||
|
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/modificar_agente.php,
|
||||||
|
godmode/agentes/configurar_agente.php: now in the source code pick more
|
||||||
|
info in the audit for actions to create, update and delete agent, and in
|
||||||
|
other hand for the actions to create, update, duplicate and delete module.
|
||||||
|
|
||||||
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
|
2010-10-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/agentes/configurar_agente.php,
|
* godmode/agentes/configurar_agente.php,
|
||||||
|
@ -172,8 +172,16 @@ if ($create_agent) {
|
|||||||
|
|
||||||
$agent_created_ok = true;
|
$agent_created_ok = true;
|
||||||
|
|
||||||
|
$info = 'Name: ' . $nombre_agente . ' IP: ' . $direccion_agente .
|
||||||
|
' Group: ' . $grupo . ' Interval: ' . $intervalo .
|
||||||
|
' Comments: ' . $comentarios . ' Mode: ' . $modo .
|
||||||
|
' ID_parent: ' . $id_parent . ' Server: ' . $server_name .
|
||||||
|
' ID os: ' . $id_os . ' Disabled: ' . $disabled .
|
||||||
|
' Custom ID: ' . $custom_id . ' Cascade protection: ' . $cascade_protection .
|
||||||
|
' Icon path: ' . $icon_path . ' Update GIS data: ' . $update_gis_data;
|
||||||
|
|
||||||
pandora_audit("Agent management",
|
pandora_audit("Agent management",
|
||||||
"Created agent $nombre_agente");
|
"Created agent $nombre_agente", false, false, $info);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$id_agente = 0;
|
$id_agente = 0;
|
||||||
@ -386,7 +394,8 @@ if ($update_agent) { // if modified some agent paramenter
|
|||||||
// Create custom field if not exist
|
// Create custom field if not exist
|
||||||
process_sql_insert ('tagent_custom_data',
|
process_sql_insert ('tagent_custom_data',
|
||||||
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
||||||
}else {
|
}
|
||||||
|
else {
|
||||||
process_sql_update ('tagent_custom_data',
|
process_sql_update ('tagent_custom_data',
|
||||||
array('description' => $value),
|
array('description' => $value),
|
||||||
array('id_field' => $key,'id_agent' => $id_agente));
|
array('id_field' => $key,'id_agent' => $id_agente));
|
||||||
@ -397,9 +406,11 @@ if ($update_agent) { // if modified some agent paramenter
|
|||||||
if ($nombre_agente == "") {
|
if ($nombre_agente == "") {
|
||||||
echo '<h3 class="error">'.__('No agent name specified').'</h3>';
|
echo '<h3 class="error">'.__('No agent name specified').'</h3>';
|
||||||
//If there is an agent with the same name, but a different ID
|
//If there is an agent with the same name, but a different ID
|
||||||
} elseif (get_agent_id ($nombre_agente) > 0 && get_agent_id ($nombre_agente) != $id_agente) {
|
}
|
||||||
|
elseif (get_agent_id ($nombre_agente) > 0 && get_agent_id ($nombre_agente) != $id_agente) {
|
||||||
echo '<h3 class="error">'.__('There is already an agent in the database with this name').'</h3>';
|
echo '<h3 class="error">'.__('There is already an agent in the database with this name').'</h3>';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
//If different IP is specified than previous, add the IP
|
//If different IP is specified than previous, add the IP
|
||||||
if ($direccion_agente != '' && $direccion_agente != get_agent_address ($id_agente))
|
if ($direccion_agente != '' && $direccion_agente != get_agent_address ($id_agente))
|
||||||
agent_add_address ($id_agente, $direccion_agente);
|
agent_add_address ($id_agente, $direccion_agente);
|
||||||
@ -429,11 +440,19 @@ if ($update_agent) { // if modified some agent paramenter
|
|||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
print_error_message (__('There was a problem updating the agent'));
|
print_error_message (__('There was a problem updating the agent'));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
$info = 'Group: ' . $grupo . ' Interval: ' . $intervalo .
|
||||||
|
' Comments: ' . $comentarios . ' Mode: ' . $modo .
|
||||||
|
' ID OS: ' . $id_os . ' Disabled: ' . $disabled .
|
||||||
|
' Server Name: ' . $server_name . ' ID parent: ' . $id_parent .
|
||||||
|
' Custom ID: ' . $custom_id . ' Cascade Protection: ' . $cascade_protection .
|
||||||
|
' Icon Path: ' . $icon_path . 'Update GIS data: ' .$update_gis_data;
|
||||||
|
|
||||||
enterprise_hook ('update_agent', array ($id_agente));
|
enterprise_hook ('update_agent', array ($id_agente));
|
||||||
print_success_message (__('Successfully updated'));
|
print_success_message (__('Successfully updated'));
|
||||||
pandora_audit("Agent management",
|
pandora_audit("Agent management",
|
||||||
"Updated agent $nombre_agente");
|
"Updated agent $nombre_agente", false, false, $info);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -574,8 +593,7 @@ if ($update_module || $create_module) {
|
|||||||
if ($update_module) {
|
if ($update_module) {
|
||||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||||
|
|
||||||
$result = update_agent_module ($id_agent_module,
|
$values = array ('descripcion' => $description,
|
||||||
array ('descripcion' => $description,
|
|
||||||
'id_module_group' => $id_module_group,
|
'id_module_group' => $id_module_group,
|
||||||
'nombre' => $name,
|
'nombre' => $name,
|
||||||
'max' => $max,
|
'max' => $max,
|
||||||
@ -608,12 +626,19 @@ if ($update_module) {
|
|||||||
'custom_string_3' => $custom_string_3,
|
'custom_string_3' => $custom_string_3,
|
||||||
'custom_integer_1' => $custom_integer_1,
|
'custom_integer_1' => $custom_integer_1,
|
||||||
'custom_integer_2' => $custom_integer_2,
|
'custom_integer_2' => $custom_integer_2,
|
||||||
'min_ff_event' => $ff_event));
|
'min_ff_event' => $ff_event);
|
||||||
|
|
||||||
|
$result = update_agent_module ($id_agent_module,
|
||||||
|
$values);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
|
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
|
||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
} else {
|
|
||||||
|
pandora_audit("Agent management",
|
||||||
|
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
@ -621,7 +646,7 @@ if ($update_module) {
|
|||||||
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
||||||
|
|
||||||
pandora_audit("Agent management",
|
pandora_audit("Agent management",
|
||||||
"Updated module '$name' for agent ".$agent["nombre"]);
|
"Updated module '$name' for agent ".$agent["nombre"], false, false, json_encode($values));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,8 +661,7 @@ if ($create_module) {
|
|||||||
|
|
||||||
$id_module = (int) get_parameter ('id_module');
|
$id_module = (int) get_parameter ('id_module');
|
||||||
|
|
||||||
$id_agent_module = create_agent_module ($id_agente, $name,
|
$values = array ('id_tipo_modulo' => $id_module_type,
|
||||||
array ('id_tipo_modulo' => $id_module_type,
|
|
||||||
'descripcion' => $description,
|
'descripcion' => $description,
|
||||||
'max' => $max,
|
'max' => $max,
|
||||||
'min' => $min,
|
'min' => $min,
|
||||||
@ -671,20 +695,27 @@ if ($create_module) {
|
|||||||
'custom_integer_1' => $custom_integer_1,
|
'custom_integer_1' => $custom_integer_1,
|
||||||
'custom_integer_2' => $custom_integer_2,
|
'custom_integer_2' => $custom_integer_2,
|
||||||
'min_ff_event' => $ff_event
|
'min_ff_event' => $ff_event
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$id_agent_module = create_agent_module ($id_agente, $name, $values);
|
||||||
|
|
||||||
if ($id_agent_module === false) {
|
if ($id_agent_module === false) {
|
||||||
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
$moduletype = $id_module;
|
$moduletype = $id_module;
|
||||||
} else {
|
pandora_audit("Agent management",
|
||||||
|
"Fail to try added module '$name' for agent ".$agent["nombre"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
|
|
||||||
|
$info = '';
|
||||||
|
|
||||||
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
||||||
pandora_audit("Agent management",
|
pandora_audit("Agent management",
|
||||||
"Added module '$name' for agent ".$agent["nombre"]);
|
"Added module '$name' for agent ".$agent["nombre"], false, false, json_encode($values));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,18 +774,28 @@ if ($delete_module){ // DELETE agent module !
|
|||||||
|
|
||||||
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
||||||
pandora_audit("Agent management",
|
pandora_audit("Agent management",
|
||||||
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["nombre"]);
|
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["nombre"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODULE DUPLICATION
|
// MODULE DUPLICATION
|
||||||
// =================
|
// =================
|
||||||
if ($duplicate_module){ // DUPLICATE agent module !
|
if ($duplicate_module) { // DUPLICATE agent module !
|
||||||
$id_duplicate_module = (int) get_parameter_get ("duplicate_module",0);
|
$id_duplicate_module = (int) get_parameter_get ("duplicate_module",0);
|
||||||
$result = copy_agent_module_to_agent ($id_duplicate_module,
|
$result = copy_agent_module_to_agent ($id_duplicate_module,
|
||||||
get_agentmodule_agent($id_duplicate_module),
|
get_agentmodule_agent($id_duplicate_module),
|
||||||
__('copy of').' '.get_agentmodule_name($id_duplicate_module));
|
__('copy of').' '.get_agentmodule_name($id_duplicate_module));
|
||||||
|
|
||||||
|
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
pandora_audit("Agent management",
|
||||||
|
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"] . " with the new id for clon " . $result);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pandora_audit("Agent management",
|
||||||
|
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE GIS
|
// UPDATE GIS
|
||||||
|
@ -49,6 +49,7 @@ if (!empty($agent_to_delete)) {
|
|||||||
if (give_acl ($config["id_user"], $id_grupo, "AW")==1) {
|
if (give_acl ($config["id_user"], $id_grupo, "AW")==1) {
|
||||||
$id_agentes[0] = $id_agente;
|
$id_agentes[0] = $id_agente;
|
||||||
delete_agent($id_agentes);
|
delete_agent($id_agentes);
|
||||||
|
pandora_audit("Agent management", "Delete Agent " . $agent_name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// NO permissions.
|
// NO permissions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user