| 1 |
<?php |
| 2 |
/** |
| 3 |
* Reader_Terms_Controller file. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Activitypub\Rest; |
| 9 |
|
| 10 |
/** |
| 11 |
* Reader_Terms_Controller class. |
| 12 |
* |
| 13 |
* Restricts the WordPress REST routes that core generates for the `ap_tag` and |
| 14 |
* `ap_object_type` taxonomies. Their terms are derived from the cached remote |
| 15 |
* posts, so they are limited to users who can use ActivityPub. |
| 16 |
* |
| 17 |
* @since 9.3.0 |
| 18 |
*/ |
| 19 |
class Reader_Terms_Controller extends \WP_REST_Terms_Controller { |
| 20 |
use Reader_Permission; |
| 21 |
|
| 22 |
/** |
| 23 |
* Check whether a request has read access to a single term. |
| 24 |
* |
| 25 |
* @since 9.3.0 |
| 26 |
* |
| 27 |
* @param \WP_REST_Request $request Full details about the request. |
| 28 |
* @return true|\WP_Error True if the request has read access, WP_Error otherwise. |
| 29 |
*/ |
| 30 |
public function get_item_permissions_check( $request ) { |
| 31 |
$permission = $this->check_reader_capability(); |
| 32 |
|
| 33 |
if ( \is_wp_error( $permission ) ) { |
| 34 |
return $permission; |
| 35 |
} |
| 36 |
|
| 37 |
return parent::get_item_permissions_check( $request ); |
| 38 |
} |
| 39 |
} |
| 40 |
|