Merge pull request #1336 from Chanaka/RFE-1521
rfe-1521 : Add confirmation, when delete user
This commit is contained in:
commit
f1c5ec25c7
@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog
|
||||
======================
|
||||
|
||||
4.3.0.0 (not yet released)
|
||||
+ rfe #1521 Confirmation message when dropping user(s)
|
||||
+ rfe #1518 Confirm dialog on accidentally leaving a page
|
||||
+ rfe #1445 Easy access to "SHOW CREATE ..."
|
||||
+ rfe #1448 Allow clicking an approximate row count to get a correct one
|
||||
|
||||
@ -45,6 +45,7 @@ $js_messages['strOperationTakesLongTime'] = __('This operation could take a long
|
||||
$js_messages['strDropUserGroupWarning'] = __('Do you really want to delete user group "%s"?');
|
||||
$js_messages['strConfirmDeleteQBESearch'] = __('Do you really want to delete the search "%s"?');
|
||||
$js_messages['strConfirmNavigation'] = __('You have unsaved changes; are you sure you want to leave this page?');
|
||||
$js_messages['strDropUserWarning'] = __('Do you really want to revoke the selected user(s) ?');
|
||||
|
||||
/* For modal dialog buttons */
|
||||
$js_messages['strSaveAndClose'] = __('Save & Close');
|
||||
|
||||
@ -294,52 +294,58 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
$("#fieldset_delete_user_footer #buttonGo.ajax").live('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
$drop_users_db_checkbox = $("#checkbox_drop_users_db");
|
||||
if ($drop_users_db_checkbox.is(':checked')) {
|
||||
var is_confirmed = confirm(PMA_messages.strDropDatabaseStrongWarning + '\n' + $.sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE'));
|
||||
if (! is_confirmed) {
|
||||
// Uncheck the drop users database checkbox
|
||||
$drop_users_db_checkbox.prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages.strRemovingSelectedUsers);
|
||||
|
||||
var $thisButton = $(this);
|
||||
var $form = $("#usersForm");
|
||||
|
||||
$.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).val() + "&ajax_request=true", function (data) {
|
||||
if (data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
// Refresh navigation, if we droppped some databases with the name
|
||||
// that is the same as the username of the deleted user
|
||||
if ($('#checkbox_drop_users_db:checked').length) {
|
||||
PMA_reloadNavigation();
|
||||
|
||||
$thisButton.PMA_confirm(PMA_messages.strDropUserWarning, $form.attr('action'), function (url) {
|
||||
|
||||
$drop_users_db_checkbox = $("#checkbox_drop_users_db");
|
||||
if ($drop_users_db_checkbox.is(':checked')) {
|
||||
var is_confirmed = confirm(PMA_messages.strDropDatabaseStrongWarning + '\n' + $.sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE'));
|
||||
if (! is_confirmed) {
|
||||
// Uncheck the drop users database checkbox
|
||||
$drop_users_db_checkbox.prop('checked', false);
|
||||
}
|
||||
//Remove the revoked user from the users list
|
||||
$form.find("input:checkbox:checked").parents("tr").slideUp("medium", function () {
|
||||
var this_user_initial = $(this).find('input:checkbox').val().charAt(0).toUpperCase();
|
||||
$(this).remove();
|
||||
|
||||
//If this is the last user with this_user_initial, remove the link from #initials_table
|
||||
if ($("#tableuserrights").find('input:checkbox[value^="' + this_user_initial + '"]').length === 0) {
|
||||
$("#initials_table").find('td > a:contains(' + this_user_initial + ')').parent('td').html(this_user_initial);
|
||||
}
|
||||
|
||||
//Re-check the classes of each row
|
||||
$form
|
||||
.find('tbody').find('tr:odd')
|
||||
.removeClass('even').addClass('odd')
|
||||
.end()
|
||||
.find('tr:even')
|
||||
.removeClass('odd').addClass('even');
|
||||
|
||||
//update the checkall checkbox
|
||||
$(checkboxes_sel).trigger("change");
|
||||
});
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages.strRemovingSelectedUsers);
|
||||
|
||||
$.post(url, $form.serialize() + "&delete=" + $thisButton.val() + "&ajax_request=true", function (data) {
|
||||
if (data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
// Refresh navigation, if we droppped some databases with the name
|
||||
// that is the same as the username of the deleted user
|
||||
if ($('#checkbox_drop_users_db:checked').length) {
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
//Remove the revoked user from the users list
|
||||
$form.find("input:checkbox:checked").parents("tr").slideUp("medium", function () {
|
||||
var this_user_initial = $(this).find('input:checkbox').val().charAt(0).toUpperCase();
|
||||
$(this).remove();
|
||||
|
||||
//If this is the last user with this_user_initial, remove the link from #initials_table
|
||||
if ($("#tableuserrights").find('input:checkbox[value^="' + this_user_initial + '"], input:checkbox[value^="' + this_user_initial.toLowerCase() + '"]').length === 0) {
|
||||
$("#initials_table").find('td > a:contains(' + this_user_initial + ')').parent('td').html(this_user_initial);
|
||||
}
|
||||
|
||||
//Re-check the classes of each row
|
||||
$form
|
||||
.find('tbody').find('tr:odd')
|
||||
.removeClass('even').addClass('odd')
|
||||
.end()
|
||||
.find('tr:even')
|
||||
.removeClass('odd').addClass('even');
|
||||
|
||||
//update the checkall checkbox
|
||||
$(checkboxes_sel).trigger("change");
|
||||
});
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
|
||||
});
|
||||
|
||||
}); // end Revoke User
|
||||
|
||||
$("a.edit_user_group_anchor.ajax").live('click', function (event) {
|
||||
|
||||
@ -279,7 +279,7 @@ if ($GLOBALS['is_ajax_request']
|
||||
&& ! isset($_REQUEST['export'])
|
||||
&& (! isset($_REQUEST['submit_mult']) || $_REQUEST['submit_mult'] != 'export')
|
||||
&& (! isset($_REQUEST['adduser']) || $_add_user_error)
|
||||
&& (! isset($_REQUEST['initial']) || empty($_REQUEST['initial']))
|
||||
&& ((! isset($_REQUEST['initial']) || empty($_REQUEST['initial'])) || (isset($_REQUEST['delete']) && $_REQUEST['delete'] === 'Go'))
|
||||
&& ! isset($_REQUEST['showall'])
|
||||
&& ! isset($_REQUEST['edit_user_dialog'])
|
||||
&& ! isset($_REQUEST['edit_user_group_dialog'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user