Fix the permission check for telemetry data
Any logged in user should be able to post telemetry data
This commit is contained in:
parent
56a82a0b9d
commit
185313fe75
|
@ -52,14 +52,14 @@ class WC_REST_Telemetry_V2_Controller extends WC_REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a given request has permission to view system status.
|
* Check whether a given request has permission to post telemetry data
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return WP_Error|boolean
|
* @return WP_Error|boolean
|
||||||
*/
|
*/
|
||||||
public function telemetry_permissions_check( $request ) {
|
public function telemetry_permissions_check( $request ) {
|
||||||
if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you post telemetry data.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue