Skip to content

Commit

Permalink
Added orgname header for bulk upload
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Oct 6, 2022
1 parent 7a2945a commit 1a34e73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/proxies_v8/proxies_v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,18 @@ proxiesV8.post('/user/v1/bulkupload', (req, res) => {
if (!rootOrgId) {
rootOrgId = ''
}
let channel = _.get(req, 'session.channel')
if (!channel) {
channel = ''
}
formData.submit(
{
headers: {
// tslint:disable-next-line:max-line-length
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),
},
Expand Down
5 changes: 5 additions & 0 deletions src/utils/proxyCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 1a34e73

Please sign in to comment.