Skip to content

Commit

Permalink
fix(routes): Revert back to index.php routes
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Nov 11, 2024
1 parent 6089ac4 commit 01be681
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions lib/Controller/DelegationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use OCA\GroupFolders\Service\DelegationService;
use OCA\Settings\Service\AuthorizedGroupService;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
Expand Down Expand Up @@ -42,7 +42,7 @@ public function __construct(
*/
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/delegation/groups')]
#[FrontpageRoute(verb: 'GET', url: '/delegation/groups')]
public function getAllGroups(): DataResponse {
// Get all groups
$groups = $this->groupManager->search('');
Expand All @@ -64,7 +64,7 @@ public function getAllGroups(): DataResponse {
*/
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/delegation/circles')]
#[FrontpageRoute(verb: 'GET', url: '/delegation/circles')]
public function getAllCircles(): DataResponse {
$circlesEnabled = $this->appManager->isEnabledForUser('circles');
if (!$circlesEnabled) {
Expand Down Expand Up @@ -104,7 +104,7 @@ public function getAllCircles(): DataResponse {
*/
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/delegation/authorized-groups')]
#[FrontpageRoute(verb: 'GET', url: '/delegation/authorized-groups')]
public function getAuthorizedGroups(string $classname = ''): DataResponse {
$data = [];
$authorizedGroups = $this->authorizedGroupService->findExistingGroupsForClass($classname);
Expand Down
28 changes: 14 additions & 14 deletions lib/Controller/FolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use OCA\GroupFolders\Service\DelegationService;
use OCA\GroupFolders\Service\FoldersFilter;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\DataResponse;
Expand Down Expand Up @@ -77,7 +77,7 @@ private function formatFolder(array $folder): array {
}

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

#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/folders/{id}')]
#[FrontpageRoute(verb: 'GET', url: '/folders/{id}')]
public function getFolder(int $id): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand Down Expand Up @@ -155,7 +155,7 @@ private function getRootFolderStorageId(): ?int {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders')]
#[FrontpageRoute(verb: 'POST', url: '/folders')]
public function addFolder(string $mountpoint): DataResponse {

$storageId = $this->rootFolder->getMountPoint()->getNumericStorageId();
Expand All @@ -175,7 +175,7 @@ public function addFolder(string $mountpoint): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'DELETE', url: '/folders/{id}')]
#[FrontpageRoute(verb: 'DELETE', url: '/folders/{id}')]
public function removeFolder(int $id): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -196,7 +196,7 @@ public function removeFolder(int $id): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'PUT', url: '/folders/{id}')]
#[FrontpageRoute(verb: 'PUT', url: '/folders/{id}')]
public function setMountPoint(int $id, string $mountPoint): DataResponse {
$this->manager->renameFolder($id, trim($mountPoint));
return new DataResponse(['success' => true]);
Expand All @@ -205,7 +205,7 @@ public function setMountPoint(int $id, string $mountPoint): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders/{id}/groups')]
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/groups')]
public function addGroup(int $id, string $group): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -220,7 +220,7 @@ public function addGroup(int $id, string $group): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'DELETE', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
#[FrontpageRoute(verb: 'DELETE', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
public function removeGroup(int $id, string $group): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -235,7 +235,7 @@ public function removeGroup(int $id, string $group): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/groups/{group}', requirements: ['group' => '.+'])]
public function setPermissions(int $id, string $group, int $permissions): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -253,7 +253,7 @@ public function setPermissions(int $id, string $group, int $permissions): DataRe
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders/{id}/manageACL')]
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/manageACL')]
public function setManageACL(int $id, string $mappingType, string $mappingId, bool $manageAcl): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -268,7 +268,7 @@ public function setManageACL(int $id, string $mappingType, string $mappingId, bo
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders/{id}/quota')]
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/quota')]
public function setQuota(int $id, int $quota): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -283,7 +283,7 @@ public function setQuota(int $id, int $quota): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders/{id}/acl')]
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/acl')]
public function setACL(int $id, bool $acl): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand All @@ -298,7 +298,7 @@ public function setACL(int $id, bool $acl): DataResponse {
#[PasswordConfirmationRequired]
#[RequireGroupFolderAdmin]
#[NoAdminRequired]
#[ApiRoute(verb: 'POST', url: '/folders/{id}/mountpoint')]
#[FrontpageRoute(verb: 'POST', url: '/folders/{id}/mountpoint')]
public function renameFolder(int $id, string $mountpoint): DataResponse {
$response = $this->checkFolderExists($id);
if ($response) {
Expand Down Expand Up @@ -346,7 +346,7 @@ private function folderDataForXML(array $data): array {
}

#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/folders/{id}/search')]
#[FrontpageRoute(verb: 'GET', url: '/folders/{id}/search')]
public function aclMappingSearch(int $id, ?int $fileId, string $search = ''): DataResponse {
$users = [];
$groups = [];
Expand Down
4 changes: 2 additions & 2 deletions src/components/SharingSidebarView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<script>
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
import { generateOcsUrl } from '@nextcloud/router'
import { generateUrl } from '@nextcloud/router'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
Expand Down Expand Up @@ -276,7 +276,7 @@ export default {
}
searchRequestCancelSource = axios.CancelToken.source()
this.isSearching = true
axios.get(generateOcsUrl(`apps/groupfolders/folders/${this.groupFolderId}/search`) + '?format=json&search=' + query, {
axios.get(generateUrl(`apps/groupfolders/folders/${this.groupFolderId}/search`) + '?format=json&search=' + query, {
cancelToken: searchRequestCancelSource.token,
}).then((result) => {
this.isSearching = false
Expand Down
4 changes: 2 additions & 2 deletions src/settings/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { confirmPassword } from '@nextcloud/password-confirmation'
// eslint-disable-next-line n/no-unpublished-import
Expand Down Expand Up @@ -47,7 +47,7 @@ export interface Folder {
export class Api {

getUrl(endpoint: string): string {
return generateOcsUrl(`apps/groupfolders/${endpoint}`)
return generateUrl(`apps/groupfolders/${endpoint}`)
}

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

0 comments on commit 01be681

Please sign in to comment.