PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 2.2.0
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v2.2.0
2.2.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 All 43 releases
fluent-boards / app / Http / Policies / PublicBoardPolicy.php

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

38 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\Models\Board;
6 use FluentBoards\App\Services\PublicAccessService;
7 use FluentBoards\Framework\Http\Request\Request;
8
9 class PublicBoardPolicy extends BasePolicy
10 {
11 public function verifyRequest(Request $request)
12 {
13 if (strtoupper($request->getMethod()) !== 'GET') {
14 return false;
15 }
16
17 // The token and opt-in must belong to the controller's URL board.
18 $routeParams = $request->get_url_params();
19 $boardId = absint($routeParams['board_id'] ?? 0);
20 if (!$boardId) {
21 return false;
22 }
23
24 $token = $request->getSafe('public_token', 'sanitize_text_field');
25 if (!PublicAccessService::validateAccessToken($boardId, $token)) {
26 return false;
27 }
28
29 $board = Board::where('id', $boardId)->whereNull('archived_at')->first();
30 if (!$board) {
31 return false;
32 }
33
34 return (bool)$board->getMetaByKey('public_access_enabled');
35 }
36 }
37
38