Browse Source

fix: add missing authguard decorator for controllers

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
a9829ccc87
  1. 2
      packages/nocodb-nest/src/modules/columns/columns.controller.ts
  2. 6
      packages/nocodb-nest/src/modules/datas/datas.controller.ts
  3. 5
      packages/nocodb-nest/src/modules/import/import.controller.ts
  4. 6
      packages/nocodb-nest/src/modules/org-lcense/org-lcense.controller.ts
  5. 6
      packages/nocodb-nest/src/modules/sync/sync.controller.ts
  6. 1
      packages/nocodb-nest/src/run/testDocker.ts

2
packages/nocodb-nest/src/modules/columns/columns.controller.ts

@ -11,7 +11,7 @@ import {
} from '@nestjs/common' } from '@nestjs/common'
import { ColumnReqType } from 'nocodb-sdk'; import { ColumnReqType } from 'nocodb-sdk';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../../guards/global/global.guard' import { GlobalGuard } from '../../guards/global/global.guard';
import { import {
Acl, Acl,
ExtractProjectIdMiddleware, ExtractProjectIdMiddleware,

6
packages/nocodb-nest/src/modules/datas/datas.controller.ts

@ -6,12 +6,14 @@ import {
Param, Param,
Patch, Patch,
Post, Post,
Request, Request, UseGuards,
} from '@nestjs/common' } from '@nestjs/common'
import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'; import { GlobalGuard } from '../../guards/global/global.guard'
import { Acl, ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import { DatasService } from './datas.service'; import { DatasService } from './datas.service';
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class DatasController { export class DatasController {
constructor(private readonly datasService: DatasService) {} constructor(private readonly datasService: DatasService) {}

5
packages/nocodb-nest/src/modules/import/import.controller.ts

@ -1,7 +1,9 @@
import { Controller, HttpCode, Post, Request } from '@nestjs/common' import { Controller, HttpCode, Post, Request, UseGuards } from '@nestjs/common'
import { forwardRef, Inject } from '@nestjs/common'; import { forwardRef, Inject } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core'; import { ModuleRef } from '@nestjs/core';
import { GlobalGuard } from '../../guards/global/global.guard'
import { NcError } from '../../helpers/catchError'; import { NcError } from '../../helpers/catchError';
import { ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import { SyncSource } from '../../models'; import { SyncSource } from '../../models';
import NocoJobs from '../../jobs/NocoJobs'; import NocoJobs from '../../jobs/NocoJobs';
import { ImportService } from './import.service'; import { ImportService } from './import.service';
@ -81,6 +83,7 @@ export default (
}); });
}; };
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class ImportController { export class ImportController {
constructor( constructor(
private readonly importService: ImportService, private readonly importService: ImportService,

6
packages/nocodb-nest/src/modules/org-lcense/org-lcense.controller.ts

@ -1,9 +1,11 @@
import { Controller, Get, HttpCode, Post } from '@nestjs/common' import { Controller, Get, HttpCode, Post, UseGuards } from '@nestjs/common'
import { OrgUserRoles } from 'nocodb-sdk'; import { OrgUserRoles } from 'nocodb-sdk';
import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'; import { GlobalGuard } from '../../guards/global/global.guard'
import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import { OrgLcenseService } from './org-lcense.service'; import { OrgLcenseService } from './org-lcense.service';
@Controller() @Controller()
@UseGuards(GlobalGuard)
export class OrgLcenseController { export class OrgLcenseController {
constructor(private readonly orgLcenseService: OrgLcenseService) {} constructor(private readonly orgLcenseService: OrgLcenseService) {}

6
packages/nocodb-nest/src/modules/sync/sync.controller.ts

@ -6,12 +6,14 @@ import {
Param, Param,
Patch, Patch,
Post, Post,
Req, Req, UseGuards,
} from '@nestjs/common' } from '@nestjs/common'
import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'; import { GlobalGuard } from '../../guards/global/global.guard'
import { Acl, ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import { SyncService } from './sync.service'; import { SyncService } from './sync.service';
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class SyncController { export class SyncController {
constructor(private readonly syncService: SyncService) {} constructor(private readonly syncService: SyncService) {}

1
packages/nocodb-nest/src/run/testDocker.ts

@ -23,7 +23,6 @@ process.env[`DEBUG`] = 'xc*';
(async () => { (async () => {
await nocobuild(server); await nocobuild(server);
const httpServer = server.listen(process.env.PORT || 8080, async () => { const httpServer = server.listen(process.env.PORT || 8080, async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
if (!(await User.getByEmail('user@nocodb.com'))) { if (!(await User.getByEmail('user@nocodb.com'))) {
const response = await axios.post( const response = await axios.post(
`http://localhost:${process.env.PORT || 8080}/api/v1/auth/user/signup`, `http://localhost:${process.env.PORT || 8080}/api/v1/auth/user/signup`,

Loading…
Cancel
Save