| @@ -7,13 +7,14 @@ | ||
| 7 | 7 | * posts in the term, top authors, co-occurring terms, 12-month |
| 8 | 8 | * activity sparkline, milestones. Powers the right preview pane in |
| 9 | 9 | * the My WordPress folder when a term is selected. |
| 10 | 10 | * |
| 11 | - * Permissions: any logged-in user with `read` (default for most | |
| 12 | - * roles) — terms are public-facing data on the WP site, so the same | |
| 13 | - * cap that lets you read the front-end is enough to inspect their | |
| 14 | - * stats. Author archives are also public so listing top authors is | |
| 15 | - * not new disclosure. | |
| 11 | + * Permissions: the My WordPress module's gate, | |
| 12 | + * `openstation_my_wordpress_user_can_use()` (`edit_posts` unless a site | |
| 13 | + * filters it), so a site that narrows WP Explorer narrows this data | |
| 14 | + * with it. Terms are public-facing data and author archives are | |
| 15 | + * public, so the term row and its top authors are no new disclosure to | |
| 16 | + * anyone past that gate. | |
| 16 | 17 | * |
| 17 | 18 | * That reasoning covers the term row and the aggregates over its |
| 18 | 19 | * *published* posts; it does not carry to the unpublished posts inside |
| 19 | 20 | * the term, nor to terms of a non-viewable taxonomy. So hidden |
| @@ -42,9 +43,12 @@ | ||
| 42 | 43 | array( |
| 43 | 44 | 'methods' => WP_REST_Server::READABLE, |
| 44 | 45 | 'callback' => 'openstation_my_wordpress_term_stats_callback', |
| 45 | 46 | 'permission_callback' => static function () { |
| 46 | - return is_user_logged_in() && current_user_can( 'read' ); | |
| 47 | + // The module's gate, so a site that narrows WP Explorer | |
| 48 | + // narrows this data with it. The per-viewer scoping lives | |
| 49 | + // in the callback, which in-process callers invoke directly. | |
| 50 | + return openstation_my_wordpress_user_can_use(); | |
| 47 | 51 | }, |
| 48 | 52 | 'args' => array( |
| 49 | 53 | 'taxonomy' => array( |
| 50 | 54 | 'required' => true, |