mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
2013-02-20 Miguel de Dios <miguel.dedios@artica.es>
* godmode/servers/recon_script.php, godmode/servers/plugin.php, godmode/snmpconsole/snmp_filters.php, godmode/massive/massive_delete_alerts.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_edit_agents.php, godmode/massive/massive_delete_modules.php, godmode/massive/massive_add_action_alerts.php, godmode/massive/massive_delete_action_alerts.php: improved the code style. * include/ajax/events.php, include/functions_events.php, operation/agentes/custom_fields.php: fixed the show admin custom fields for user without permisitions. Fixes: #3605278 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7683 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cdc431f8b8
commit
067b5a1d8b
@ -1,3 +1,21 @@
|
||||
2013-02-20 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/servers/recon_script.php, godmode/servers/plugin.php,
|
||||
godmode/snmpconsole/snmp_filters.php,
|
||||
godmode/massive/massive_delete_alerts.php,
|
||||
godmode/massive/massive_enable_disable_alerts.php,
|
||||
godmode/massive/massive_edit_agents.php,
|
||||
godmode/massive/massive_delete_modules.php,
|
||||
godmode/massive/massive_add_action_alerts.php,
|
||||
godmode/massive/massive_delete_action_alerts.php: improved the code
|
||||
style.
|
||||
|
||||
* include/ajax/events.php, include/functions_events.php,
|
||||
operation/agentes/custom_fields.php: fixed the show admin custom
|
||||
fields for user without permisitions.
|
||||
|
||||
Fixes: #3605278
|
||||
|
||||
2013-02-19 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/auth/ldap.php: Do not bind anonymously to check whether the
|
||||
|
@ -51,37 +51,39 @@ $recursion = get_parameter ('recursion');
|
||||
$delete = (bool) get_parameter_post ('delete');
|
||||
|
||||
if ($delete) {
|
||||
if(empty($id_agents) || $id_agents[0] == 0)
|
||||
ui_print_result_message (false, '', __('Could not be deleted').". ".__('No agents selected'));
|
||||
if (empty($id_agents) || $id_agents[0] == 0)
|
||||
ui_print_result_message (false, '',
|
||||
__('Could not be deleted. No agents selected'));
|
||||
else {
|
||||
$actions = get_parameter ('action');
|
||||
|
||||
if(!empty($actions)){
|
||||
if (!empty($actions)) {
|
||||
$agent_alerts = agents_get_alerts($id_agents);
|
||||
|
||||
$alerts_agent_modules = array();
|
||||
foreach($agent_alerts['simple'] as $agent_alert){
|
||||
foreach ($agent_alerts['simple'] as $agent_alert){
|
||||
if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) {
|
||||
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($alerts_agent_modules)) {
|
||||
ui_print_result_message (false, '', __('Could not be deleted').". ".__('No alerts selected'));
|
||||
ui_print_result_message (false, '',
|
||||
__('Could not be deleted. No alerts selected'));
|
||||
}
|
||||
else {
|
||||
$results = true;
|
||||
$agent_module_actions = array();
|
||||
|
||||
foreach($alerts_agent_modules as $alert_agent_module){
|
||||
foreach ($alerts_agent_modules as $alert_agent_module) {
|
||||
$agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action'));
|
||||
|
||||
foreach ($agent_module_actions as $agent_module_action){
|
||||
foreach($actions as $action) {
|
||||
if($agent_module_action['id_alert_action'] == $action) {
|
||||
foreach ($actions as $action) {
|
||||
if ($agent_module_action['id_alert_action'] == $action) {
|
||||
$result = alerts_delete_alert_agent_module_action ($agent_module_action['id']);
|
||||
|
||||
if($result === false)
|
||||
if ($result === false)
|
||||
$results = false;
|
||||
}
|
||||
}
|
||||
@ -99,11 +101,14 @@ if ($delete) {
|
||||
' Actions: ' . implode(',',$actions));
|
||||
}
|
||||
|
||||
ui_print_result_message ($results, __('Successfully deleted'), __('Could not be deleted'));
|
||||
ui_print_result_message ($results,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_print_result_message (false, '', __('Could not be deleted').". ".__('No action selected'));
|
||||
ui_print_result_message (false, '',
|
||||
__('Could not be deleted. No action selected'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,12 +155,17 @@ $table->data[2][1] = html_print_select (index_array ($alert_templates, 'id_alert
|
||||
|
||||
$actions = alerts_get_alert_actions ();
|
||||
$table->data[3][0] = __('Action');
|
||||
$table->data[3][1] = html_print_select ($actions, 'action[]', '', '', '', '', true, true);
|
||||
$table->data[3][1] = html_print_select ($actions, 'action[]', '', '',
|
||||
'', '', true, true);
|
||||
|
||||
echo '<form method="post" id="form_alert" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_action_alerts">';
|
||||
html_print_table ($table);
|
||||
|
||||
$sql = 'SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo IN (SELECT id_agent_module FROM talert_template_modules)';
|
||||
$sql = 'SELECT id_agente
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo IN (
|
||||
SELECT id_agent_module
|
||||
FROM talert_template_modules)';
|
||||
$agents_with_templates = db_get_all_rows_sql($sql);
|
||||
$agents_with_templates_json = array();
|
||||
foreach($agents_with_templates as $ag) {
|
||||
@ -171,10 +181,10 @@ html_print_submit_button (__('Delete'), 'go', false, 'class="sub delete"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
echo '<h3 class="error invisible" id="message"></h3>';
|
||||
|
||||
ui_require_jquery_file ('form');
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
ui_require_jquery_file('form');
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -489,11 +489,16 @@ function changeIcons() {
|
||||
$("#icon_warning").attr("style", "display:none;");
|
||||
}
|
||||
else {
|
||||
$("#icon_without_status").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_default").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_ok").attr("src", "<?php echo $path; ?>" + icon + ".ok.png");
|
||||
$("#icon_bad").attr("src", "<?php echo $path; ?>" + icon + ".bad.png");
|
||||
$("#icon_warning").attr("src", "<?php echo $path; ?>" + icon + ".warning.png");
|
||||
$("#icon_without_status").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_default").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".default.png");
|
||||
$("#icon_ok").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".ok.png");
|
||||
$("#icon_bad").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".bad.png");
|
||||
$("#icon_warning").attr("src",
|
||||
"<?php echo $path; ?>" + icon + ".warning.png");
|
||||
$("#icon_without_status").attr("style", "");
|
||||
$("#icon_default").attr("style", "");
|
||||
$("#icon_ok").attr("style", "");
|
||||
|
@ -55,6 +55,7 @@ if ($view != "") {
|
||||
$macros = $plugin ["macros"];
|
||||
$parameters = $plugin ["parameters"];
|
||||
}
|
||||
|
||||
if ($create != "") {
|
||||
$form_name = "";
|
||||
$form_description = "";
|
||||
@ -74,7 +75,7 @@ $sec = 'gservers';
|
||||
|
||||
if (($create != "") OR ($view != "")) {
|
||||
|
||||
if(defined('METACONSOLE')) {
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
}
|
||||
@ -512,12 +513,12 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
<?php
|
||||
if($locked) {
|
||||
?>
|
||||
if($locked) {
|
||||
?>
|
||||
$('.command_advanced_conf').click(function() {
|
||||
alert('<?php echo __("The plugin command cannot be updated because some modules or components are using the plugin."); ?>');
|
||||
});
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -158,7 +158,7 @@ if ($dialogue_event_response) {
|
||||
}
|
||||
}
|
||||
|
||||
if($add_comment) {
|
||||
if ($add_comment) {
|
||||
$comment = get_parameter ('comment');
|
||||
$event_id = get_parameter ('event_id');
|
||||
|
||||
@ -172,7 +172,7 @@ if($add_comment) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($change_status) {
|
||||
if ($change_status) {
|
||||
$event_ids = get_parameter ('event_ids');
|
||||
$new_status = get_parameter ('new_status');
|
||||
|
||||
@ -186,7 +186,7 @@ if($change_status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($change_owner) {
|
||||
if ($change_owner) {
|
||||
$new_owner = get_parameter ('new_owner');
|
||||
$event_id = get_parameter ('event_id');
|
||||
$similars = true;
|
||||
@ -205,12 +205,12 @@ if($change_owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($get_extended_event) {
|
||||
if ($get_extended_event) {
|
||||
global $config;
|
||||
|
||||
$event_id = get_parameter('event_id',false);
|
||||
|
||||
if($meta) {
|
||||
if ($meta) {
|
||||
$event = events_meta_get_event($event_id, false, $history);
|
||||
}
|
||||
else {
|
||||
@ -221,7 +221,7 @@ if($get_extended_event) {
|
||||
$event['clean_tags'] = events_clean_tags($event['tags']);
|
||||
|
||||
// If the event is not found, we abort
|
||||
if(empty($event)) {
|
||||
if (empty($event)) {
|
||||
ui_print_error_message('Event not found');
|
||||
return false;
|
||||
}
|
||||
@ -243,17 +243,17 @@ if($get_extended_event) {
|
||||
if (is_user_admin ($config["id_user"])) {
|
||||
//Do nothing if you're admin, you get full access
|
||||
}
|
||||
else if($config["id_user"] == $event['owner_user']) {
|
||||
else if ($config["id_user"] == $event['owner_user']) {
|
||||
//Do nothing if you're the owner user, you get access
|
||||
}
|
||||
else if($event['id_grupo'] == 0){
|
||||
else if ($event['id_grupo'] == 0) {
|
||||
//If the event has access to all groups, you get access
|
||||
}
|
||||
else {
|
||||
// Get your groups
|
||||
$groups = users_get_groups($config['id_user'], 'ER');
|
||||
|
||||
if(in_array ($event['id_grupo'], array_keys ($groups))) {
|
||||
if (in_array ($event['id_grupo'], array_keys ($groups))) {
|
||||
//If the event group is among the groups of the user, you get access
|
||||
}
|
||||
else {
|
||||
@ -266,7 +266,7 @@ if($get_extended_event) {
|
||||
// Print group_rep in a hidden field to recover it from javascript
|
||||
html_print_input_hidden('group_rep',(int)$group_rep);
|
||||
|
||||
if($event === false) {
|
||||
if ($event === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ if($get_extended_event) {
|
||||
|
||||
$console_url = '';
|
||||
// If metaconsole switch to node to get details and custom fields
|
||||
if($meta) {
|
||||
if ($meta) {
|
||||
$server = metaconsole_get_connection_by_id ($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
@ -328,7 +328,7 @@ if($get_extended_event) {
|
||||
|
||||
$custom_fields = events_page_custom_fields($event);
|
||||
|
||||
if($meta) {
|
||||
if ($meta) {
|
||||
metaconsole_restore_db_force();
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ if($get_extended_event) {
|
||||
';
|
||||
|
||||
// Load the required tab
|
||||
switch($dialog_page) {
|
||||
switch ($dialog_page) {
|
||||
case "general":
|
||||
$js .= '$tabs.tabs( "option", "active", 0);';
|
||||
break;
|
||||
@ -389,7 +389,7 @@ if($get_extended_event) {
|
||||
echo $out.$js;
|
||||
}
|
||||
|
||||
if($get_events_details) {
|
||||
if ($get_events_details) {
|
||||
$event_ids = explode(',',get_parameter ('event_ids'));
|
||||
$events = db_get_all_rows_filter ('tevento',
|
||||
array ('id_evento' => $event_ids,
|
||||
|
@ -1679,9 +1679,18 @@ function events_page_custom_fields ($event) {
|
||||
$table->style[1] = 'text-align: left;';
|
||||
$table->class = "databox alternate";
|
||||
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields');
|
||||
$all_customs_fields = (bool)check_acl($config["id_user"],
|
||||
$agent["id_grupo"], "AW");
|
||||
|
||||
if($event['id_agente'] == 0) {
|
||||
if ($all_customs_fields) {
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields');
|
||||
}
|
||||
else {
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields',
|
||||
array('display_on_front' => 1));
|
||||
}
|
||||
|
||||
if ($event['id_agente'] == 0) {
|
||||
$fields_data = array();
|
||||
}
|
||||
else {
|
||||
@ -1695,7 +1704,7 @@ function events_page_custom_fields ($event) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach($fields as $field) {
|
||||
foreach ($fields as $field) {
|
||||
// Owner
|
||||
$data = array();
|
||||
$data[0] = $field['name'];
|
||||
|
@ -36,10 +36,18 @@ if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR")) {
|
||||
return;
|
||||
}
|
||||
|
||||
$all_customs_fields = (bool)check_acl($config["id_user"],
|
||||
$agent["id_grupo"], "AW");
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
if ($all_customs_fields) {
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields');
|
||||
}
|
||||
else {
|
||||
$fields = db_get_all_rows_filter('tagent_custom_fields',
|
||||
array('display_on_front' => 1));
|
||||
}
|
||||
|
||||
if($fields === false) {
|
||||
if ($fields === false) {
|
||||
$fields = array();
|
||||
echo "<div class='nf'>". __("No fields defined"). "</div>";
|
||||
}
|
||||
@ -47,7 +55,8 @@ else {
|
||||
$table->width = '98%';
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Field');
|
||||
$table->head[1] = __('Display on front') . ui_print_help_tip (__('The fields with display on front enabled will be displayed into the agent details'), true);
|
||||
$table->head[1] = __('Display on front') .
|
||||
ui_print_help_tip (__('The fields with display on front enabled will be displayed into the agent details'), true);
|
||||
$table->head[2] = __('Description');
|
||||
$table->align = array ();
|
||||
$table->align[1] = 'center';
|
||||
@ -58,16 +67,19 @@ else {
|
||||
|
||||
$data[0] = '<b>'.$field['name'].'</b>';
|
||||
|
||||
if($field['display_on_front']) {
|
||||
if ($field['display_on_front']) {
|
||||
$data[1] = html_print_image('images/tick.png', true);
|
||||
}
|
||||
else {
|
||||
$data[1] = html_print_image('images/delete.png', true);
|
||||
}
|
||||
|
||||
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
|
||||
$custom_value = db_get_value_filter('description',
|
||||
'tagent_custom_data', array(
|
||||
'id_field' => $field['id_field'],
|
||||
'id_agent' => $id_agente));
|
||||
|
||||
if($custom_value === false || $custom_value == '') {
|
||||
if ($custom_value === false || $custom_value == '') {
|
||||
$custom_value = '<i>-'.__('empty').'-</i>';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user