From 1a34e7343a2b3764a1a760feea21cf2236f282e2 Mon Sep 17 00:00:00 2001 From: karthik-tarento Date: Thu, 6 Oct 2022 08:49:37 +0530 Subject: [PATCH] Added orgname header for bulk upload --- src/proxies_v8/proxies_v8.ts | 5 +++++ src/utils/proxyCreator.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/proxies_v8/proxies_v8.ts b/src/proxies_v8/proxies_v8.ts index d4cbfaac..c872f5fa 100644 --- a/src/proxies_v8/proxies_v8.ts +++ b/src/proxies_v8/proxies_v8.ts @@ -320,6 +320,10 @@ proxiesV8.post('/user/v1/bulkupload', (req, res) => { if (!rootOrgId) { rootOrgId = '' } + let channel = _.get(req, 'session.channel') + if (!channel) { + channel = '' + } formData.submit( { headers: { @@ -327,6 +331,7 @@ proxiesV8.post('/user/v1/bulkupload', (req, res) => { Authorization: CONSTANTS.SB_API_KEY, // tslint:disable-next-line: all 'x-authenticated-user-orgid': rootOrgId, + 'x-authenticated-user-orgname': channel, 'x-authenticated-user-token': extractUserToken(req), 'x-authenticated-userid': extractUserIdFromRequest(req), }, diff --git a/src/utils/proxyCreator.ts b/src/utils/proxyCreator.ts index 1015b07b..08f10426 100644 --- a/src/utils/proxyCreator.ts +++ b/src/utils/proxyCreator.ts @@ -26,6 +26,11 @@ proxy.on('proxyReq', (proxyReq: any, req: any, _res: any, _options: any) => { rootOrgId = req.session.rootOrgId } proxyReq.setHeader('x-authenticated-user-orgid', rootOrgId) + let channel = '' + if (req.session.hasOwnProperty('channel')) { + channel = req.session.channel + } + proxyReq.setHeader('x-authenticated-user-orgname', channel) // condition has been added to set the session in nodebb req header /* tslint:disable-next-line */