diff --git a/packages/nocodb/src/controllers/projects.controller.ts b/packages/nocodb/src/controllers/projects.controller.ts index 7b905cba2e..65949ca778 100644 --- a/packages/nocodb/src/controllers/projects.controller.ts +++ b/packages/nocodb/src/controllers/projects.controller.ts @@ -11,15 +11,13 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import isDocker from 'is-docker'; import { ProjectReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { ExtractProjectIdMiddleware, - UseAclMiddleware, - UseProjectIdMiddleware, + Acl, } from '../middlewares/extract-project-id/extract-project-id.middleware'; import Noco from '../Noco'; import { packageVersion } from '../utils/packageVersion'; @@ -31,9 +29,7 @@ import type { ProjectType } from 'nocodb-sdk'; export class ProjectsController { constructor(private readonly projectsService: ProjectsService) {} - @UseAclMiddleware({ - permissionName: 'projectList', - }) + @Acl('projectList') @Get('/api/v1/db/meta/projects/') async list(@Query() queryParams: Record, @Request() req) { const projects = await this.projectsService.projectList({ @@ -57,7 +53,7 @@ export class ProjectsController { PackageVersion: packageVersion, }; } - + @Acl('projectGet') @Get('/api/v1/db/meta/projects/:projectId') async projectGet(@Param('projectId') projectId: string) { const project = await this.projectsService.getProjectWithInfo({ @@ -68,7 +64,7 @@ export class ProjectsController { return project; } - + @Acl('projectUpdate') @Patch('/api/v1/db/meta/projects/:projectId') async projectUpdate( @Param('projectId') projectId: string, @@ -82,6 +78,7 @@ export class ProjectsController { return project; } + @Acl('projectDelete') @Delete('/api/v1/db/meta/projects/:projectId') async projectDelete(@Param('projectId') projectId: string) { const deleted = await this.projectsService.projectSoftDelete({ @@ -91,6 +88,7 @@ export class ProjectsController { return deleted; } + @Acl('projectCreate') @Post('/api/v1/db/meta/projects') @HttpCode(200) async projectCreate(@Body() projectBody: ProjectReqType, @Request() req) {