| @@ -69,9 +69,16 @@ | ||
| 69 | 69 | */ |
| 70 | 70 | public function get_data(): WP_REST_Response { |
| 71 | 71 | $roles = []; |
| 72 | 72 | foreach (Capability_Manager::editable_roles() as $slug => $name) { |
| 73 | - $roles[] = ['slug' => $slug, 'name' => $name]; | |
| 73 | + $roles[] = [ | |
| 74 | + 'slug' => $slug, | |
| 75 | + 'name' => $name, | |
| 76 | + // False when the role lacks the WordPress capability ThinkRank's | |
| 77 | + // endpoints require on top of the section gate — the grant would | |
| 78 | + // save and then do nothing (#576). | |
| 79 | + 'can_use' => Capability_Manager::role_meets_baseline($slug), | |
| 80 | + ]; | |
| 74 | 81 | } |
| 75 | 82 | |
| 76 | 83 | $capabilities = []; |
| 77 | 84 | foreach (Capability_Manager::capabilities() as $key => $label) { |
| @@ -84,8 +91,9 @@ | ||
| 84 | 91 | 'roles' => $roles, |
| 85 | 92 | 'capabilities' => $capabilities, |
| 86 | 93 | 'matrix' => Capability_Manager::get_matrix(), |
| 87 | 94 | 'base_cap' => Capability_Manager::ACCESS, |
| 95 | + 'baseline_cap' => Capability_Manager::BASELINE_CAPABILITY, | |
| 88 | 96 | ], |
| 89 | 97 | ], 200); |
| 90 | 98 | } |
| 91 | 99 | |