Merge branch 'ent-8769-13353-usuario-no-admin-solo-puede-gestionar-agentes-de-1-nodo' into 'develop'

Ent 8769 13353 usuario no admin solo puede gestionar agentes de 1 nodo

See merge request artica/pandorafms!4942
This commit is contained in:
Diego Muñoz-Reja 2022-07-14 13:38:31 +00:00
commit 5650758e5a
4 changed files with 12 additions and 22 deletions

View File

@ -36,4 +36,6 @@ ALTER TABLE `tautoconfig` ADD COLUMN `periodically_day_from` INT UNSIGNED DEFAUL
ALTER TABLE `tautoconfig` ADD COLUMN `periodically_time_from` time NULL DEFAULT NULL;
ALTER TABLE `tautoconfig` ADD COLUMN `executed` TINYINT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`;
COMMIT;

View File

@ -526,7 +526,8 @@ $menu_godmode['links']['sub'] = $sub;
// Warp Manager.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true && (bool) $config['enable_update_manager'] === true) {
$menu_godmode['messages']['text'] = __('Warp Update');;
$menu_godmode['messages']['text'] = __('Warp Update');
;
$menu_godmode['messages']['id'] = 'god-um_messages';
$menu_godmode['messages']['sec2'] = '';

View File

@ -301,7 +301,6 @@ if ($new_user && $config['admin_can_add_user']) {
if (enterprise_installed() && is_metaconsole() === true) {
$user_info['metaconsole_agents_manager'] = 0;
$user_info['metaconsole_assigned_server'] = '';
$user_info['metaconsole_access_node'] = 0;
}
@ -375,7 +374,6 @@ if ($create_user) {
if (defined('METACONSOLE')) {
$values['metaconsole_access'] = get_parameter('metaconsole_access', 'basic');
$values['metaconsole_agents_manager'] = ($user_is_admin == 1 ? 1 : get_parameter('metaconsole_agents_manager', '0'));
$values['metaconsole_assigned_server'] = get_parameter('metaconsole_assigned_server', '');
$values['metaconsole_access_node'] = ($user_is_admin == 1 ? 1 : get_parameter('metaconsole_access_node', '0'));
}
}
@ -588,7 +586,6 @@ if ($update_user) {
if (enterprise_installed() && defined('METACONSOLE')) {
$values['metaconsole_access'] = get_parameter('metaconsole_access');
$values['metaconsole_agents_manager'] = get_parameter('metaconsole_agents_manager', '0');
$values['metaconsole_assigned_server'] = get_parameter('metaconsole_assigned_server', '');
$values['metaconsole_access_node'] = get_parameter('metaconsole_access_node', '0');
}
@ -1357,15 +1354,6 @@ if ($meta) {
true
).'</div>';
$metaconsole_assigned_server = '<div class="label_select" id="metaconsole_assigned_server_div"><p class="edit_user_labels">'.__('Assigned node').ui_print_help_tip(__('Server where the agents created of this user will be placed'), true).'</p>';
$servers = metaconsole_get_servers();
$servers_for_select = [];
foreach ($servers as $server) {
$servers_for_select[$server['id']] = $server['server_name'];
}
$metaconsole_assigned_server .= html_print_select($servers_for_select, 'metaconsole_assigned_server', $user_info['metaconsole_assigned_server'], '', '', -1, true, false, false).'</div>';
$metaconsole_access_node = '<div class="label_select_simple" id="metaconsole_access_node_div"><p class="edit_user_labels">'.__('Enable node access').ui_print_help_tip(__('With this option enabled, the user will can access to nodes console'), true).'</p>';
$metaconsole_access_node .= html_print_checkbox(
'metaconsole_access_node',
@ -1416,7 +1404,7 @@ if (!is_metaconsole()) {
<map name="timezone-map" id="timezone-map">'.$area_data_timezone_polys.$area_data_timezone_rects.'</map>
</div>';
} else {
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_assigned_server.$metaconsole_access_node;
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_access_node;
}
echo '</div>
@ -1535,16 +1523,16 @@ $(document).ready (function () {
});
$('#checkbox-is_admin').change(function() {
if($('#checkbox-is_admin').is(':checked') == true) {
$('#metaconsole_agents_manager_div').show();
$('#metaconsole_access_node_div').show();
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
$('#metaconsole_assigned_server_div').show();
}
} else {
if ($('#checkbox-is_admin').is(':checked') == true) {
$('#metaconsole_agents_manager_div').hide();
$('#metaconsole_access_node_div').hide();
$('#metaconsole_assigned_server_div').hide();
} else {
$('#metaconsole_agents_manager_div').show();
$('#metaconsole_access_node_div').show();
if ($('#checkbox-metaconsole_agents_manager').prop('checked')) {
$('#metaconsole_assigned_server_div').show();
}
}
});

View File

@ -1291,7 +1291,6 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`not_login` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`local_user` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`metaconsole_agents_manager` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`metaconsole_assigned_server` INT UNSIGNED NOT NULL DEFAULT 0,
`metaconsole_access_node` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`strict_acl` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`id_filter` INT UNSIGNED NULL DEFAULT NULL,