diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 2757af500e..cc5762fed8 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -140,7 +140,9 @@ if (is_ajax()) { $has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2); - if ($has_profile == false) { + $user_is_global_admin = users_is_admin($id2); + + if ($has_profile === false && $user_is_global_admin === false) { $result = delete_user($id2); if ($result) { @@ -1542,6 +1544,7 @@ $(document).ready (function () { var img_delete = ''; var id_user = ''; var is_metaconsole = ''; + var user_is_global_admin = ''; var data = []; $('input:image[name="add"]').click(function (e) { @@ -1586,7 +1589,7 @@ $(document).ready (function () { $('input:image[name="del"]').click(function (e) { e.preventDefault(); var rows = $("#table_profiles tr").length; - if ((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) { + if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') { if (!confirm('' + '. ' + '')) { return; } @@ -1608,8 +1611,11 @@ $(document).ready (function () { success: function (data) { row.remove(); var rows = $("#table_profiles tr").length; - if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) { + + if (is_metaconsole === '' && rows <= 2 && user_is_global_admin !== '1') { window.location.replace(""); + } else if (is_metaconsole === '1' && rows <= 3 && user_is_global_admin !== '1') { + window.location.replace(""); } } }); @@ -1748,7 +1754,6 @@ function show_double_auth_info () { var $dialogContainer = $("div#dialog-double_auth-container"); $dialogContainer.html($loadingSpinner); -console.log(userID); // Load the info page var request = $.ajax({ url: "", @@ -1913,7 +1918,6 @@ function show_double_auth_deactivation () { }, success: function(data, textStatus, xhr) { - console.log(data); if (data === -1) { $dialogContainer.html("
'.__('Authentication error').'
'; ?>"); }