Merge branch 'ent-2002-Remote-component-centralizado' into 'develop'

Blocked create and update of remote component group when meta has centralized management

Closes pandora_enterprise#2002

See merge request artica/pandorafms!3272
This commit is contained in:
Daniel Rodriguez 2020-07-10 10:11:25 +02:00
commit 8b24faa129
1 changed files with 35 additions and 20 deletions

View File

@ -46,14 +46,15 @@ if (defined('METACONSOLE')) {
$sec = 'gmodules';
}
$create = (bool) get_parameter('create');
$update = (bool) get_parameter('update');
$delete = (bool) get_parameter('delete');
$new = (bool) get_parameter('new');
$id = (int) get_parameter('id');
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
$pure = get_parameter('pure', 0);
if (is_management_allowed() === true) {
$create = (bool) get_parameter('create');
$update = (bool) get_parameter('update');
$delete = (bool) get_parameter('delete');
$new = (bool) get_parameter('new');
$id = (int) get_parameter('id');
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
$pure = get_parameter('pure', 0);
}
if ($create) {
$name = (string) get_parameter('name');
@ -186,7 +187,7 @@ if ($multiple_delete) {
);
}
if (($id || $new) && !$delete && !$multiple_delete) {
if (($id || $new) && !$delete && !$multiple_delete && is_management_allowed() === true) {
include_once 'manage_nc_groups_form.php';
return;
}
@ -229,7 +230,10 @@ $table->class = 'info_table';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name');
$table->head[1] = __('Action');
if (is_management_allowed() === true) {
$table->head[1] = __('Action');
}
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->align = [];
@ -258,31 +262,42 @@ foreach ($groups as $group) {
}
$table->cellclass[][1] = 'action_buttons';
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
if (is_management_allowed() === true) {
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
}
array_push($table->data, $data);
}
if (is_management_allowed() === false) {
ui_print_warning_message(__('This node is configured with centralized mode. This page is for read only. Go to metaconsole to manage the component groups.'));
}
if (isset($data)) {
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_nc_groups'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
echo "<div style='padding-left: 10px; float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
if (is_management_allowed() === true) {
echo "<div style='padding-left: 10px; float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
}
echo '</form>';
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined component groups') ]);
}
if (is_management_allowed() === true) {
echo '<form method="post" action='.$url.'>';
echo '<div class="" style="float:right;">';
html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
}
echo '<form method="post" action='.$url.'>';
echo '<div class="" style="float:right;">';
html_print_input_hidden('new', 1);
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
enterprise_hook('close_meta_frame');
?>