Skip to content

Commit cfd69d2

Browse files
authored
Merge pull request #7816 from nextcloud/fix/federation-correct-controller-attributes
fix: use correct controller attributes for federation endpoints
2 parents 5f68f3a + baa30dc commit cfd69d2

File tree

4 files changed

+0
-42
lines changed

4 files changed

+0
-42
lines changed

lib/Controller/AttachmentOcsController.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
use OCA\Deck\NotImplementedException;
1212
use OCA\Deck\Service\AttachmentService;
1313
use OCA\Deck\Service\BoardService;
14-
use OCP\AppFramework\Http\Attribute\CORS;
1514
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
16-
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
1715
use OCP\AppFramework\Http\DataResponse;
1816
use OCP\AppFramework\OCSController;
1917
use OCP\IRequest;
@@ -38,44 +36,34 @@ private function ensureLocalBoard(?int $boardId): void {
3836
}
3937

4038
#[NoAdminRequired]
41-
#[CORS]
42-
#[NoCSRFRequired]
4339
public function getAll(int $cardId, ?int $boardId = null): DataResponse {
4440
$this->ensureLocalBoard($boardId);
4541
$attachment = $this->attachmentService->findAll($cardId, true);
4642
return new DataResponse($attachment);
4743
}
4844

4945
#[NoAdminRequired]
50-
#[CORS]
51-
#[NoCSRFRequired]
5246
public function create(int $cardId, string $type, string $data = '', ?int $boardId = null): DataResponse {
5347
$this->ensureLocalBoard($boardId);
5448
$attachment = $this->attachmentService->create($cardId, $type, $data);
5549
return new DataResponse($attachment);
5650
}
5751

5852
#[NoAdminRequired]
59-
#[CORS]
60-
#[NoCSRFRequired]
6153
public function update(int $cardId, int $attachmentId, string $data, string $type = 'file', ?int $boardId = null): DataResponse {
6254
$this->ensureLocalBoard($boardId);
6355
$attachment = $this->attachmentService->update($cardId, $attachmentId, $data, $type);
6456
return new DataResponse($attachment);
6557
}
6658

6759
#[NoAdminRequired]
68-
#[CORS]
69-
#[NoCSRFRequired]
7060
public function delete(int $cardId, int $attachmentId, string $type = 'file', ?int $boardId = null): DataResponse {
7161
$this->ensureLocalBoard($boardId);
7262
$attachment = $this->attachmentService->delete($cardId, $attachmentId, $type);
7363
return new DataResponse($attachment);
7464
}
7565

