Wip command center
This commit is contained in:
parent
030a4fed6a
commit
97595ad973
|
@ -1047,8 +1047,8 @@ function process_upload_xml($xml)
|
|||
|
||||
// Extract policies.
|
||||
if ($hook_enterprise === true) {
|
||||
$centralized_management = !is_central_policies_on_node();
|
||||
if ($centralized_management) {
|
||||
$centralized_management = is_management_allowed();
|
||||
if ($centralized_management === true) {
|
||||
process_upload_xml_policy($xml, $group_filter);
|
||||
}
|
||||
}
|
||||
|
@ -1080,9 +1080,10 @@ function resource_registration_extension_main()
|
|||
return;
|
||||
}
|
||||
|
||||
$centralized_management = !is_central_policies_on_node();
|
||||
if (!$centralized_management) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. Go to metaconsole to create a policy.'));
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. Go to metaconsole to create a policy.')
|
||||
);
|
||||
}
|
||||
|
||||
echo '<div class=notify>';
|
||||
|
@ -1091,7 +1092,7 @@ function resource_registration_extension_main()
|
|||
|
||||
echo '<br /><br />';
|
||||
|
||||
// Upload form
|
||||
// Upload form.
|
||||
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
|
||||
echo '<table class="databox" id="table1" width="98%" border="0" cellpadding="4" cellspacing="4">';
|
||||
echo '<tr>';
|
||||
|
@ -1105,7 +1106,7 @@ function resource_registration_extension_main()
|
|||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
if (!isset($_FILES['resource_upload']['tmp_name'])) {
|
||||
if (isset($_FILES['resource_upload']['tmp_name']) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ if (!$new_agent && $alias != '') {
|
|||
$agent_options_update = 'agent_options_update';
|
||||
|
||||
// Delete link from here.
|
||||
if (!is_central_policies_on_node()) {
|
||||
if (is_management_allowed() === true) {
|
||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
|
|
|
@ -110,7 +110,7 @@ ui_print_standard_header(
|
|||
]
|
||||
);
|
||||
|
||||
if (is_central_policies_on_node()) {
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. To delete an agent go to metaconsole.')
|
||||
);
|
||||
|
@ -912,7 +912,7 @@ if ($agents !== false) {
|
|||
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent'), 'class' => 'invert_filter']).'</a>';
|
||||
}
|
||||
|
||||
if ($check_aw && !is_central_policies_on_node()) {
|
||||
if ($check_aw && is_management_allowed() === true) {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
|
|
|
@ -170,9 +170,9 @@ $checked = get_parameter('checked');
|
|||
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
if ($policy_page) {
|
||||
$show_creation = !is_central_policies_on_node();
|
||||
$show_creation = is_management_allowed();
|
||||
} else {
|
||||
if (!isset($all_groups)) {
|
||||
if (isset($all_groups) === false) {
|
||||
$all_groups = agents_get_all_groups_agent(
|
||||
$agent['id_agente'],
|
||||
$agent['id_grupo']
|
||||
|
@ -184,7 +184,7 @@ if (($policy_page) || (isset($agent))) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($show_creation) {
|
||||
if ($show_creation === true) {
|
||||
// Create module/type combo.
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
if (!$policy_page) {
|
||||
|
|
|
@ -213,7 +213,8 @@ if ($delete_action) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === true) {
|
||||
$is_management_allowed = is_management_allowed();
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
@ -320,7 +321,7 @@ $table->head = [];
|
|||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Command');
|
||||
$table->head[2] = __('Group');
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
}
|
||||
|
@ -406,7 +407,7 @@ foreach ($actions as $action) {
|
|||
$data[3] = '';
|
||||
$data[4] = '';
|
||||
|
||||
if (is_central_policies_on_node() === false
|
||||
if (is_management_allowed() === true
|
||||
&& check_acl($config['id_user'], $action['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[] = [
|
||||
|
@ -459,7 +460,7 @@ if (isset($data)) {
|
|||
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -48,7 +48,7 @@ if (is_ajax()) {
|
|||
$id = (int) get_parameter('id', 0);
|
||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = !is_management_allowed();
|
||||
|
||||
// If command ID is not provided, check for action id.
|
||||
if ($id == 0) {
|
||||
|
@ -144,7 +144,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"removeTinyMCE('textarea_field".$i."_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -156,7 +156,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"addTinyMCE('textarea_field".$i."_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -171,7 +171,7 @@ if (is_ajax()) {
|
|||
'class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
||||
|
@ -181,7 +181,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"removeTinyMCE('textarea_field".$i."_recovery_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -193,7 +193,7 @@ if (is_ajax()) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
"addTinyMCE('textarea_field".$i."_recovery_value')",
|
||||
'',
|
||||
true
|
||||
|
@ -208,7 +208,7 @@ if (is_ajax()) {
|
|||
'class="fields_recovery"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
||||
$editor_type_chkbx = '<div id="command_div"><b><small>';
|
||||
|
@ -222,7 +222,7 @@ if (is_ajax()) {
|
|||
'text/plain',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -234,7 +234,7 @@ if (is_ajax()) {
|
|||
'text/html',
|
||||
'',
|
||||
'text/html',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -253,7 +253,7 @@ if (is_ajax()) {
|
|||
'text/plain',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -265,7 +265,7 @@ if (is_ajax()) {
|
|||
'text/html',
|
||||
'',
|
||||
'text/html',
|
||||
$is_central_policies_on_node,
|
||||
$is_management_allowed,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
|
@ -301,7 +301,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
$rfield .= html_print_select(
|
||||
|
@ -315,7 +315,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
|
||||
|
@ -329,7 +329,7 @@ if (is_ajax()) {
|
|||
'style="min-height:40px; '.$style.'" class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
|
||||
|
||||
|
@ -341,7 +341,7 @@ if (is_ajax()) {
|
|||
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
} else {
|
||||
$fields_value_select = [];
|
||||
|
@ -375,7 +375,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
$rfield = html_print_select(
|
||||
$fields_value_select,
|
||||
|
@ -388,7 +388,7 @@ if (is_ajax()) {
|
|||
false,
|
||||
false,
|
||||
'fields_recovery',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
} else {
|
||||
$ffield = html_print_textarea(
|
||||
|
@ -399,7 +399,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
$rfield = html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
|
@ -409,7 +409,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields_recovery min-height-40px',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
$rfield = html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
|
@ -432,7 +432,7 @@ if (is_ajax()) {
|
|||
'style="'.$style.'" class="fields_recovery min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
$is_management_allowed
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -610,9 +610,8 @@ if ($copy_command) {
|
|||
}
|
||||
}
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
$is_management_allowed = is_management_allowed();
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
@ -682,7 +681,7 @@ foreach ($commands as $command) {
|
|||
$table->cellclass[]['action'] = 'action_buttons';
|
||||
|
||||
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
|
||||
if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
|
||||
if ($is_management_allowed === true && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
|
||||
if (check_acl($config['id_user'], 0, 'PM') || is_user_admin(
|
||||
$config['id_user
|
||||
']
|
||||
|
@ -714,7 +713,7 @@ if (isset($data) === true && count($table->data) > 0) {
|
|||
);
|
||||
}
|
||||
|
||||
if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
||||
if ($is_management_allowed === true && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -259,7 +259,7 @@ if ($delete_template) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === true) {
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
@ -409,7 +409,7 @@ foreach ($templates as $template) {
|
|||
$data[1] = ui_print_group_icon($template['id_group'], true);
|
||||
$data[3] = alerts_get_alert_templates_type_name($template['type']);
|
||||
|
||||
if (is_central_policies_on_node() === false
|
||||
if (is_management_allowed() === true
|
||||
&& check_acl($config['id_user'], $template['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[][4] = 'action_buttons';
|
||||
|
@ -469,7 +469,7 @@ if (isset($data) === true) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
|
|
|
@ -101,9 +101,9 @@ if (!$is_in_group && $al_action['id_group'] != 0) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = is_management_allowed();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
@ -178,7 +178,7 @@ $table->data[0][1] = html_print_input_text(
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
if (io_safe_output($name) == 'Monitoring Event') {
|
||||
|
@ -214,7 +214,7 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
).'</div>';
|
||||
$table->colspan[1][1] = 2;
|
||||
|
||||
|
@ -248,10 +248,10 @@ $table->data[2][1] = html_print_select_from_sql(
|
|||
true,
|
||||
false,
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[2][1] .= ' ';
|
||||
if ($is_central_policies_on_node === false
|
||||
if ($is_management_allowed === true
|
||||
&& check_acl($config['id_user'], 0, 'PM') && !$disabled
|
||||
) {
|
||||
$table->data[2][1] .= __('Create Command');
|
||||
|
@ -275,7 +275,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
|
@ -359,7 +359,7 @@ echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/ale
|
|||
$table_html = html_print_table($table, true);
|
||||
|
||||
echo $table_html;
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
|
|
|
@ -155,9 +155,9 @@ if (empty($fields_hidden) === false) {
|
|||
}
|
||||
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = is_management_allowed();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
@ -203,7 +203,7 @@ $table->data['name'][2] = html_print_input_text(
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$table->colspan['command'][1] = 3;
|
||||
|
@ -216,7 +216,7 @@ $table->data['command'][1] = html_print_textarea(
|
|||
'',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$return_all_group = false;
|
||||
|
@ -240,7 +240,7 @@ $table->data['group'][1] = '<div class="w250px inline">'.html_print_select_group
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
).'</div>';
|
||||
|
||||
$table->colspan['description'][1] = 3;
|
||||
|
@ -253,7 +253,7 @@ $table->data['description'][1] = html_print_textarea(
|
|||
'',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
|
||||
|
@ -283,7 +283,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
||||
|
@ -321,7 +321,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
!$is_management_allowed
|
||||
);
|
||||
|
||||
$table->data['field'.$i][4] = __('Hide');
|
||||
|
@ -330,7 +330,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
'field'.$i.'_hide',
|
||||
1,
|
||||
$selected,
|
||||
$is_central_policies_on_node,
|
||||
!$is_management_allowed,
|
||||
'cursor: \'pointer\'',
|
||||
'class="hide_inputs"',
|
||||
true
|
||||
|
@ -340,7 +340,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
|
||||
html_print_table($table);
|
||||
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($is_management_allowed === true) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
|
|
|
@ -368,9 +368,9 @@ function update_template($step)
|
|||
}
|
||||
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
$is_management_allowed = is_management_allowed();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
@ -609,7 +609,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$monday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Tue');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -617,7 +617,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$tuesday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Wed');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -625,7 +625,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$wednesday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Thu');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -633,7 +633,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$thursday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Fri');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -641,7 +641,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$friday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Sat');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -649,7 +649,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$saturday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[0][1] .= __('Sun');
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
|
@ -657,7 +657,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$sunday,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[0][2] = __('Use special days list');
|
||||
|
@ -666,7 +666,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$special_day,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[1][0] = __('Time from');
|
||||
|
@ -687,7 +687,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[1][2] = __('Time to');
|
||||
$table->data[1][3] = html_print_input_text(
|
||||
|
@ -707,7 +707,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->colspan['threshold'][1] = 3;
|
||||
|
@ -723,7 +723,7 @@ if ($step == 2) {
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Min. number of alerts');
|
||||
|
@ -744,7 +744,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[3][2] = __('Reset counter for non-sustained alerts');
|
||||
|
@ -757,7 +757,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$min_alerts_reset_counter,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
'',
|
||||
false,
|
||||
$create_template == 1 ? 'checked=checked' : ''
|
||||
|
@ -781,7 +781,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[4][2] = __('Disable event');
|
||||
|
@ -790,7 +790,7 @@ if ($step == 2) {
|
|||
1,
|
||||
$disable_event,
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[5][0] = __('Default action');
|
||||
|
@ -818,7 +818,7 @@ if ($step == 2) {
|
|||
true,
|
||||
false,
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
false,
|
||||
false,
|
||||
0
|
||||
|
@ -840,7 +840,7 @@ if ($step == 2) {
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>';
|
||||
$table->data[6][1] .= ' '.html_print_checkbox('matches_value', 1, $matches, true);
|
||||
|
@ -949,7 +949,7 @@ if ($step == 2) {
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
$table->colspan[0][1] = 2;
|
||||
|
||||
|
@ -975,7 +975,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"removeTinyMCE('textarea_field".$i."')",
|
||||
'',
|
||||
true
|
||||
|
@ -988,7 +988,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"addTinyMCE('textarea_field".$i."')",
|
||||
'',
|
||||
true
|
||||
|
@ -1004,7 +1004,7 @@ if ($step == 2) {
|
|||
'class="fields" min-height-40px',
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
// Recovery.
|
||||
|
@ -1016,7 +1016,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
false,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"removeTinyMCE('textarea_field".$i."_recovery')",
|
||||
'',
|
||||
true
|
||||
|
@ -1029,7 +1029,7 @@ if ($step == 2) {
|
|||
0,
|
||||
'',
|
||||
true,
|
||||
($is_central_policies_on_node | $disabled),
|
||||
(!$is_management_allowed | $disabled),
|
||||
"addTinyMCE('textarea_field".$i."_recovery')",
|
||||
'',
|
||||
true
|
||||
|
@ -1045,7 +1045,7 @@ if ($step == 2) {
|
|||
'class="fields min-height-40px"',
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
@ -1102,7 +1102,7 @@ if ($step == 2) {
|
|||
'',
|
||||
'',
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ if ($step == 2) {
|
|||
false,
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
).'</div>';
|
||||
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ if ($step == 2) {
|
|||
'',
|
||||
true,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
$table->data[2][0] = __('Priority');
|
||||
|
@ -1162,7 +1162,7 @@ if ($step == 2) {
|
|||
false,
|
||||
false,
|
||||
'',
|
||||
($is_central_policies_on_node | $disabled)
|
||||
(!$is_management_allowed | $disabled)
|
||||
);
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
|
@ -1200,7 +1200,7 @@ if ($id) {
|
|||
}
|
||||
|
||||
if (!$disabled) {
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($is_management_allowed === true) {
|
||||
if ($step >= LAST_STEP) {
|
||||
html_print_submit_button(
|
||||
__('Finish'),
|
||||
|
|
|
@ -201,7 +201,7 @@ $table->data[2][1] = html_print_select(
|
|||
|
||||
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
|
||||
html_print_table($table);
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
attachActionButton('delete', 'delete', $table->width);
|
||||
}
|
||||
|
||||
|
|
|
@ -845,7 +845,7 @@ echo '<h3 class="error invisible" id="message"> </h3>';
|
|||
|
||||
html_print_input_hidden('id_agente', $id_agente);
|
||||
|
||||
if (is_central_policies_on_node() === false) {
|
||||
if (is_management_allowed() === true) {
|
||||
attachActionButton('update_agents', 'update', $table->width);
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ $agentstab = [
|
|||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($tab == 'massive_policies' && is_central_policies_on_node()) {
|
||||
if ($tab == 'massive_policies' && is_management_allowed() === false) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. All policies information is read only. Go to metaconsole to manage it.'));
|
||||
return;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ $agentstab = [
|
|||
</script>
|
||||
|
||||
<?php
|
||||
if (is_central_policies_on_node() && $option == 'delete_agents') {
|
||||
if (is_management_allowed() === false && $option == 'delete_agents') {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
|
||||
}
|
||||
|
||||
|
|
|
@ -283,11 +283,12 @@ $sec = 'gservers';
|
|||
if (($create != '') || ($view != '')) {
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
$management_allowed = is_management_allowed();
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
} else {
|
||||
|
@ -309,8 +310,7 @@ if (($create != '') || ($view != '')) {
|
|||
);
|
||||
}
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
|
@ -661,8 +661,8 @@ if (($create != '') || ($view != '')) {
|
|||
true
|
||||
);
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
$management_allowed = is_management_allowed();
|
||||
if ($management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
|
|
|
@ -169,9 +169,8 @@ if ($delete !== 0) {
|
|||
}
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
$is_management_allowed = is_management_allowed();
|
||||
if ($is_management_allowed === false) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All tags information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
|
|
|
@ -1726,8 +1726,9 @@ function has_metaconsole()
|
|||
|
||||
|
||||
/**
|
||||
* @brief Check if there is management operations are allowed in current context
|
||||
* (node // meta)
|
||||
* Check if there is management operations are allowed in current context
|
||||
*
|
||||
* @param string $hkey Hash ke.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
@ -1753,19 +1754,6 @@ function is_central_policies()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if there is centralized management in node environment. Usefull
|
||||
* to reduce the policy functionallity on nodes.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_central_policies_on_node()
|
||||
{
|
||||
global $config;
|
||||
return (!is_metaconsole()) && $config['centralized_management'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if current execution is under an AJAX request.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue