diff --git a/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.controller.ts b/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.controller.ts index 43ca11e6aa..4f66681f82 100644 --- a/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.controller.ts @@ -53,6 +53,11 @@ export class AtImportController { authToken: '', baseURL, user: user, + req: { + user: req.user, + clientIp: req.clientIp, + headers: req.headers, + }, }); return { id: job.id }; diff --git a/packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts b/packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts index 240eb3ee69..1de5fccf4b 100644 --- a/packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts @@ -87,6 +87,7 @@ export class DuplicateController { req: { user: req.user, clientIp: req.clientIp, + headers: req.headers, }, }); @@ -150,9 +151,10 @@ export class DuplicateController { sourceId: source.id, dupProjectId: dupProject.id, options: body.options || {}, - req: { + req: { user: req.user, clientIp: req.clientIp, + headers: req.headers, }, }); @@ -205,9 +207,10 @@ export class DuplicateController { modelId: model.id, title: uniqueTitle, options: body.options || {}, - req: { + req: { user: req.user, clientIp: req.clientIp, + headers: req.headers, }, }); diff --git a/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts b/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts index 6e377ffdae..bf55c0dd8c 100644 --- a/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.controller.ts @@ -38,6 +38,11 @@ export class MetaSyncController { baseId, sourceId: 'all', user: req.user, + req: { + user: req.user, + clientIp: req.clientIp, + headers: req.headers, + }, }); return { id: job.id }; @@ -70,6 +75,11 @@ export class MetaSyncController { baseId, sourceId, user: req.user, + req: { + user: req.user, + clientIp: req.clientIp, + headers: req.headers, + }, }); return { id: job.id }; diff --git a/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts b/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts index d33594436f..c0b9454292 100644 --- a/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/meta-sync/meta-sync.processor.ts @@ -17,19 +17,20 @@ export class MetaSyncProcessor { const info: { baseId: string; sourceId: string; - user: any; + user: any + req:any; } = job.data; if (info.sourceId === 'all') { await this.metaDiffsService.metaDiffSync({ baseId: info.baseId, - req: {}, + req: info.req, }); } else { await this.metaDiffsService.baseMetaDiffSync({ baseId: info.baseId, sourceId: info.sourceId, - req: {}, + req: info.req, }); } diff --git a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts index b3f3523bfb..e2091b974e 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.controller.ts @@ -4,7 +4,7 @@ import { HttpCode, Inject, Param, - Post, + Post, Req, UseGuards, } from '@nestjs/common'; import { BaseReqType } from 'nocodb-sdk'; @@ -25,7 +25,7 @@ export class SourceCreateController { ]) @HttpCode(200) @Acl('baseCreate') - async baseCreate(@Param('baseId') baseId: string, @Body() body: BaseReqType) { + async baseCreate(@Param('baseId') baseId: string, @Body() body: BaseReqType, @Req() req) { const jobs = await this.jobsService.jobList(); const fnd = jobs.find( (j) => j.name === JobTypes.BaseCreate && j.data.baseId === baseId, @@ -40,6 +40,11 @@ export class SourceCreateController { const job = await this.jobsService.add(JobTypes.BaseCreate, { baseId, source: body, + req: { + user: req.user, + clientIp: req.clientIp, + headers: req.headers, + }, }); return { id: job.id }; diff --git a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts index e535965154..3064006906 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-create/source-create.processor.ts @@ -18,7 +18,7 @@ export class SourceCreateProcessor { async job(job: Job) { this.debugLog(`job started for ${job.id}`); - const { baseId, source } = job.data; + const { baseId, source, req } = job.data; const logBasic = (log) => { this.jobsLogService.sendLog(job, { message: log }); @@ -29,6 +29,7 @@ export class SourceCreateProcessor { baseId, source, logger: logBasic, + req, }); if (createdBase.isMeta()) { diff --git a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts index ea07deebcf..930652b6d8 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Delete, Inject, Param, UseGuards } from '@nestjs/common'; +import {Controller, Delete, Inject, Param, Req, UseGuards} from '@nestjs/common'; import { GlobalGuard } from '~/guards/global/global.guard'; import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware'; import { NcError } from '~/helpers/catchError'; @@ -19,7 +19,7 @@ export class SourceDeleteController { '/api/v2/meta/bases/:baseId/sources/:sourceId', ]) @Acl('baseDelete') - async baseDelete(@Param('sourceId') sourceId: string) { + async baseDelete(@Param('sourceId') sourceId: string,@Req() req){ const jobs = await this.jobsService.jobList(); const fnd = jobs.find( (j) => j.name === JobTypes.BaseDelete && j.data.sourceId === sourceId, @@ -33,6 +33,11 @@ export class SourceDeleteController { const job = await this.jobsService.add(JobTypes.BaseDelete, { sourceId, + req: { + user: req.user, + clientIp: req.clientIp, + headers: req.headers, + }, }); return { id: job.id }; diff --git a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts index 8b8fb7a6c8..83bdec03d3 100644 --- a/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/source-delete/source-delete.processor.ts @@ -14,11 +14,11 @@ export class SourceDeleteProcessor { async job(job: Job) { this.debugLog(`job started for ${job.id}`); - const { sourceId } = job.data; + const { sourceId, req } = job.data; await this.sourcesService.baseDelete({ sourceId, - req: {}, + req, }); this.debugLog(`job completed for ${job.id}`);