Skip to content

Commit f4c756c

Browse files
authored
Merge pull request #386 from fikzzzy/feature/new-roles
Update feature new roles
2 parents 4b7336f + f95a249 commit f4c756c

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

src/events/busApi.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,17 @@ module.exports = (app, logger) => {
122122
logger.debug('receive PROJECT_MEMBER_ADDED event');
123123

124124
let eventType;
125-
switch (member.role) {
126-
case PROJECT_MEMBER_ROLE.MANAGER:
127-
eventType = BUS_API_EVENT.MEMBER_JOINED_MANAGER;
128-
break;
129-
case PROJECT_MEMBER_ROLE.COPILOT:
130-
eventType = BUS_API_EVENT.MEMBER_JOINED_COPILOT;
131-
break;
132-
default:
133-
eventType = BUS_API_EVENT.MEMBER_JOINED;
134-
break;
125+
if ([
126+
PROJECT_MEMBER_ROLE.MANAGER,
127+
PROJECT_MEMBER_ROLE.PROJECT_MANAGER,
128+
PROJECT_MEMBER_ROLE.PROGRAM_MANAGER,
129+
PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT,
130+
].includes(member.role)) {
131+
eventType = BUS_API_EVENT.MEMBER_JOINED_MANAGER;
132+
} else if (member.role === PROJECT_MEMBER_ROLE.COPILOT) {
133+
eventType = BUS_API_EVENT.MEMBER_JOINED_COPILOT;
134+
} else {
135+
eventType = BUS_API_EVENT.MEMBER_JOINED;
135136
}
136137
const projectId = _.parseInt(req.params.projectId);
137138

src/routes/projectMembers/create.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ module.exports = [
8181
USER_ROLE.TOPCODER_ACCOUNT_MANAGER,
8282
USER_ROLE.BUSINESS_DEVELOPMENT_REPRESENTATIVE,
8383
USER_ROLE.PRESALES,
84+
USER_ROLE.ACCOUNT_EXECUTIVE,
85+
USER_ROLE.PROGRAM_MANAGER,
86+
USER_ROLE.SOLUTION_ARCHITECT,
87+
USER_ROLE.PROJECT_MANAGER,
8488
])) {
8589
const err = new Error(
86-
`Only manager, account manager, business development representative,
87-
or presales are able to join as ${targetRole}`,
90+
// eslint-disable-next-line max-len
91+
`Only manager, account manager, business development representative, account executive, program manager, project manager, solution architect, or presales are able to join as ${targetRole}`,
8892
);
8993
err.status = 401;
9094
return next(err);

src/routes/projects/update.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ module.exports = [
221221
const members = req.context.currentProjectMembers;
222222
const validRoles = [
223223
PROJECT_MEMBER_ROLE.MANAGER,
224-
PROJECT_MEMBER_ROLE.MANAGER,
224+
PROJECT_MEMBER_ROLE.PROGRAM_MANAGER,
225+
PROJECT_MEMBER_ROLE.PROJECT_MANAGER,
226+
PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT,
225227
].map(x => x.toLowerCase());
226228
const matchRole = role => _.indexOf(validRoles, role.toLowerCase()) >= 0;
227229
if (updatedProps.status === PROJECT_STATUS.ACTIVE &&

0 commit comments

Comments
 (0)