Automattic\WooCommerce\Admin\API
PaymentGatewaySuggestions::get_permission_check()
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() PaymentGatewaySuggestions::get permission check WC 9.4.2
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; }