Skip to content

implement local event handling #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ The following parameters can be set in config files or in env variables:
- `PROJECT_API_URL`: the project service url
- `TC_API`: the Topcoder v5 url
- `ORG_ID`: the organization id
- `TOPCODER_SKILL_PROVIDER_ID`: the referenced skill provider id

- `esConfig.HOST`: the elasticsearch host
- `esConfig.ES_INDEX_JOB`: the job index
Expand Down
10 changes: 1 addition & 9 deletions app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
*/

const UserRoles = {
BookingManager: 'bookingmanager',
Administrator: 'administrator',
ConnectManager: 'Connect Manager'
BookingManager: 'bookingmanager'
}

const FullManagePermissionRoles = [
UserRoles.BookingManager,
UserRoles.Administrator
]

const Scopes = {
// job
READ_JOB: 'read:taas-jobs',
Expand All @@ -38,6 +31,5 @@ const Scopes = {

module.exports = {
UserRoles,
FullManagePermissionRoles,
Scopes
}
8 changes: 2 additions & 6 deletions app-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ module.exports = (app) => {
}
} else {
req.authUser.jwtToken = req.headers.authorization
// check if user has full manage permission
if (_.intersection(req.authUser.roles, constants.FullManagePermissionRoles).length) {
req.authUser.hasManagePermission = true
}
if (_.includes(req.authUser.roles, constants.UserRoles.ConnectManager)) {
req.authUser.isConnectManager = true
if (_.includes(req.authUser.roles, constants.UserRoles.BookingManager)) {
req.authUser.isBookingManager = true
}
next()
}
Expand Down
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const cors = require('cors')
const HttpStatus = require('http-status-codes')
const interceptor = require('express-interceptor')
const logger = require('./src/common/logger')
const eventHandlers = require('./src/eventHandlers')

// setup express app
const app = express()
Expand Down Expand Up @@ -91,6 +92,7 @@ app.use((err, req, res, next) => {

const server = app.listen(app.get('port'), () => {
logger.info({ component: 'app', message: `Express server listening on port ${app.get('port')}` })
eventHandlers.init()
})

if (process.env.NODE_ENV === 'test') {
Expand Down
1 change: 0 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = {

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

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

Expand Down
Loading