Make WordPress Core


Ignore:
Timestamp:
07/06/2021 03:55:02 PM (4 years ago)
Author:
desrosj
Message:

REST API: Add the $request parameter to methods checking permissions.

This adds the $request parameter to the permissions_check() methods within WP_REST_Widgets_Controller and adds $request as an allowed parameter to the permissions_check() method within WP_REST_Templates_Controller.

Even when this parameter is not used by default, it should be implemented to support the class being extended and the method overridden.

Props johnbillion, timothyblynjacobs.
Merges [51349] to the 5.8 branch.
Fixes #53593.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

    r51317 r51350  
    110110     * @since 5.8.0
    111111     *
     112     * @param WP_REST_Request $request Full details about the request.
    112113     * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
    113114     */
    114     protected function permissions_check() {
     115    protected function permissions_check( $request ) {
    115116        // Verify if the current user has edit_theme_options capability.
    116117        // This capability is required to edit/view/delete templates.
Note: See TracChangeset for help on using the changeset viewer.