Skip to content

Commit a7cc8f7

Browse files
Merge pull request #3407 from nextcloud/fix/routes/index-php
2 parents f0e02d6 + d6c9c85 commit a7cc8f7

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

β€Žlib/Controller/DelegationController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use OCA\GroupFolders\Service\DelegationService;
1313
use OCA\Settings\Service\AuthorizedGroupService;
1414
use OCP\App\IAppManager;
15-
use OCP\AppFramework\Http\Attribute\ApiRoute;
15+
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
1616
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
1717
use OCP\AppFramework\Http\DataResponse;
1818
use OCP\AppFramework\OCSController;
@@ -42,7 +42,7 @@ public function __construct(
4242
*/
4343
#[RequireGroupFolderAdmin]
4444
#[NoAdminRequired]
45-
#[ApiRoute(verb: 'GET', url: '/delegation/groups')]
45+
#[FrontpageRoute(verb: 'GET', url: '/delegation/groups')]
4646
public function getAllGroups(): DataResponse {
4747
// Get all groups
4848
$groups = $this->groupManager->search('');
@@ -64,7 +64,7 @@ public function getAllGroups(): DataResponse {
6464
*/
6565
#[RequireGroupFolderAdmin]
6666
#[NoAdminRequired]
67-
#[ApiRoute(verb: 'GET', url: '/delegation/circles')]
67+
#[FrontpageRoute(verb: 'GET', url: '/delegation/circles')]
6868
public function getAllCircles(): DataResponse {
6969
$circlesEnabled = $this->appManager->isEnabledForUser('circles');
7070
if (!$circlesEnabled) {
@@ -104,7 +104,7 @@ public function getAllCircles(): DataResponse {
104104
*/
105105
#[RequireGroupFolderAdmin]
106106
#[NoAdminRequired]
107-
#[ApiRoute(verb: 'GET', url: '/delegation/authorized-groups')]
107+
#[FrontpageRoute(verb: 'GET', url: '/delegation/authorized-groups')]
108108
public function getAuthorizedGroups(string $classname = ''): DataResponse {
109109
$data = [];
110110
$authorizedGroups = $this->authorizedGroupService->findExistingGroupsForClass($classname);

β€Žlib/Controller/FolderController.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use OCA\GroupFolders\Service\DelegationService;
1515
use OCA\GroupFolders\Service\FoldersFilter;
1616
use OCP\AppFramework\Http;
17-
use OCP\AppFramework\Http\Attribute\ApiRoute;
17+
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
1818
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
1919
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
2020
use OCP\AppFramework\Http\DataResponse;
@@ -77,7 +77,7 @@ private function formatFolder(array $folder): array {
7777
}
7878

7979
#[NoAdminRequired]
80-
#[ApiRoute(verb: 'GET', url: '/folders')]
80+
#[FrontpageRoute(verb: 'GET', url: '/folders')]
8181
public function getFolders(bool $applicable = false): DataResponse {
8282
$storageId = $this->getRootFolderStorageId();
8383
if ($storageId === null) {
@@ -104,7 +104,7 @@ public function getFolders(bool $applicable = false): DataResponse {
104104
}
105105

106106
#[NoAdminRequired]
107-
#[ApiRoute(verb: 'GET', url: '/folders/{id}')]
107+
#[FrontpageRoute(verb: 'GET', url: '/folders/{id}')]
108108
public function getFolder(int $id): DataResponse {
109109
$response = $this->checkFolderExists($id);
110110
if ($response) {
@@ -155,7 +155,7 @@ private function getRootFolderStorageId(): ?int {
155155
#[PasswordConfirmationRequired]
156156
#[RequireGroupFolderAdmin]
157157
#[NoAdminRequired]
158-
#[ApiRoute(verb: 'POST', url: '/folders')]
158+
#[FrontpageRoute(verb: 'POST', url: '/folders')]
159159
public function addFolder(string $mountpoint): DataResponse {
160160

161161
$storageId = $this->rootFolder->getMountPoint()->getNumericStorageId();
@@ -175,7 +175,7 @@ public function addFolder(string $mountpoint): DataResponse {
175175
#[PasswordConfirmationRequired]
176176
#[RequireGroupFolderAdmin]
177177
#[NoAdminRequired]
178-
#[ApiRoute(verb: 'DELETE', url: '/folders/{id}')]
178+
#[FrontpageRoute(verb: 'DELETE', url: '/folders/{id}')]
179179
public function removeFolder(int $id): DataResponse {
180180
$response = $this->checkFolderExists($id);
181181
if ($response) {
@@ -196,7 +196,7 @@ public function removeFolder(int $id): DataResponse {
196196
#[PasswordConfirmationRequired]
197197
#[RequireGroupFolderAdmin]
198198
#[NoAdminRequired]
199-
#[ApiRoute(verb: 'PUT', url: '/folders/{id}')]
199+
#[FrontpageRoute(verb: 'PUT', url: '/folders/{id}')]
200200
public function setMountPoint(int $id, string $mountPoint): DataResponse {
201201
$this->manager->renameFolder($id, trim($mountPoint));
202202
return new DataResponse(['success' => true]);
@@ -205,7 +205,7 @@ public function setMountPoint(int $id, string $mountPoint): DataResponse {
205205
#[PasswordConfirmationRequired]
206206
#[RequireGroupFolderAdmin]
207207
#[NoAdminRequired]
208-
#[ApiRoute(verb: 'POST', url: '/folders/{id}/groups')]
208+
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/groups')]
209209
public function addGroup(int $id, string $group): DataResponse {
210210
$response = $this->checkFolderExists($id);
211211
if ($response) {
@@ -220,7 +220,7 @@ public function addGroup(int $id, string $group): DataResponse {
220220
#[PasswordConfirmationRequired]
221221
#[RequireGroupFolderAdmin]
222222
#[NoAdminRequired]
223-
#[ApiRoute(verb: 'DELETE', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
223+
#[FrontpageRoute(verb: 'DELETE', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
224224
public function removeGroup(int $id, string $group): DataResponse {
225225
$response = $this->checkFolderExists($id);
226226
if ($response) {
@@ -235,7 +235,7 @@ public function removeGroup(int $id, string $group): DataResponse {
235235
#[PasswordConfirmationRequired]
236236
#[RequireGroupFolderAdmin]
237237
#[NoAdminRequired]
238-
#[ApiRoute(verb: 'POST', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
238+
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
239239
public function setPermissions(int $id, string $group, int $permissions): DataResponse {
240240
$response = $this->checkFolderExists($id);
241241
if ($response) {
@@ -253,7 +253,7 @@ public function setPermissions(int $id, string $group, int $permissions): DataRe
253253
#[PasswordConfirmationRequired]
254254
#[RequireGroupFolderAdmin]
255255
#[NoAdminRequired]
256-
#[ApiRoute(verb: 'POST', url: '/folders/{id}/manageACL')]
256+
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/manageACL')]
257257
public function setManageACL(int $id, string $mappingType, string $mappingId, bool $manageAcl): DataResponse {
258258
$response = $this->checkFolderExists($id);
259259
if ($response) {
@@ -268,7 +268,7 @@ public function setManageACL(int $id, string $mappingType, string $mappingId, bo
268268
#[PasswordConfirmationRequired]
269269
#[RequireGroupFolderAdmin]
270270
#[NoAdminRequired]
271-
#[ApiRoute(verb: 'POST', url: '/folders/{id}/quota')]
271+
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/quota')]
272272
public function setQuota(int $id, int $quota): DataResponse {
273273
$response = $this->checkFolderExists($id);
274274
if ($response) {
@@ -283,7 +283,7 @@ public function setQuota(int $id, int $quota): DataResponse {
283283
#[PasswordConfirmationRequired]
284284
#[RequireGroupFolderAdmin]
285285
#[NoAdminRequired]
286-
#[ApiRoute(verb: 'POST', url: '/folders/{id}/acl')]
286+
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/acl')]
287287
public function setACL(int $id, bool $acl): DataResponse {
288288
$response = $this->checkFolderExists($id);
289289
if ($response) {
@@ -298,7 +298,7 @@ public function setACL(int $id, bool $acl): DataResponse {
298298
#[PasswordConfirmationRequired]
299299
#[RequireGroupFolderAdmin]
300300
#[NoAdminRequired]
301-
#[ApiRoute(verb: 'POST', url: '/folders/{id}/mountpoint')]
301+
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/mountpoint')]
302302
public function renameFolder(int $id, string $mountpoint): DataResponse {
303303
$response = $this->checkFolderExists($id);
304304
if ($response) {
@@ -346,7 +346,7 @@ private function folderDataForXML(array $data): array {
346346
}
347347

348348
#[NoAdminRequired]
349-
#[ApiRoute(verb: 'GET', url: '/folders/{id}/search')]
349+
#[FrontpageRoute(verb: 'GET', url: '/folders/{id}/search')]
350350
public function aclMappingSearch(int $id, ?int $fileId, string $search = ''): DataResponse {
351351
$users = [];
352352
$groups = [];

β€Žsrc/components/SharingSidebarView.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
<script>
158158
import axios from '@nextcloud/axios'
159159
import { showError } from '@nextcloud/dialogs'
160-
import { generateOcsUrl } from '@nextcloud/router'
160+
import { generateUrl } from '@nextcloud/router'
161161
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
162162
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
163163
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
@@ -276,7 +276,7 @@ export default {
276276
}
277277
searchRequestCancelSource = axios.CancelToken.source()
278278
this.isSearching = true
279-
axios.get(generateOcsUrl(`apps/groupfolders/folders/${this.groupFolderId}/search`) + '?format=json&search=' + query, {
279+
axios.get(generateUrl(`apps/groupfolders/folders/${this.groupFolderId}/search`) + '?format=json&search=' + query, {
280280
cancelToken: searchRequestCancelSource.token,
281281
}).then((result) => {
282282
this.isSearching = false

β€Žsrc/settings/Api.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
5+
import { generateUrl } from '@nextcloud/router'
66
import axios from '@nextcloud/axios'
77
import { confirmPassword } from '@nextcloud/password-confirmation'
88
// eslint-disable-next-line n/no-unpublished-import
@@ -47,7 +47,7 @@ export interface Folder {
4747
export class Api {
4848

4949
getUrl(endpoint: string): string {
50-
return generateOcsUrl(`apps/groupfolders/${endpoint}`)
50+
return generateUrl(`apps/groupfolders/${endpoint}`)
5151
}
5252

5353
async listFolders(): Promise<Folder[]> {

0 commit comments

Comments
Β (0)