ArrayOf.php
2 months ago
ConnectionOf.php
2 months ago
Deprecated.php
2 months ago
Description.php
2 months ago
Experimental.php
4 weeks ago
HiddenFromMetadataQuery.php
4 weeks ago
Ignore.php
2 months ago
Internal.php
4 weeks ago
Metadata.php
4 weeks ago
Name.php
2 months ago
Parameter.php
2 months ago
ParameterDescription.php
2 months ago
PublicAccess.php
4 weeks ago
RequiredCapability.php
4 weeks ago
ReturnType.php
2 months ago
ScalarType.php
2 months ago
Unroll.php
2 months ago
PublicAccess.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Api\Attributes; |
| 6 | |
| 7 | use Attribute; |
| 8 | |
| 9 | /** |
| 10 | * Marks a query or mutation as publicly accessible without authentication. |
| 11 | * |
| 12 | * Mutually exclusive with #[RequiredCapability] (and any other authorization |
| 13 | * attribute) on the same class — this is a hard build error. |
| 14 | * |
| 15 | * Placement on a property (output field or input field) is accepted but is |
| 16 | * a build warning and a runtime no-op: it always grants, which is |
| 17 | * indistinguishable from the default allow-by-default semantics for fields |
| 18 | * that carry no authorization attribute. |
| 19 | */ |
| 20 | #[Attribute( Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY )] |
| 21 | final class PublicAccess { |
| 22 | /** |
| 23 | * Always grants access. |
| 24 | */ |
| 25 | public function authorize(): bool { |
| 26 | return true; |
| 27 | } |
| 28 | } |
| 29 |