| @@ -12,8 +12,14 @@ | ||
| 12 | 12 | /** |
| 13 | 13 | * Applies tax ID narrowing and POS read permission without a v1 controller. |
| 14 | 14 | */ |
| 15 | 15 | final class Taxes_Proxy_Behavior extends Scoped_Proxy_Behavior { |
| 16 | + /** POS read grant for this collection only. | |
| 17 | + * | |
| 18 | + * @var string | |
| 19 | + */ | |
| 20 | + protected $permission_collection = 'tax_rates'; | |
| 21 | + | |
| 16 | 22 | /** |
| 17 | 23 | * The Collection Rules plan for the request in flight. |
| 18 | 24 | * |
| 19 | 25 | * @var int[] |
| @@ -53,17 +59,8 @@ | ||
| 53 | 59 | * @return array<int, array{0: string, 1: callable, 2: int}> |
| 54 | 60 | */ |
| 55 | 61 | protected function install(): array { |
| 56 | 62 | $bindings = array(); |
| 57 | - $permission = static function ( $allowed, $context, $object_id, $post_type ) { | |
| 58 | - if ( ! $allowed && 'settings' === $post_type && 'read' === $context ) { | |
| 59 | - $allowed = current_user_can( 'access_woocommerce_pos' ); | |
| 60 | - } | |
| 61 | - | |
| 62 | - return $allowed; | |
| 63 | - }; | |
| 64 | - add_filter( 'woocommerce_rest_check_permissions', $permission, 10, 4 ); | |
| 65 | - $bindings[] = array( 'woocommerce_rest_check_permissions', $permission, 10 ); | |
| 66 | 63 | |
| 67 | 64 | if ( array() === $this->include && array() === $this->exclude ) { |
| 68 | 65 | return $bindings; |
| 69 | 66 | } |