Automattic\WooCommerce\Admin\API

PaymentGatewaySuggestions::get_permission_check()publicWC 1.0

Check if a given request has access to manage plugins.

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

Хуков нет.

Возвращает

WP_Error|true|false.

Использование

$PaymentGatewaySuggestions = new PaymentGatewaySuggestions();
$PaymentGatewaySuggestions->get_permission_check( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код PaymentGatewaySuggestions::get_permission_check() WC 6.6.1

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;
}