Skip to content
Merged
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
21 changes: 11 additions & 10 deletions src/events/busApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,17 @@ module.exports = (app, logger) => {
logger.debug('receive PROJECT_MEMBER_ADDED event');

let eventType;
switch (member.role) {
case PROJECT_MEMBER_ROLE.MANAGER:
eventType = BUS_API_EVENT.MEMBER_JOINED_MANAGER;
break;
case PROJECT_MEMBER_ROLE.COPILOT:
eventType = BUS_API_EVENT.MEMBER_JOINED_COPILOT;
break;
default:
eventType = BUS_API_EVENT.MEMBER_JOINED;
break;
if ([
PROJECT_MEMBER_ROLE.MANAGER,
PROJECT_MEMBER_ROLE.PROJECT_MANAGER,
PROJECT_MEMBER_ROLE.PROGRAM_MANAGER,
PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT,
].includes(member.role)) {
eventType = BUS_API_EVENT.MEMBER_JOINED_MANAGER;
} else if (member.role === PROJECT_MEMBER_ROLE.COPILOT) {
eventType = BUS_API_EVENT.MEMBER_JOINED_COPILOT;
} else {
eventType = BUS_API_EVENT.MEMBER_JOINED;
}
const projectId = _.parseInt(req.params.projectId);

Expand Down
8 changes: 6 additions & 2 deletions src/routes/projectMembers/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,14 @@ module.exports = [
USER_ROLE.TOPCODER_ACCOUNT_MANAGER,
USER_ROLE.BUSINESS_DEVELOPMENT_REPRESENTATIVE,
USER_ROLE.PRESALES,
USER_ROLE.ACCOUNT_EXECUTIVE,
USER_ROLE.PROGRAM_MANAGER,
USER_ROLE.SOLUTION_ARCHITECT,
USER_ROLE.PROJECT_MANAGER,
])) {
const err = new Error(
`Only manager, account manager, business development representative,
or presales are able to join as ${targetRole}`,
// eslint-disable-next-line max-len
`Only manager, account manager, business development representative, account executive, program manager, project manager, solution architect, or presales are able to join as ${targetRole}`,
);
err.status = 401;
return next(err);
Expand Down
4 changes: 3 additions & 1 deletion src/routes/projects/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ module.exports = [
const members = req.context.currentProjectMembers;
const validRoles = [
PROJECT_MEMBER_ROLE.MANAGER,
PROJECT_MEMBER_ROLE.MANAGER,
PROJECT_MEMBER_ROLE.PROGRAM_MANAGER,
PROJECT_MEMBER_ROLE.PROJECT_MANAGER,
PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT,
].map(x => x.toLowerCase());
const matchRole = role => _.indexOf(validRoles, role.toLowerCase()) >= 0;
if (updatedProps.status === PROJECT_STATUS.ACTIVE &&
Expand Down