PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 2.1.0
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v2.1.0
2.1.0 2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 All 42 releases
fluent-boards / app / Http / Policies / AiPolicy.php

AiPolicy.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration 2.1.0, at app/Http/Policies/AiPolicy.php

37 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\App\Http\Policies;
4
5 use FluentBoards\App\Services\PermissionManager;
6 use FluentBoards\Framework\Http\Request\Request;
7
8 /**
9 * AI assistant permissions.
10 *
11 * Managing AI settings (get/save/models/test) is admin-only. Generating text
12 * is available to any authenticated Fluent Boards user, since it is used from
13 * the task description editor.
14 */
15 class AiPolicy extends BasePolicy
16 {
17 /**
18 * Default guard for AI settings routes.
19 */
20 public function verifyRequest(Request $request)
21 {
22 return PermissionManager::isAdmin();
23 }
24
25 /**
26 * Text generation is allowed for Fluent Boards users (admins or board members).
27 *
28 * Deliberately stricter than a plain logged-in check: this endpoint accepts an
29 * arbitrary prompt and spends the site owner's AI credits on every call, so a
30 * WP user with no board access must not be able to use it as a free AI proxy.
31 */
32 public function generate(Request $request)
33 {
34 return PermissionManager::userHasAnyBoardAccess();
35 }
36 }
37