From 78fdabfde76fe3dc311ad64c9de58b24bc785fd3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 31 May 2023 11:58:37 +0530 Subject: [PATCH] fix: add extractProjectId middleware to /me endpoint Signed-off-by: Pranav C --- packages/nc-gui/composables/useApi/interceptors.ts | 1 + packages/nocodb/src/controllers/users/users.controller.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/composables/useApi/interceptors.ts b/packages/nc-gui/composables/useApi/interceptors.ts index 4c12bc083c..c09c8c3b2e 100644 --- a/packages/nc-gui/composables/useApi/interceptors.ts +++ b/packages/nc-gui/composables/useApi/interceptors.ts @@ -69,6 +69,7 @@ export function addAxiosInterceptors(api: Api) { await state.signOut() // todo: handle new user + debugger navigateTo('/signIn') return Promise.reject(error) diff --git a/packages/nocodb/src/controllers/users/users.controller.ts b/packages/nocodb/src/controllers/users/users.controller.ts index 02f4bf13c2..e618890e7a 100644 --- a/packages/nocodb/src/controllers/users/users.controller.ts +++ b/packages/nocodb/src/controllers/users/users.controller.ts @@ -13,7 +13,10 @@ import * as ejs from 'ejs'; import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../../guards/global/global.guard'; import { NcError } from '../../helpers/catchError'; -import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'; +import { + Acl, + ExtractProjectIdMiddleware, +} from '../../middlewares/extract-project-id/extract-project-id.middleware'; import { User } from '../../models'; import { randomTokenString, @@ -96,7 +99,7 @@ export class UsersController { } @Get(['/auth/user/me', '/api/v1/db/auth/user/me', '/api/v1/auth/user/me']) - @UseGuards(GlobalGuard) + @UseGuards(ExtractProjectIdMiddleware, GlobalGuard) async me(@Request() req) { const user = { ...req.user,