REST API: Merge two similar permission error strings.

Props ramiy.
Fixes #38857.
Built from https://develop.svn.wordpress.org/trunk@39304


git-svn-id: http://core.svn.wordpress.org/trunk@39244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2016-11-18 23:53:30 +00:00
parent e12d3813f0
commit 9cb0a09d1f
4 changed files with 4 additions and 4 deletions

View File

@ -127,7 +127,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
} }
if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) { if ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) {
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to manage this resource.' ), array( 'status' => rest_authorization_required_code() ) ); return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) );
} }
$data = $this->prepare_item_for_response( $obj, $request ); $data = $this->prepare_item_for_response( $obj, $request );

View File

@ -141,7 +141,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
return false; return false;
} }
if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->manage_terms ) ) { if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->manage_terms ) ) {
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to manage this resource.' ), array( 'status' => rest_authorization_required_code() ) ); return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) );
} }
} }

View File

@ -515,7 +515,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
$id = (int) $request['id']; $id = (int) $request['id'];
if ( ! current_user_can( 'edit_user', $id ) ) { if ( ! current_user_can( 'edit_user', $id ) ) {
return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit resource.' ), array( 'status' => rest_authorization_required_code() ) ); return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.' ), array( 'status' => rest_authorization_required_code() ) );
} }
if ( ! empty( $request['roles'] ) && ! current_user_can( 'edit_users' ) ) { if ( ! empty( $request['roles'] ) && ! current_user_can( 'edit_users' ) ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta4-39303'; $wp_version = '4.7-beta4-39304';
/** /**
* 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.