Make WordPress Core


Ignore:
Timestamp:
11/15/2016 10:22:33 PM (9 years ago)
Author:
SergeyBiryukov
Message:

REST API: Unify permission error messages.

Props ramiy.
Fixes #38803.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    r39223 r39257  
    142142        }
    143143        if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
    144             return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannot view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     144            return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
    145145        }
    146146        return true;
     
    303303        }
    304304        if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
    305             return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannot view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
     305            return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this resource with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
    306306        }
    307307        return true;
     
    351351        $taxonomy_obj = get_taxonomy( $this->taxonomy );
    352352        if ( ! current_user_can( $taxonomy_obj->cap->manage_terms ) ) {
    353             return new WP_Error( 'rest_cannot_create', __( 'Sorry, you cannot create new resource.' ), array( 'status' => rest_authorization_required_code() ) );
     353            return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new resource.' ), array( 'status' => rest_authorization_required_code() ) );
    354354        }
    355355
     
    458458
    459459        if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
    460             return new WP_Error( 'rest_cannot_update', __( 'Sorry, you cannot update resource.' ), array( 'status' => rest_authorization_required_code() ) );
     460            return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to update resource.' ), array( 'status' => rest_authorization_required_code() ) );
    461461        }
    462462
     
    547547
    548548        if ( ! current_user_can( 'delete_term', $term->term_id ) ) {
    549             return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you cannot delete resource.' ), array( 'status' => rest_authorization_required_code() ) );
     549            return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete resource.' ), array( 'status' => rest_authorization_required_code() ) );
    550550        }
    551551
Note: See TracChangeset for help on using the changeset viewer.