WordPress at Your Fingertips
function is not described

WC_API_Authentication::check_api_key_permissions() public WC 1.0

Check that the API keys provided have the proper key-specific permissions to either read or write API resources

{} It's a method of the class: WC_API_Authentication{}

No Hooks.

Return

null. Nothing.

Usage

$WC_API_Authentication = new WC_API_Authentication();
$WC_API_Authentication->check_api_key_permissions( $key_permissions );
$key_permissions(string) (required)
-

Code of WC_API_Authentication::check_api_key_permissions() WC 5.5.2

<?php
public function check_api_key_permissions( $key_permissions ) {
	switch ( WC()->api->server->method ) {

		case 'HEAD':
		case 'GET':
			if ( 'read' !== $key_permissions && 'read_write' !== $key_permissions ) {
				throw new Exception( __( 'The API key provided does not have read permissions.', 'woocommerce' ), 401 );
			}
			break;

		case 'POST':
		case 'PUT':
		case 'PATCH':
		case 'DELETE':
			if ( 'write' !== $key_permissions && 'read_write' !== $key_permissions ) {
				throw new Exception( __( 'The API key provided does not have write permissions.', 'woocommerce' ), 401 );
			}
			break;
	}
}