Automattic\WooCommerce\Admin\API

PaymentGatewaySuggestions::get_permission_check()publicWC 1.0

Check if a given request has access to manage plugins.

Метод класса: PaymentGatewaySuggestions{}

No Hooks.

Return

WP_Error|true|false.

Usage

$PaymentGatewaySuggestions = new PaymentGatewaySuggestions();
$PaymentGatewaySuggestions->get_permission_check( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Code of PaymentGatewaySuggestions::get_permission_check() WC 7.1.0

public function get_permission_check( $request ) {
	if ( ! current_user_can( 'install_plugins' ) ) {
		return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
	}
	return true;
}