diff --git a/js/server_privileges.js b/js/server_privileges.js index 0d8fe40d5..8b9c5e99c 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -389,8 +389,18 @@ $(document).ready(function() { appendNewUser(data.new_user_string, data.new_user_initial, data.new_user_initial_string); } - //Change privileges if they were edited - if(data.new_privileges) { + //Check if we are on the page of the db-specific privileges + var db_priv_page = !!($('#dbspecificuserrights').length); // the "!!" part is merely there to ensure a value of type boolean + // we always need to reload on the db-specific privilege page + // and on the global page when adjusting global privileges, + // but not on the global page when adjusting db-specific privileges. + var reload_privs = false; + if (data.db_specific_privs == false || (db_priv_page == data.db_specific_privs)) { + reload_privs = true; + } + + //Change privileges, if they were edited and need to be reloaded + if(data.new_privileges && reload_privs) { $("#usersForm") .find('.current_row') .find('tt') diff --git a/server_privileges.php b/server_privileges.php index 1389cb9f3..51127ced1 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -1440,6 +1440,10 @@ if( $GLOBALS['is_ajax_request'] && !isset($_REQUEST['export']) && !isset($_REQUE } if(isset($update_privs)) { + $extra_data['db_specific_privs'] = false; + if (isset($dbname_is_wildcard)) { + $extra_data['db_specific_privs'] = !$dbname_is_wildcard; + } $new_privileges = join(', ', PMA_extractPrivInfo('', true)); $extra_data['new_privileges'] = $new_privileges; @@ -2161,7 +2165,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . '' . "\n"; } else { // check the privileges for a particular database. - echo '