Skip to content

Commit a95adb3

Browse files
karthik-tarentoSahil-tarentoSaipradeepRtarentomaheshvakkundravisaurav-tarento
authored
4.8.10 dev v2 (#254)
* 4.8.10 dev (#240) * Added the proxies for competency mapping https://karmayogibharat.atlassian.net/browse/KB-1070 * Added the proxies for competency mapping https://karmayogibharat.atlassian.net/browse/KB-1070 * Added competencies v4 (#237) * Added cbPlan API (#239) --------- Co-authored-by: sahilchaudhary <[email protected]> Co-authored-by: SaipradeepR <[email protected]> Co-authored-by: Sahil-tarento <[email protected]> * Added api to get dept position * Added cbPlan API for Read and Archive (#244) * Added List API for CB Plan * KB-1493 - DEV | BE | API for Top 10 MDO data for the Hall of Fame 1. Added entry for kong and whitelisting. * KB-1492: added API for User CB Plan List (#246) * added hall of fame api in publicApiV8 * Update whitelistApis.ts karma points UI-proxy * Update proxies_v8.ts karma points : proxies v8 added * Added cbPlan change for user-Roles (#251) * Fix for merge issues --------- Co-authored-by: sahilchaudhary <[email protected]> Co-authored-by: SaipradeepR <[email protected]> Co-authored-by: Sahil-tarento <[email protected]> Co-authored-by: tarentomaheshvakkund <[email protected]> Co-authored-by: ravisaurav-tarento <[email protected]> Co-authored-by: shankaragoudab <[email protected]> Co-authored-by: dkttarento <[email protected]>
1 parent 6b4e9ad commit a95adb3

File tree

4 files changed

+125
-16
lines changed

4 files changed

+125
-16
lines changed

src/proxies_v8/proxies_v8.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ proxiesV8.use('/trending/content/search',
214214
proxyCreatorSunbirdSearch(express.Router(), `${CONSTANTS.KONG_API_BASE}/trending/search`)
215215
)
216216

217+
proxiesV8.use('/halloffame/read',
218+
// tslint:disable-next-line: max-line-length
219+
proxyCreatorSunbirdSearch(express.Router(), `${CONSTANTS.KONG_API_BASE}/halloffame/read`)
220+
)
221+
222+
proxiesV8.use('/karmapoints/read',
223+
// tslint:disable-next-line: max-line-length
224+
proxyCreatorSunbirdSearch(express.Router(), `${CONSTANTS.KONG_API_BASE}/karmapoints/read`)
225+
)
217226

218227
proxiesV8.get(['/api/user/v2/read', '/api/user/v2/read/:id'], async (req, res) => {
219228
const host = req.get('host')
@@ -334,7 +343,7 @@ proxiesV8.use('/dashboard/*',
334343
proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`)
335344
)
336345

337-
proxiesV8.post(['/user/v1/bulkupload','/storage/profilePhotoUpload/*'], (req, res) => {
346+
proxiesV8.post(['/user/v1/bulkupload', '/storage/profilePhotoUpload/*'], (req, res) => {
338347
if (req.files && req.files.data) {
339348
const url = removePrefix('/proxies/v8', req.originalUrl)
340349
const file: UploadedFile = req.files.data as UploadedFile
@@ -560,6 +569,11 @@ proxiesV8.use('/competency/*',
560569
proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`)
561570
)
562571

572+
proxiesV8.use('/cbplan/*',
573+
// tslint:disable-next-line: max-line-length
574+
proxyCreatorSunbird(express.Router(), `${CONSTANTS.KONG_API_BASE}`)
575+
)
576+
563577
function removePrefix(prefix: string, s: string) {
564578
return s.substr(prefix.length)
565579
}

src/publicApi_v8/publicApiV8.ts

+2
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,5 @@ publicApiV8.use('/workallocation', workallocationPublic)
6060
publicApiV8.use('/org/v1/list', proxyCreatorRoute(express.Router(), CONSTANTS.KONG_API_BASE + '/org/v1/list'))
6161

6262
publicApiV8.use('/parichay', parichayAuth)
63+
64+
publicApiV8.use('/halloffame/read', proxyCreatorRoute(express.Router(), CONSTANTS.KONG_API_BASE + '/halloffame/read'))

src/utils/proxyCreator.ts

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ proxy.on('proxyReq', (proxyReq: any, req: any, _res: any, _options: any) => {
2727
rootOrgId = req.session.rootOrgId
2828
}
2929
proxyReq.setHeader('x-authenticated-user-orgid', rootOrgId)
30+
let userRoles = []
31+
if (req.session.hasOwnProperty('userRoles')) {
32+
userRoles = req.session.userRoles
33+
}
34+
proxyReq.setHeader('x-authenticated-user-roles', userRoles)
3035
let channel = ''
3136
if (req.session.hasOwnProperty('channel')) {
3237
channel = req.session.channel

src/utils/whitelistApis.ts

+103-15
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const API_LIST = {
133133
ROLE.MDO_LEADER,
134134
ROLE.SPV_ADMIN,
135135
],
136-
},
136+
},
137137
'/proxies/v8/user/v1/read/:id': {
138138
checksNeeded: [CHECK.ROLE],
139139
// tslint:disable-next-line: object-literal-sort-keys
@@ -2491,14 +2491,14 @@ export const API_LIST = {
24912491
checksNeeded: [CHECK.ROLE],
24922492
// tslint:disable-next-line: object-literal-sort-keys
24932493
ROLE_CHECK: [
2494-
ROLE.PUBLIC,
2494+
ROLE.PUBLIC,
24952495
],
24962496
},
24972497
'/proxies/v8/read/user/insights': {
24982498
checksNeeded: [CHECK.ROLE],
24992499
// tslint:disable-next-line: object-literal-sort-keys
25002500
ROLE_CHECK: [
2501-
ROLE.PUBLIC,
2501+
ROLE.PUBLIC,
25022502
],
25032503
},
25042504
'/proxies/v8/storage/profilePhotoUpload/:cloudFolderName': {
@@ -2513,54 +2513,132 @@ export const API_LIST = {
25132513
// tslint:disable-next-line: object-literal-sort-keys
25142514
ROLE_CHECK: [
25152515
ROLE.MDO_ADMIN,
2516+
ROLE.MDO_LEADER,
25162517
],
25172518
},
2518-
'/proxies/v8/data/v1/system/settings/get/defaultCertTemplate': {
2519+
'/proxies/v8/competency/v4/search': {
25192520
checksNeeded: [CHECK.ROLE],
25202521
// tslint:disable-next-line: object-literal-sort-keys
25212522
ROLE_CHECK: [
2522-
ROLE.CONTENT_CREATOR,
2523-
ROLE.PROGRAM_COORDINATOR,
2523+
ROLE.PUBLIC,
25242524
],
25252525
},
2526-
'/proxies/v8/course/batch/cert/v1/template/add': {
2526+
'/proxies/v8/competency/v4/read/:id': {
25272527
checksNeeded: [CHECK.ROLE],
25282528
// tslint:disable-next-line: object-literal-sort-keys
25292529
ROLE_CHECK: [
2530-
ROLE.CONTENT_CREATOR,
2531-
ROLE.PROGRAM_COORDINATOR,
2530+
ROLE.PUBLIC,
25322531
],
25332532
},
2534-
'/proxies/v8/competency/v4/search': {
2533+
'/proxies/v8/competency/v4/upsert': {
25352534
checksNeeded: [CHECK.ROLE],
25362535
// tslint:disable-next-line: object-literal-sort-keys
25372536
ROLE_CHECK: [
2538-
ROLE.PUBLIC,
2537+
ROLE.MDO_ADMIN,
2538+
ROLE.MDO_LEADER,
25392539
],
25402540
},
2541-
'/proxies/v8/competency/v4/read/:id': {
2541+
'/proxies/v8/competency/v4/update/relation': {
25422542
checksNeeded: [CHECK.ROLE],
25432543
// tslint:disable-next-line: object-literal-sort-keys
25442544
ROLE_CHECK: [
2545-
ROLE.PUBLIC,
2545+
ROLE.MDO_ADMIN,
2546+
ROLE.MDO_LEADER,
25462547
],
25472548
},
2548-
'/proxies/v8/competency/v4/upsert': {
2549+
'/proxies/v8/cbplan/v1/create': {
25492550
checksNeeded: [CHECK.ROLE],
25502551
// tslint:disable-next-line: object-literal-sort-keys
25512552
ROLE_CHECK: [
25522553
ROLE.MDO_ADMIN,
25532554
ROLE.MDO_LEADER,
25542555
],
25552556
},
2556-
'/proxies/v8/competency/v4/update/relation': {
2557+
'/proxies/v8/cbplan/v1/update': {
2558+
checksNeeded: [CHECK.ROLE],
2559+
// tslint:disable-next-line: object-literal-sort-keys
2560+
ROLE_CHECK: [
2561+
ROLE.MDO_ADMIN,
2562+
ROLE.MDO_LEADER,
2563+
],
2564+
},
2565+
'/proxies/v8/cbplan/v1/publish': {
2566+
checksNeeded: [CHECK.ROLE],
2567+
// tslint:disable-next-line: object-literal-sort-keys
2568+
ROLE_CHECK: [
2569+
ROLE.MDO_ADMIN,
2570+
ROLE.MDO_LEADER,
2571+
],
2572+
},
2573+
'/proxies/v8/masterData/v2/deptPosition': {
2574+
checksNeeded: [CHECK.ROLE],
2575+
// tslint:disable-next-line: object-literal-sort-keys
2576+
ROLE_CHECK: [
2577+
ROLE.MDO_ADMIN,
2578+
ROLE.MDO_LEADER,
2579+
],
2580+
},
2581+
'/proxies/v8/cbplan/v1/archive': {
25572582
checksNeeded: [CHECK.ROLE],
25582583
// tslint:disable-next-line: object-literal-sort-keys
25592584
ROLE_CHECK: [
25602585
ROLE.MDO_ADMIN,
25612586
ROLE.MDO_LEADER,
25622587
],
25632588
},
2589+
'/proxies/v8/cbplan/v1/read/:id': {
2590+
checksNeeded: [CHECK.ROLE],
2591+
// tslint:disable-next-line: object-literal-sort-keys
2592+
ROLE_CHECK: [
2593+
ROLE.MDO_ADMIN,
2594+
ROLE.MDO_LEADER,
2595+
],
2596+
},
2597+
'/proxies/v8/cbplan/v1/list': {
2598+
checksNeeded: [CHECK.ROLE],
2599+
// tslint:disable-next-line: object-literal-sort-keys
2600+
ROLE_CHECK: [
2601+
ROLE.MDO_ADMIN,
2602+
ROLE.MDO_LEADER,
2603+
],
2604+
},
2605+
'/proxies/v8/halloffame/read': {
2606+
checksNeeded: [CHECK.ROLE],
2607+
// tslint:disable-next-line: object-literal-sort-keys
2608+
ROLE_CHECK: [
2609+
ROLE.PUBLIC,
2610+
],
2611+
},
2612+
'/proxies/v8/user/v1/cbplan': {
2613+
checksNeeded: [CHECK.ROLE],
2614+
// tslint:disable-next-line: object-literal-sort-keys
2615+
ROLE_CHECK: [
2616+
ROLE.PUBLIC,
2617+
],
2618+
},
2619+
'/proxies/v8/karmapoints/read': {
2620+
checksNeeded: [CHECK.ROLE],
2621+
// tslint:disable-next-line: object-literal-sort-keys
2622+
ROLE_CHECK: [
2623+
ROLE.PUBLIC,
2624+
],
2625+
},
2626+
'/proxies/v8/data/v1/system/settings/get/defaultCertTemplate': {
2627+
checksNeeded: [CHECK.ROLE],
2628+
// tslint:disable-next-line: object-literal-sort-keys
2629+
ROLE_CHECK: [
2630+
ROLE.CONTENT_CREATOR,
2631+
ROLE.PROGRAM_COORDINATOR,
2632+
],
2633+
},
2634+
'/proxies/v8/course/batch/cert/v1/template/add': {
2635+
checksNeeded: [CHECK.ROLE],
2636+
// tslint:disable-next-line: object-literal-sort-keys
2637+
ROLE_CHECK: [
2638+
ROLE.CONTENT_CREATOR,
2639+
ROLE.PROGRAM_COORDINATOR,
2640+
],
2641+
},
25642642
},
25652643
URL_PATTERN:
25662644
[
@@ -2887,5 +2965,15 @@ export const API_LIST = {
28872965
'/proxies/v8/competency/v4/read/:id',
28882966
'/proxies/v8/competency/v4/upsert',
28892967
'/proxies/v8/competency/v4/update/relation',
2968+
'/proxies/v8/cbplan/v1/create',
2969+
'/proxies/v8/cbplan/v1/update',
2970+
'/proxies/v8/cbplan/v1/publish',
2971+
'/proxies/v8/masterData/v2/deptPosition',
2972+
'/proxies/v8/cbplan/v1/archive',
2973+
'/proxies/v8/cbplan/v1/read/:id',
2974+
'/proxies/v8/cbplan/v1/list',
2975+
'/proxies/v8/halloffame/read',
2976+
'/proxies/v8/user/v1/cbplan',
2977+
'/proxies/v8/karmapoints/read',
28902978
],
28912979
}

0 commit comments

Comments
 (0)