Checks whether a given request has permission to read types.
Description
See also
Parameters
- $request
-
(WP_REST_Request) (Required) Full details about the request.
Return
(WP_Error|true) True if the request has read access, WP_Error object otherwise.
Source
File: src/db-objects/elements/element-types/rest-element-types-controller.php
public function get_items_permissions_check( $request ) { $capabilities = $this->manager->capabilities(); if ( 'edit' === $request['context'] && ( ! $capabilities || ! $capabilities->user_can_edit() ) ) { return new WP_Error( 'rest_cannot_edit_types', __( 'Sorry, you are not allowed to edit elements and their types.', 'torro-forms' ), array( 'status' => rest_authorization_required_code() ) ); } if ( ! $this->manager->is_public() && ( ! $capabilities || ! $capabilities->user_can_read() ) ) { return new WP_Error( 'rest_cannot_read_types', __( 'Sorry, you are not allowed to view elements and their types.', 'torro-forms' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |