Browse Source

fix: use global guard wherever necessary

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
e20acc4688
  1. 5
      packages/nocodb-nest/src/modules/attachments/attachments.controller.ts
  2. 3
      packages/nocodb-nest/src/modules/datas/data-alias-nested/data-alias-nested.controller.ts
  3. 3
      packages/nocodb-nest/src/modules/datas/data-alias.controller.ts
  4. 3
      packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts
  5. 3
      packages/nocodb-nest/src/modules/filters/filters.controller.ts

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

@ -19,6 +19,7 @@ import {
} from '@nestjs/platform-express'; } from '@nestjs/platform-express';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants'; import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
import { GlobalGuard } from '../../guards/global/global.guard'
import { UploadAllowedInterceptor } from '../../interceptors/is-upload-allowed/is-upload-allowed.interceptor'; import { UploadAllowedInterceptor } from '../../interceptors/is-upload-allowed/is-upload-allowed.interceptor';
import { AttachmentsService } from './attachments.service'; import { AttachmentsService } from './attachments.service';
@ -26,7 +27,7 @@ import { AttachmentsService } from './attachments.service';
export class AttachmentsController { export class AttachmentsController {
constructor(private readonly attachmentsService: AttachmentsService) {} constructor(private readonly attachmentsService: AttachmentsService) {}
@UseGuards(AuthGuard('jwt')) @UseGuards(GlobalGuard)
@Post( @Post(
'/api/v1/db/storage/upload', '/api/v1/db/storage/upload',
// multer({ // multer({
@ -78,7 +79,7 @@ export class AttachmentsController {
// catchError(uploadViaURL), // catchError(uploadViaURL),
// ] // ]
// ); // );
@UseGuards(AuthGuard('jwt')) @UseGuards(GlobalGuard)
async uploadViaURL(@Body() body: any, @Query('path') path: string) { async uploadViaURL(@Body() body: any, @Query('path') path: string) {
const attachments = await this.attachmentsService.uploadViaURL({ const attachments = await this.attachmentsService.uploadViaURL({
urls: body, urls: body,

3
packages/nocodb-nest/src/modules/datas/data-alias-nested/data-alias-nested.controller.ts

@ -8,6 +8,7 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common' } from '@nestjs/common'
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../../../guards/global/global.guard'
import { import {
Acl, Acl,
ExtractProjectIdMiddleware, ExtractProjectIdMiddleware,
@ -15,7 +16,7 @@ import {
import { DataAliasNestedService } from './data-alias-nested.service'; import { DataAliasNestedService } from './data-alias-nested.service';
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt')) @UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class DataAliasNestedController { export class DataAliasNestedController {
constructor(private dataAliasNestedService: DataAliasNestedService) {} constructor(private dataAliasNestedService: DataAliasNestedService) {}

3
packages/nocodb-nest/src/modules/datas/data-alias.controller.ts

@ -12,6 +12,7 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../../guards/global/global.guard'
import { parseHrtimeToSeconds } from '../../helpers'; import { parseHrtimeToSeconds } from '../../helpers';
import { import {
Acl, Acl,
@ -20,7 +21,7 @@ import {
import { DatasService } from './datas.service'; import { DatasService } from './datas.service';
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt')) @UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class DataAliasController { export class DataAliasController {
constructor(private readonly datasService: DatasService) {} constructor(private readonly datasService: DatasService) {}

3
packages/nocodb-nest/src/modules/datas/old-datas/old-datas.controller.ts

@ -11,6 +11,7 @@ import {
UseGuards, UseGuards,
} from '@nestjs/common' } from '@nestjs/common'
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { GlobalGuard } from '../../../guards/global/global.guard'
import { import {
Acl, Acl,
ExtractProjectIdMiddleware, ExtractProjectIdMiddleware,
@ -18,7 +19,7 @@ import {
import { OldDatasService } from './old-datas.service'; import { OldDatasService } from './old-datas.service';
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt')) @UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class OldDatasController { export class OldDatasController {
constructor(private readonly oldDatasService: OldDatasService) {} constructor(private readonly oldDatasService: OldDatasService) {}

3
packages/nocodb-nest/src/modules/filters/filters.controller.ts

@ -10,6 +10,7 @@ import {
} from '@nestjs/common' } from '@nestjs/common'
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { FilterReqType } from 'nocodb-sdk'; import { FilterReqType } from 'nocodb-sdk';
import { GlobalGuard } from '../../guards/global/global.guard'
import { PagedResponseImpl } from '../../helpers/PagedResponse'; import { PagedResponseImpl } from '../../helpers/PagedResponse';
import { import {
Acl, Acl,
@ -19,7 +20,7 @@ import {
import { FiltersService } from './filters.service'; import { FiltersService } from './filters.service';
@Controller() @Controller()
@UseGuards(ExtractProjectIdMiddleware, AuthGuard('jwt')) @UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
export class FiltersController { export class FiltersController {
constructor(private readonly filtersService: FiltersService) {} constructor(private readonly filtersService: FiltersService) {}

Loading…
Cancel
Save