7666
#[NoAdminRequired]
77-
#[CORS]
78-
#[NoCSRFRequired]
7967
public function restore(int $cardId, int $attachmentId, string $type = 'file', ?int $boardId = null): DataResponse {
8068
$this->ensureLocalBoard($boardId);
8169
$attachment = $this->attachmentService->restore($cardId, $attachmentId, $type);

lib/Controller/BoardOcsController.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
use OCA\Deck\Service\BoardService;
1111
use OCA\Deck\Service\ExternalBoardService;
1212
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
13-
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
1413
use OCP\AppFramework\Http\Attribute\PublicPage;
15-
use OCP\AppFramework\Http\Attribute\RequestHeader;
1614
use OCP\AppFramework\Http\DataResponse;
1715
use OCP\AppFramework\OCSController;
1816
use OCP\IRequest;
@@ -38,8 +36,6 @@ public function index(): DataResponse {
3836

3937
#[NoAdminRequired]
4038
#[PublicPage]
41-
#[NoCSRFRequired]
42-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
4339
public function read(int $boardId): DataResponse {
4440
$localBoard = $this->boardService->find($boardId, true, true);
4541
if ($localBoard->getExternalId() !== null) {
@@ -49,19 +45,16 @@ public function read(int $boardId): DataResponse {
4945
}
5046

5147
#[NoAdminRequired]
52-
#[NoCSRFRequired]
5348
public function create(string $title, string $color): DataResponse {
5449
return new DataResponse($this->boardService->create($title, $this->userId, $color));
5550
}
5651

5752
#[NoAdminRequired]
58-
#[NoCSRFRequired]
5953
public function addAcl(int $boardId, int $type, string $participant, bool $permissionEdit, bool $permissionShare, bool $permissionManage, ?string $remote = null): DataResponse {
6054
return new DataResponse($this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage));
6155
}
6256

6357
#[NoAdminRequired]
64-
#[NoCSRFRequired]
6558
public function updateAcl(int $id, bool $permissionEdit, bool $permissionShare, bool $permissionManage): DataResponse {
6659
return new DataResponse($this->boardService->updateAcl($id, $permissionEdit, $permissionShare, $permissionManage));
6760
}

lib/Controller/CardOcsController.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
use OCA\Deck\Service\ExternalBoardService;
1515
use OCA\Deck\Service\StackService;
1616
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
17-
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
1817
use OCP\AppFramework\Http\Attribute\PublicPage;
19-
use OCP\AppFramework\Http\Attribute\RequestHeader;
2018
use OCP\AppFramework\Http\DataResponse;
2119
use OCP\AppFramework\OCSController;
2220
use OCP\IRequest;
@@ -37,8 +35,6 @@ public function __construct(
3735

3836
#[NoAdminRequired]
3937
#[PublicPage]
40-
#[NoCSRFRequired]
41-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
4238
public function create(string $title, int $stackId, ?int $boardId = null, ?string $type = 'plain', ?string $owner = null, ?int $order = 999, ?string $description = '', $duedate = null, $startdate = null, ?array $labels = [], ?array $users = []) {
4339
if ($boardId) {
4440
$board = $this->boardService->find($boardId, false);
@@ -67,7 +63,6 @@ public function create(string $title, int $stackId, ?int $boardId = null, ?strin
6763

6864
#[NoAdminRequired]
6965
#[PublicPage]
70-
#[NoCSRFRequired]
7166
public function assignLabel(?int $boardId, int $cardId, int $labelId): DataResponse {
7267
if ($boardId) {
7368
$board = $this->boardService->find($boardId, false);
@@ -81,7 +76,6 @@ public function assignLabel(?int $boardId, int $cardId, int $labelId): DataRespo
8176

8277
#[NoAdminRequired]
8378
#[PublicPage]
84-
#[NoCSRFRequired]
8579
public function assignUser(?int $boardId, int $cardId, string $userId, int $type = 0): DataResponse {
8680
if ($boardId) {
8781
$localBoard = $this->boardService->find($boardId, false);
@@ -94,7 +88,6 @@ public function assignUser(?int $boardId, int $cardId, string $userId, int $type
9488

9589
#[NoAdminRequired]
9690
#[PublicPage]
97-
#[NoCSRFRequired]
9891
public function unAssignUser(?int $boardId, int $cardId, string $userId, int $type = 0): DataResponse {
9992
if ($boardId) {
10093
$localBoard = $this->boardService->find($boardId, false);
@@ -107,7 +100,6 @@ public function unAssignUser(?int $boardId, int $cardId, string $userId, int $ty
107100

108101
#[NoAdminRequired]
109102
#[PublicPage]
110-
#[NoCSRFRequired]
111103
public function removeLabel(?int $boardId, int $cardId, int $labelId): DataResponse {
112104
if ($boardId) {
113105
$board = $this->boardService->find($boardId, false);
@@ -121,8 +113,6 @@ public function removeLabel(?int $boardId, int $cardId, int $labelId): DataRespo
121113

122114
#[NoAdminRequired]
123115
#[PublicPage]
124-
#[NoCSRFRequired]
125-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
126116
public function update(int $id, string $title, int $stackId, string $type, int $order, string $description, $duedate, $deletedAt, int $boardId, array|string|null $owner = null, $archived = null, $startdate = null): DataResponse {
127117
$done = array_key_exists('done', $this->request->getParams())
128118
? new OptionalNullableValue($this->request->getParam('done', null))
@@ -170,7 +160,6 @@ public function update(int $id, string $title, int $stackId, string $type, int $
170160

171161
#[NoAdminRequired]
172162
#[PublicPage]
173-
#[NoCSRFRequired]
174163
public function reorder(int $cardId, int $stackId, int $order, ?int $boardId): DataResponse {
175164
if ($boardId) {
176165
$board = $this->boardService->find($boardId, false);

lib/Controller/StackOcsController.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
use OCA\Deck\Service\ExternalBoardService;
1212
use OCA\Deck\Service\StackService;
1313
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
14-
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
1514
use OCP\AppFramework\Http\Attribute\PublicPage;
16-
use OCP\AppFramework\Http\Attribute\RequestHeader;
1715
use OCP\AppFramework\Http\DataResponse;
1816
use OCP\AppFramework\OCSController;
1917
use OCP\IRequest;
@@ -31,8 +29,6 @@ public function __construct(
3129

3230
#[NoAdminRequired]
3331
#[PublicPage]
34-
#[NoCSRFRequired]
35-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
3632
public function index(int $boardId): DataResponse {
3733
$localBoard = $this->boardService->find($boardId, true, true);
3834
if ($localBoard->getExternalId() !== null) {
@@ -44,8 +40,6 @@ public function index(int $boardId): DataResponse {
4440

4541
#[NoAdminRequired]
4642
#[PublicPage]
47-
#[NoCSRFRequired]
48-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
4943
public function create(string $title, int $boardId, int $order = 0):DataResponse {
5044
$board = $this->boardService->find($boardId, false);
5145
if ($board->getExternalId()) {
@@ -59,8 +53,6 @@ public function create(string $title, int $boardId, int $order = 0):DataResponse
5953

6054
#[NoAdminRequired]
6155
#[PublicPage]
62-
#[NoCSRFRequired]
63-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
6456
public function setDoneStack(int $stackId, int $boardId, bool $isDone): DataResponse {
6557
$board = $this->boardService->find($boardId, false);
6658
if ($board->getExternalId()) {
@@ -73,8 +65,6 @@ public function setDoneStack(int $stackId, int $boardId, bool $isDone): DataResp
7365

7466
#[NoAdminRequired]
7567
#[PublicPage]
76-
#[NoCSRFRequired]
77-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
7868
public function delete(int $stackId, ?int $boardId = null):DataResponse {
7969
if ($boardId) {
8070
$board = $this->boardService->find($boardId, false);
@@ -90,8 +80,6 @@ public function delete(int $stackId, ?int $boardId = null):DataResponse {
9080

9181
#[NoAdminRequired]
9282
#[PublicPage]
93-
#[NoCSRFRequired]
94-
#[RequestHeader(name: 'x-nextcloud-federation', description: 'Set to 1 when the request is performed by another Nextcloud Server to indicate a federation request', indirect: true)]
9583
public function reorder(int $stackId, int $order, ?int $boardId):DataResponse {
9684
if ($boardId !== null) {
9785
$board = $this->boardService->find($boardId, false);

0 commit comments

Comments
 (0)