Skip to content

Commit 51128fc

Browse files
authored
Merge branch 'dev' into implement-event-handlers-repost
2 parents c208671 + 28e0b38 commit 51128fc

19 files changed

+3050
-131
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The following parameters can be set in config files or in env variables:
3636
- `PROJECT_API_URL`: the project service url
3737
- `TC_API`: the Topcoder v5 url
3838
- `ORG_ID`: the organization id
39+
- `TOPCODER_SKILL_PROVIDER_ID`: the referenced skill provider id
3940

4041
- `esConfig.HOST`: the elasticsearch host
4142
- `esConfig.ES_INDEX_JOB`: the job index

app-constants.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
*/
44

55
const UserRoles = {
6-
BookingManager: 'bookingmanager'
6+
BookingManager: 'bookingmanager',
7+
Administrator: 'administrator',
8+
ConnectManager: 'Connect Manager'
79
}
810

11+
const FullManagePermissionRoles = [
12+
UserRoles.BookingManager,
13+
UserRoles.Administrator
14+
]
15+
916
const Scopes = {
1017
// job
1118
READ_JOB: 'read:taas-jobs',
@@ -31,5 +38,6 @@ const Scopes = {
3138

3239
module.exports = {
3340
UserRoles,
41+
FullManagePermissionRoles,
3442
Scopes
3543
}

app-routes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ module.exports = (app) => {
4949
}
5050
} else {
5151
req.authUser.jwtToken = req.headers.authorization
52-
if (_.includes(req.authUser.roles, constants.UserRoles.BookingManager)) {
53-
req.authUser.isBookingManager = true
52+
// check if user has full manage permission
53+
if (_.intersection(req.authUser.roles, constants.FullManagePermissionRoles).length) {
54+
req.authUser.hasManagePermission = true
55+
}
56+
if (_.includes(req.authUser.roles, constants.UserRoles.ConnectManager)) {
57+
req.authUser.isConnectManager = true
5458
}
5559
next()
5660
}

config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121

2222
TC_API: process.env.TC_API || 'https://api.topcoder-dev.com/v5',
2323
ORG_ID: process.env.ORG_ID || '36ed815b-3da1-49f1-a043-aaed0a4e81ad',
24+
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',
2425

2526
TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',
2627

0 commit comments

Comments
 (0)