Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLQueries

GetProduct::compute_preauthorizedpublic staticWC 1.0

Compute the value _preauthorized would carry for a given principal — the AND of the autodiscovered authorization attributes' authorize() outcomes on this command. Single source of truth for both the resolver's own gates and external (code-API) callers asking about authorization without going through GraphQL execution.

Returns true vacuously when the command has no authorization attributes (in that case authorize() on the command is the sole guard, and that method should be consulted instead).

Method of the class: GetProduct{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = GetProduct::compute_preauthorized( $principal ): bool;
$principal(Automattic\WooCommerce\Api\Infrastructure\Principal) (required)
.

GetProduct::compute_preauthorized() code WC 10.9.1

public static function compute_preauthorized( \Automattic\WooCommerce\Api\Infrastructure\Principal $principal ): bool {
	return ( new \Automattic\WooCommerce\Api\Attributes\RequiredCapability( 'read_product' ) )->authorize( $principal );
}