Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions v3/lib/endpoints/class-acf-to-rest-api-options-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,23 @@ public function register_routes() {
) );
}

/**
* Check if a given request has access to get items
*
* @param WP_REST_Request $request Full data about the request.
* @return WP_Error|bool
*/
public function get_item_permissions_check( $request ) {
if ( ! current_user_can( 'manage_options' ) ) {
return new WP_Error(
'rest_forbidden_context',
__( 'Sorry, you are not allowed to access options.', 'acf-to-rest-api' ),
array( 'status' => rest_authorization_required_code() )
);
}
return true;
}

}
}