This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @copyright Copyright (c) 2017 Steven R. Baker <[email protected]> |
||
4 | * |
||
5 | * @author Steven R. Baker <[email protected]> |
||
6 | * @author Ryan Fletcher <[email protected]> |
||
7 | * |
||
8 | * @license GNU AGPL version 3 or any later version |
||
9 | * |
||
10 | * This program is free software: you can redistribute it and/or modify |
||
11 | * it under the terms of the GNU Affero General Public License as |
||
12 | * published by the Free Software Foundation, either version 3 of the |
||
13 | * License, or (at your option) any later version. |
||
14 | * |
||
15 | * This program is distributed in the hope that it will be useful, |
||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
18 | * GNU Affero General Public License for more details. |
||
19 | * |
||
20 | * You should have received a copy of the GNU Affero General Public License |
||
21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
22 | * |
||
23 | */ |
||
24 | |||
25 | namespace OCA\Deck\Controller; |
||
26 | |||
27 | use OCA\Deck\StatusException; |
||
28 | use OCP\AppFramework\ApiController; |
||
29 | use OCP\AppFramework\Http; |
||
30 | use OCP\AppFramework\Http\DataResponse; |
||
31 | use OCP\IRequest; |
||
32 | |||
33 | use OCA\Deck\Service\BoardService; |
||
34 | use Sabre\HTTP\Util; |
||
35 | |||
36 | /** |
||
37 | * Class BoardApiController |
||
38 | * |
||
39 | * @package OCA\Deck\Controller |
||
40 | */ |
||
41 | class BoardApiController extends ApiController { |
||
42 | |||
43 | private $boardService; |
||
44 | |||
45 | /** |
||
46 | * @param string $appName |
||
47 | * @param IRequest $request |
||
48 | * @param BoardService $service |
||
49 | * @param $userId |
||
50 | */ |
||
51 | public function __construct($appName, IRequest $request, BoardService $service, $userId) { |
||
52 | parent::__construct($appName, $request); |
||
53 | $this->boardService = $service; |
||
54 | $this->userId = $userId; |
||
0 ignored issues
–
show
|
|||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @NoAdminRequired |
||
59 | * @CORS |
||
60 | * @NoCSRFRequired |
||
61 | * |
||
62 | * Return all of the boards that the current user has access to. |
||
63 | * @throws StatusException |
||
64 | */ |
||
65 | public function index($details = null) { |
||
66 | $modified = $this->request->getHeader('If-Modified-Since'); |
||
67 | if ($modified === null || $modified === '') { |
||
68 | $boards = $this->boardService->findAll(0, $details); |
||
69 | } else { |
||
70 | $date = Util::parseHTTPDate($modified); |
||
71 | if (!$date) { |
||
72 | throw new StatusException('Invalid If-Modified-Since header provided.'); |
||
73 | } |
||
74 | $boards = $this->boardService->findAll($date->getTimestamp(), $details); |
||
75 | } |
||
76 | return new DataResponse($boards, HTTP::STATUS_OK); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @NoAdminRequired |
||
81 | * @CORS |
||
82 | * @NoCSRFRequired |
||
83 | * |
||
84 | * |
||
85 | * Return the board specified by $this->request->getParam('boardId'). |
||
86 | */ |
||
87 | public function get() { |
||
88 | $board = $this->boardService->find($this->request->getParam('boardId')); |
||
89 | return new DataResponse($board, HTTP::STATUS_OK); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @NoAdminRequired |
||
94 | * @CORS |
||
95 | * @NoCSRFRequired |
||
96 | * |
||
97 | * @params $title |
||
98 | * @params $color |
||
99 | * |
||
100 | * Create a board with the specified title and color. |
||
101 | */ |
||
102 | public function create($title, $color) { |
||
103 | $board = $this->boardService->create($title, $this->userId, $color); |
||
104 | return new DataResponse($board, HTTP::STATUS_OK); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @NoAdminRequired |
||
109 | * @CORS |
||
110 | * @NoCSRFRequired |
||
111 | * |
||
112 | * @params $title |
||
113 | * @params $color |
||
114 | * @params $archived |
||
115 | * |
||
116 | * Update a board with the specified boardId, title and color, and archived state. |
||
117 | */ |
||
118 | public function update($title, $color, $archived = false) { |
||
119 | $board = $this->boardService->update($this->request->getParam('boardId'), $title, $color, $archived); |
||
120 | return new DataResponse($board, HTTP::STATUS_OK); |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * @NoAdminRequired |
||
125 | * @CORS |
||
126 | * @NoCSRFRequired |
||
127 | * |
||
128 | * |
||
129 | * Delete the board specified by $boardId. Return the board that was deleted. |
||
130 | */ |
||
131 | public function delete() { |
||
132 | $board = $this->boardService->delete($this->request->getParam('boardId')); |
||
133 | return new DataResponse($board, HTTP::STATUS_OK); |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * @NoAdminRequired |
||
138 | * @CORS |
||
139 | * @NoCSRFRequired |
||
140 | * |
||
141 | * |
||
142 | * Undo the deletion of the board specified by $boardId. |
||
143 | */ |
||
144 | public function undoDelete() { |
||
145 | $board = $this->boardService->deleteUndo($this->request->getParam('boardId')); |
||
146 | return new DataResponse($board, HTTP::STATUS_OK); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @NoAdminRequired |
||
151 | * @CORS |
||
152 | * @NoCSRFRequired |
||
153 | */ |
||
154 | public function addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage) { |
||
155 | $acl = $this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage); |
||
156 | return new DataResponse($acl, HTTP::STATUS_OK); |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * @NoAdminRequired |
||
161 | * @CORS |
||
162 | * @NoCSRFRequired |
||
163 | */ |
||
164 | public function updateAcl($aclId, $permissionEdit, $permissionShare, $permissionManage) { |
||
165 | $acl = $this->boardService->updateAcl($aclId, $permissionEdit, $permissionShare, $permissionManage); |
||
166 | return new DataResponse($acl, HTTP::STATUS_OK); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * @NoAdminRequired |
||
171 | * @CORS |
||
172 | * @NoCSRFRequired |
||
173 | */ |
||
174 | public function deleteAcl($aclId) { |
||
175 | $acl = $this->boardService->deleteAcl($aclId); |
||
176 | return new DataResponse($acl, HTTP::STATUS_OK); |
||
177 | } |
||
178 | |||
179 | } |
||
180 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: