Privacy: Return a more accurate error message when the user cannot perform the requested action.

Props mmuhsin, jplojohn, garrett-eclipse, desrosj.
Fixes #44833.
Built from https://develop.svn.wordpress.org/trunk@44777


git-svn-id: http://core.svn.wordpress.org/trunk@44609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-02-28 11:49:51 +00:00
parent c78d28d9f1
commit abf27c3b62
2 changed files with 3 additions and 3 deletions

View File

@ -4452,7 +4452,7 @@ function wp_ajax_wp_privacy_export_personal_data() {
} }
if ( ! current_user_can( 'export_others_personal_data' ) ) { if ( ! current_user_can( 'export_others_personal_data' ) ) {
wp_send_json_error( __( 'Invalid request.' ) ); wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) );
} }
check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' ); check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );
@ -4634,7 +4634,7 @@ function wp_ajax_wp_privacy_erase_personal_data() {
// Both capabilities are required to avoid confusion, see `_wp_personal_data_removal_page()`. // Both capabilities are required to avoid confusion, see `_wp_personal_data_removal_page()`.
if ( ! current_user_can( 'erase_others_personal_data' ) || ! current_user_can( 'delete_users' ) ) { if ( ! current_user_can( 'erase_others_personal_data' ) || ! current_user_can( 'delete_users' ) ) {
wp_send_json_error( __( 'Invalid request.' ) ); wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) );
} }
check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' ); check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2-alpha-44776'; $wp_version = '5.2-alpha-44777';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.