Ticket #48812: patch.diff
File patch.diff, 2.0 KB (added by , 5 years ago) |
---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
43 43 'methods' => WP_REST_Server::READABLE, 44 44 'callback' => array( $this, 'get_item' ), 45 45 'args' => array(), 46 'permission_callback' => array( $this, ' get_item_permissions_check' ),46 'permission_callback' => array( $this, 'read_item_permissions_check' ), 47 47 ), 48 48 array( 49 49 'methods' => WP_REST_Server::EDITABLE, 50 50 'callback' => array( $this, 'update_item' ), 51 51 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ), 52 'permission_callback' => array( $this, ' get_item_permissions_check' ),52 'permission_callback' => array( $this, 'edit_item_permissions_check' ), 53 53 ), 54 54 'schema' => array( $this, 'get_public_item_schema' ), 55 55 ) … … 58 58 } 59 59 60 60 /** 61 * Checks if a given request has access to read settings. 62 * 63 * @since ? 64 * 65 * @param WP_REST_Request $request Full details about the request. 66 * @return bool True if the request has read access for the item, otherwise false. 67 */ 68 public function read_item_permissions_check( $request ) { 69 return current_user_can( 'edit_posts' ); 70 } 71 72 /** 61 73 * Checks if a given request has access to read and manage settings. 62 74 * 63 75 * @since 4.7.0 64 76 * 65 77 * @param WP_REST_Request $request Full details about the request. 66 * @return bool True if the request has read a ccess for the item, otherwise false.78 * @return bool True if the request has read and edit access for the item, otherwise false. 67 79 */ 68 public function get_item_permissions_check( $request ) {80 public function edit_item_permissions_check( $request ) { 69 81 return current_user_can( 'manage_options' ); 70 82 } 71 83