fix groups, module_groups, network_components user_edit synch

This commit is contained in:
Daniel Barbero Martin 2021-05-18 17:18:54 +02:00
parent 5d70226b13
commit 6c305833bf
8 changed files with 271 additions and 195 deletions

@ -30,7 +30,7 @@
global $config;
check_login();
// ACL Check
// ACL Check.
if (!check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
@ -56,12 +56,12 @@ if (is_ajax()) {
}
/**
* The main function of module groups and the enter point to
* execute the code.
*
* @return void
*/
/**
* The main function of module groups and the enter point to
* execute the code.
*
* @return void
*/
function mainModuleGroups()
{
global $config;
@ -94,7 +94,7 @@ function mainModuleGroups()
$user_groups = users_get_groups($config['user'], 'AR');
$info = array_filter(
$info,
function ($v, $k) use ($user_groups) {
function ($v) use ($user_groups) {
return $user_groups[$v['id']] != null;
},
ARRAY_FILTER_USE_BOTH
@ -102,7 +102,7 @@ function mainModuleGroups()
$info = array_filter(
$info,
function ($v, $k) use ($agent_group_search) {
function ($v) use ($agent_group_search) {
return preg_match(
'/'.$agent_group_search.'/i',
$v['name']
@ -111,7 +111,7 @@ function mainModuleGroups()
ARRAY_FILTER_USE_BOTH
);
if (!empty($info)) {
if (empty($info) === false) {
$groups_view = ($is_not_paginated) ? $info : array_slice(
$info,
$offset,
@ -156,7 +156,7 @@ function mainModuleGroups()
$array_module_group = array_filter(
$array_module_group,
function ($v, $k) use ($module_group_search) {
function ($v) use ($module_group_search) {
return preg_match('/'.$module_group_search.'/i', $v);
},
ARRAY_FILTER_USE_BOTH
@ -321,13 +321,16 @@ function mainModuleGroups()
// Orange when the cell for this model group and agent has at least one alert fired.
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
$color = COL_CRITICAL;
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
// Red when the cell for this model group and agent
// has at least one module in critical state and the rest in any state.
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
$color = COL_WARNING;
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
// Yellow when the cell for this model group and agent
// has at least one in warning state and the rest in green state.
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
$color = COL_UNKNOWN;
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
// Grey when the cell for this model group and agent
// has at least one module in unknown state and the rest in any state.
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
$color = COL_NORMAL;
// Green when the cell for this model group and agent has OK state all modules.
@ -337,7 +340,7 @@ function mainModuleGroups()
}
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
$data[$i][$j] .= "<a class='info_cell white font_18px' rel='$rel' href='$url'>";
$data[$i][$j] .= '<a class="info_cell white font_18px" rel="'.$rel.'" href="'.$url.'">';
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>';
} else {

@ -252,15 +252,7 @@ if (defined('METACONSOLE')) {
$sec = 'gagente';
}
if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0) {
if (isset($config['metaconsole_agent_cache']) && $config['metaconsole_agent_cache'] == 1) {
$confirm_bottom = " onsubmit=' return message_check_create();'";
}
} else {
$confirm_bottom = '';
}
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'"'.$confirm_bottom.' >';
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'" >';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel"');
@ -280,15 +272,6 @@ enterprise_hook('close_meta_frame');
?>
<script language="javascript" type="text/javascript">
function message_check_create() {
var return_value = false;
return_value = confirm("<?php echo __("WARNING: You\'re trying to create a group in a node member of a metaconsole.\\n\\nThis group and all of this contents will not be visible in the metaconsole.\\n\\nIf you want to create a visible group, you must do it from the metaconsole and propagate to the node. "); ?>");
return return_value;
}
function icon_changed () {
var inputs = [];
var data = this.value;

@ -363,6 +363,14 @@ if (is_metaconsole() === true) {
);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__('This node is configured with centralized mode. All groups information is read only. Go to metaconsole to manage it.')
);
}
// Load credential store view before parse list-tree forms.
if ($tab == 'credbox') {
include_once __DIR__.'/credential_store.php';
@ -376,7 +384,10 @@ $delete_group = (bool) get_parameter('delete_group');
$pure = get_parameter('pure', 0);
// Create group.
if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
if ($is_management_allowed === true
&& $create_group === true
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
@ -432,7 +443,7 @@ if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true))
}
// Update group.
if ($update_group) {
if ($is_management_allowed === true && $update_group === true) {
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
@ -504,7 +515,10 @@ if ($update_group) {
}
// Delete group.
if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
if ($is_management_allowed === true
&& $delete_group === true
&& ((bool) check_acl($config['id_user'], 0, 'PM') === true)
) {
$id_group = (int) get_parameter('id_group');
$usedGroup = groups_check_used($id_group);
@ -685,7 +699,6 @@ if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true))
}
}
// Credential store is loaded previously in this document to avoid
// process group tree - list forms.
if ($tab == 'tree') {
@ -801,15 +814,24 @@ if ($tab == 'tree') {
$table->headstyle[4] = 'min-width: 100px;';
$table->head[5] = __('Description');
$table->headstyle[5] = 'min-width: 100px;';
$table->head[6] = __('Actions');
$table->headstyle[6] = 'min-width: 100px;';
if ($is_management_allowed === true) {
$table->head[6] = __('Actions');
$table->headstyle[6] = 'min-width: 100px;';
}
$table->align = [];
$table->align[0] = 'left';
$table->align[2] = 'left';
$table->align[6] = 'left';
if ($is_management_allowed === true) {
$table->align[6] = 'left';
}
$table->size[0] = '3%';
$table->size[5] = '30%';
$table->size[6] = '5%';
if ($is_management_allowed === true) {
$table->size[6] = '5%';
}
$table->data = [];
foreach ($groups as $key => $group) {
@ -821,7 +843,12 @@ if ($tab == 'tree') {
}
$table->data[$key][0] = $group['id_grupo'];
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
if ($is_management_allowed === true) {
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
} else {
$table->data[$key][1] = $group['nombre'];
}
if ($group['icon'] != '') {
$table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png',
@ -846,36 +873,38 @@ if ($tab == 'tree') {
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description'];
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => __('Edit'),
'title' => __('Edit'),
'border' => '0',
]
).'</a>';
if ($is_management_allowed === true) {
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
'images/config.png',
true,
[
'alt' => __('Edit'),
'title' => __('Edit'),
'border' => '0',
]
).'</a>';
if (is_metaconsole() === true) {
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
} else {
$confirm_message = __('Are you sure?');
if (is_metaconsole() === true) {
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
} else {
$confirm_message = __('Are you sure?');
}
if ($group['has_child']) {
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
}
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'border' => '0',
]
).'</a>';
}
if ($group['has_child']) {
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
}
$table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'border' => '0',
]
).'</a>';
}
echo ui_pagination(
@ -908,7 +937,10 @@ if ($tab == 'tree') {
}
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
if ($is_management_allowed === true
&& (bool) check_acl($config['id_user'], 0, 'PM') === true
) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons w100p">';
html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"');

@ -1,9 +1,8 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
* Module Groups.
*
* @category Extensions
* @category Module groups
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
@ -40,7 +39,7 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
return;
}
if (is_ajax()) {
if (is_ajax() === true) {
$get_group_json = (bool) get_parameter('get_group_json');
$get_group_agents = (bool) get_parameter('get_group_agents');
@ -65,7 +64,7 @@ if (is_ajax()) {
return;
}
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
// Header.
ui_print_page_header(
__('Module groups defined in %s', get_product_name()),
@ -77,12 +76,20 @@ if (!is_metaconsole()) {
);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
ui_print_warning_message(
__('This node is configured with centralized mode. All module groups information is read only. Go to metaconsole to manage it.')
);
}
$create_group = (bool) get_parameter('create_group');
$update_group = (bool) get_parameter('update_group');
$delete_group = (bool) get_parameter('delete_group');
// Create group.
if ($create_group) {
if ($is_management_allowed === true && $create_group === true) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
@ -115,7 +122,7 @@ if ($create_group) {
}
// Update group.
if ($update_group) {
if ($is_management_allowed === true && $update_group === true) {
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
@ -151,7 +158,7 @@ if ($update_group) {
}
// Delete group.
if ($delete_group) {
if ($is_management_allowed === true && $delete_group === true) {
$id_group = (int) get_parameter('id_group');
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
@ -217,7 +224,6 @@ $total_groups = db_get_num_rows('SELECT * FROM tmodule_group');
$url = ui_get_url_refresh(['offset' => false]);
$offset = (int) get_parameter('offset', 0);
$sql = 'SELECT *
FROM tmodule_group
ORDER BY name ASC
@ -229,27 +235,39 @@ $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
if (!empty($groups)) {
if (empty($groups) === false) {
$table->head = [];
$table->head[0] = __('ID');
$table->head[1] = __('Name');
$table->head[2] = __('Delete');
if ($is_management_allowed === true) {
$table->head[2] = __('Delete');
}
$table->align = [];
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->size[2] = '5%';
if ($is_management_allowed === true) {
$table->align[2] = 'left';
$table->size[2] = '5%';
}
$table->data = [];
foreach ($groups as $id_group) {
$data = [];
$data[0] = $id_group['id_mg'];
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole()) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
if ($is_management_allowed === true) {
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} else {
$table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
}
} else {
$table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
$data[1] = '<strong>';
$data[1] .= ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT);
$data[1] .= '</strong>';
}
array_push($table->data, $data);
@ -267,13 +285,15 @@ if (!empty($groups)) {
);
}
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(
__('Create module group'),
'crt',
false,
'class="sub next"'
);
echo '</div>';
echo '</form>';
if ($is_management_allowed === true) {
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(
__('Create module group'),
'crt',
false,
'class="sub next"'
);
echo '</div>';
echo '</form>';
}

@ -1,9 +1,8 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
* Remote components
*
* @category Extensions
* @category Remote Components
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
@ -48,7 +47,7 @@ enterprise_include_once('meta/include/functions_components_meta.php');
require_once $config['homedir'].'/include/functions_component_groups.php';
// Header.
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$sec = 'advanced';
$id_modulo = (int) get_parameter('id_component_type');
@ -67,6 +66,11 @@ if (defined('METACONSOLE')) {
$sec = 'gmodules';
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
}
$type = (int) get_parameter('type');
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
@ -87,7 +91,7 @@ $macros = (string) get_parameter('macros');
$id_modulo = (int) get_parameter('id_component_type');
$new_component = (bool) get_parameter('new_component');
if (!empty($macros)) {
if (empty($macros) === false) {
$macros = json_decode(base64_decode($macros), true);
foreach ($macros as $k => $m) {
@ -179,7 +183,7 @@ $create_network_from_snmp_browser = (bool) get_parameter(
0
);
if ($duplicate_network_component) {
if ($is_management_allowed === true && $duplicate_network_component) {
$source_id = (int) get_parameter('source_id');
$id = network_components_duplicate_network_component($source_id);
@ -267,7 +271,7 @@ $custom_string_2 = '';
$custom_string_3 = '';
// Header.
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
components_meta_print_header();
$sec = 'advanced';
} else {
@ -292,6 +296,12 @@ if (defined('METACONSOLE')) {
$sec = 'gmodules';
}
if ($is_management_allowed === false) {
ui_print_warning_message(
__('This node is configured with centralized mode. All Remote components information is read only. Go to metaconsole to manage it.')
);
}
if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
// New support for snmp v3.
$tcp_send = $snmp_version;
@ -307,7 +317,7 @@ if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
$custom_string_2 = $command_os;
}
if ($create_component) {
if ($is_management_allowed === true && $create_component) {
$name_check = db_get_value(
'name',
'tnetwork_component',
@ -410,7 +420,7 @@ if ($create_component) {
$id = 0;
}
if ($update_component) {
if ($is_management_allowed === true && $update_component) {
$id = (int) get_parameter('id');
if (!empty($name)) {
@ -502,7 +512,7 @@ if ($update_component) {
$id = 0;
}
if ($delete_component) {
if ($is_management_allowed === true && $delete_component) {
$id = (int) get_parameter('id');
$result = network_components_delete_network_component($id);
@ -527,7 +537,7 @@ if ($delete_component) {
$id = 0;
}
if ($multiple_delete) {
if ($is_management_allowed === true && $multiple_delete) {
$ids = (array) get_parameter('delete_multiple', []);
foreach ($ids as $id) {
@ -645,7 +655,7 @@ $table->data[0][3] = html_print_input_text(
255,
true
);
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$table->data[0][4] = '<div>';
} else {
$table->data[0][4] = '<div class="action-buttons">';
@ -660,7 +670,7 @@ $table->data[0][4] .= html_print_submit_button(
);
$table->data[0][4] .= '</div>';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$filter = '<form class="filters_form" method="post" action="'.$url.'">';
$filter .= html_print_table($table, true);
$filter .= '</form>';
@ -713,26 +723,38 @@ unset($table);
$table->width = '100%';
$table->head = [];
$table->class = 'info_table';
$table->head['checkbox'] = html_print_checkbox(
'all_delete',
0,
false,
true,
false
);
if ($is_management_allowed === true) {
$table->head['checkbox'] = html_print_checkbox(
'all_delete',
0,
false,
true,
false
);
}
$table->head[0] = __('Module name');
$table->head[1] = __('Server');
$table->head[2] = __('Type');
$table->head[3] = __('Description');
$table->head[4] = __('Group');
$table->head[5] = __('Max/Min');
$table->head[6] = __('Action');
if ($is_management_allowed === true) {
$table->head[6] = __('Action');
}
$table->size = [];
$table->size['checkbox'] = '20px';
if ($is_management_allowed === true) {
$table->size['checkbox'] = '20px';
}
$table->size[1] = '40px';
$table->size[2] = '50px';
$table->size[6] = '80px';
$table->align[6] = 'left';
if ($is_management_allowed === true) {
$table->size[6] = '80px';
$table->align[6] = 'left';
}
$table->data = [];
foreach ($components as $component) {
@ -743,19 +765,24 @@ foreach ($components as $component) {
$component['min'] = __('N/A');
}
$data['checkbox'] = html_print_checkbox_extended(
'delete_multiple[]',
$component['id_nc'],
false,
false,
'',
'class="check_delete"',
true
);
if ($is_management_allowed === true) {
$data['checkbox'] = html_print_checkbox_extended(
'delete_multiple[]',
$component['id_nc'],
false,
false,
'',
'class="check_delete"',
true
);
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
$data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>';
} else {
$data[0] = io_safe_output($component['name']);
}
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
$data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>';
switch ($component['id_modulo']) {
case MODULE_NETWORK:
$data[1] .= html_print_image(
@ -811,32 +838,37 @@ foreach ($components as $component) {
$data[4] = network_components_get_group_name($component['id_group']);
$data[5] = $component['max'].' / '.$component['min'];
$table->cellclass[][6] = 'action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
'images/copy.png',
true,
[
'alt' => __('Duplicate'),
'title' => __('Duplicate'),
'class' => 'invert_filter',
]
).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'class' => 'invert_filter',
]
).'</a>';
if ($is_management_allowed === true) {
$table->cellclass[][6] = 'action_buttons';
$data[6] = '<a class="inline_line float-left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image(
'images/copy.png',
true,
[
'alt' => __('Duplicate'),
'title' => __('Duplicate'),
'class' => 'invert_filter',
]
).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image(
'images/cross.png',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'class' => 'invert_filter',
]
).'</a>';
}
array_push($table->data, $data);
}
if (isset($data)) {
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
html_print_input_hidden('multiple_delete', 1);
if (isset($data) === true) {
if ($is_management_allowed === true) {
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
html_print_input_hidden('multiple_delete', 1);
}
html_print_table($table);
ui_pagination(
$total_components,
@ -848,15 +880,17 @@ if (isset($data)) {
true,
'pagination-bottom'
);
echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button(
__('Delete'),
'delete_btn',
false,
'class="sub delete"'
);
echo '</div>';
echo '</form>';
if ($is_management_allowed === true) {
echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button(
__('Delete'),
'delete_btn',
false,
'class="sub delete"'
);
echo '</div>';
echo '</form>';
}
} else {
ui_print_info_message(
[
@ -866,31 +900,33 @@ if (isset($data)) {
);
}
echo '<form method="post" action="'.$url.'">';
echo '<div class="right_align mrgn_btn_15px">';
html_print_input_hidden('new_component', 1);
html_print_select(
[
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
],
'id_component_type',
'',
'',
'',
'',
''
);
html_print_submit_button(
__('Create'),
'crt',
false,
'class="sub next mrgn_lft_5px"'
);
echo '</div>';
echo '</form>';
if ($is_management_allowed === true) {
echo '<form method="post" action="'.$url.'">';
echo '<div class="right_align mrgn_btn_15px">';
html_print_input_hidden('new_component', 1);
html_print_select(
[
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
],
'id_component_type',
'',
'',
'',
'',
''
);
html_print_submit_button(
__('Create'),
'crt',
false,
'class="sub next mrgn_lft_5px"'
);
echo '</div>';
echo '</form>';
}
enterprise_hook('close_meta_frame');

@ -94,7 +94,6 @@ if (is_metaconsole() === false) {
$sec = 'advanced';
}
$delete_profile = (bool) get_parameter('delete_profile');
$create_profile = (bool) get_parameter('create_profile');
$update_profile = (bool) get_parameter('update_profile');

@ -197,8 +197,11 @@ class TreeGroupEdition extends TreeGroup
$group_stats[$group['gid']] = $this->getProcessedItem(
$group_stats[$group['gid']]
);
$group_stats[$group['gid']]['delete']['messages'] = $messages;
$group_stats[$group['gid']]['edit'] = 1;
if (is_management_allowed() === true) {
$group_stats[$group['gid']]['delete']['messages'] = $messages;
$group_stats[$group['gid']]['edit'] = 1;
}
$group_stats[$group['gid']]['alerts'] = '';
}

@ -1085,7 +1085,7 @@ function snmp_browser_print_container(
true
);
if (enterprise_installed()) {
if (is_management_allowed() === true && enterprise_installed()) {
$output .= html_print_submit_button(
__('Create policy modules'),
'create_modules_policy',