mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
REST API: Correct the docblocks for various permission related methods.
See #58833 Built from https://develop.svn.wordpress.org/trunk@56415 git-svn-id: http://core.svn.wordpress.org/trunk@55927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4667b9323f
commit
3d796edc68
@ -57,7 +57,7 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller {
|
|||||||
* @since 5.9.0
|
* @since 5.9.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return bool|WP_Error True if the request has read access for the item, WP_Error object otherwise.
|
* @return bool|WP_Error True if the request has read access for the item, WP_Error object or false otherwise.
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
$permission_check = parent::get_item_permissions_check( $request );
|
$permission_check = parent::get_item_permissions_check( $request );
|
||||||
@ -77,7 +77,7 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller {
|
|||||||
* @since 5.9.0
|
* @since 5.9.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return bool|WP_Error Whether the current user has permission.
|
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
|
||||||
*/
|
*/
|
||||||
protected function check_has_read_only_access( $request ) {
|
protected function check_has_read_only_access( $request ) {
|
||||||
if ( current_user_can( 'edit_theme_options' ) ) {
|
if ( current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
@ -120,7 +120,7 @@ class WP_REST_Menu_Locations_Controller extends WP_REST_Controller {
|
|||||||
* @since 5.9.0
|
* @since 5.9.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise.
|
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
@ -40,7 +40,7 @@ class WP_REST_Menus_Controller extends WP_REST_Terms_Controller {
|
|||||||
* @since 5.9.0
|
* @since 5.9.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return bool|WP_Error True if the request has read access for the item, otherwise false or WP_Error object.
|
* @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object.
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
$has_permission = parent::get_item_permissions_check( $request );
|
$has_permission = parent::get_item_permissions_check( $request );
|
||||||
@ -81,7 +81,7 @@ class WP_REST_Menus_Controller extends WP_REST_Terms_Controller {
|
|||||||
* @since 5.9.0
|
* @since 5.9.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return bool|WP_Error Whether the current user has permission.
|
* @return true|WP_Error True if the current user has permission, WP_Error object otherwise.
|
||||||
*/
|
*/
|
||||||
protected function check_has_read_only_access( $request ) {
|
protected function check_has_read_only_access( $request ) {
|
||||||
if ( current_user_can( 'edit_theme_options' ) ) {
|
if ( current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
@ -475,7 +475,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||||||
* @since 4.7.0
|
* @since 4.7.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
|
* @return bool|WP_Error True if the request has read access for the item, WP_Error object or false otherwise.
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
$post = $this->get_post( $request['id'] );
|
$post = $this->get_post( $request['id'] );
|
||||||
@ -1506,7 +1506,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||||||
*
|
*
|
||||||
* @param string $template Page template filename.
|
* @param string $template Page template filename.
|
||||||
* @param WP_REST_Request $request Request.
|
* @param WP_REST_Request $request Request.
|
||||||
* @return bool|WP_Error True if template is still valid or if the same as existing value, or false if template not supported.
|
* @return true|WP_Error True if template is still valid or if the same as existing value, or a WP_Error if template not supported.
|
||||||
*/
|
*/
|
||||||
public function check_template( $template, $request ) {
|
public function check_template( $template, $request ) {
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
|||||||
* @since 4.7.0
|
* @since 4.7.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return true|WP_Error True if the request has read access, otherwise false or WP_Error object.
|
* @return bool|WP_Error True if the request has read access, otherwise false or WP_Error object.
|
||||||
*/
|
*/
|
||||||
public function get_items_permissions_check( $request ) {
|
public function get_items_permissions_check( $request ) {
|
||||||
$tax_obj = get_taxonomy( $this->taxonomy );
|
$tax_obj = get_taxonomy( $this->taxonomy );
|
||||||
@ -417,7 +417,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
|||||||
* @since 4.7.0
|
* @since 4.7.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object.
|
* @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object.
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
$term = $this->get_term( $request['id'] );
|
$term = $this->get_term( $request['id'] );
|
||||||
|
@ -118,7 +118,7 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
|||||||
* @since 5.7.0
|
* @since 5.7.0
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return bool|WP_Error True if the request has read access for the item, otherwise WP_Error object.
|
* @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object.
|
||||||
*/
|
*/
|
||||||
public function get_item_permissions_check( $request ) {
|
public function get_item_permissions_check( $request ) {
|
||||||
if ( current_user_can( 'switch_themes' ) || current_user_can( 'manage_network_themes' ) ) {
|
if ( current_user_can( 'switch_themes' ) || current_user_can( 'manage_network_themes' ) ) {
|
||||||
@ -144,7 +144,7 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
|||||||
*
|
*
|
||||||
* @since 5.7.0
|
* @since 5.7.0
|
||||||
*
|
*
|
||||||
* @return bool|WP_Error Whether the theme can be read.
|
* @return true|WP_Error True if the theme can be read, WP_Error object otherwise.
|
||||||
*/
|
*/
|
||||||
protected function check_read_active_theme_permission() {
|
protected function check_read_active_theme_permission() {
|
||||||
if ( current_user_can( 'edit_posts' ) ) {
|
if ( current_user_can( 'edit_posts' ) ) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56414';
|
$wp_version = '6.4-alpha-56415';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user