| @@ -8,15 +8,14 @@ | ||
| 8 | 8 | |
| 9 | 9 | class AgentPolicy extends Policy |
| 10 | 10 | { |
| 11 | 11 | /** |
| 12 | - * Check user permission for any method | |
| 13 | 12 | * @param \FluentSupport\Framework\Http\Request\Request $request |
| 14 | 13 | * @return Boolean |
| 15 | 14 | */ |
| 16 | 15 | public function verifyRequest(Request $request) |
| 17 | 16 | { |
| 18 | - // Read access (index) and avatar routes keep the existing boundary. | |
| 17 | + // Only reached by routes without their own method here (index, avatar). | |
| 19 | 18 | return PermissionManager::currentUserCan('fst_sensitive_data'); |
| 20 | 19 | } |
| 21 | 20 | |
| 22 | 21 | public function addAgent(Request $request) |
| @@ -34,15 +33,11 @@ | ||
| 34 | 33 | return $this->guardManageOptions(); |
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | /** |
| 38 | - * Agent records carry the plugin's permission set, so mutating them is a | |
| 39 | - * privilege-granting operation. Gate on a WordPress capability the plugin's | |
| 40 | - * own permission system cannot mint. Throwing (not returning | |
| 41 | - * false) surfaces a specific message instead of WordPress core's generic | |
| 42 | - * "Sorry, you are not allowed to do that." The exception code is carried | |
| 43 | - * through as the HTTP status by Route::permissionCallback(), so anonymous | |
| 44 | - * callers get the canonical 401 rather than 403. | |
| 37 | + * Agent records carry plugin permissions, so editing them grants privileges. | |
| 38 | + * Gate on manage_options, which the plugin's own permission system can't grant. | |
| 39 | + * Throwing gives a specific message, and the code becomes the HTTP status. | |
| 45 | 40 | * |
| 46 | 41 | * @return Boolean |
| 47 | 42 | * @throws \Exception |
| 48 | 43 | */ |