Skip to content

Observer role addition #740

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

Merged
merged 16 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
version: 2
python_env: &python_env
docker:
- image: circleci/python:2.7-stretch-browsers
- image: cimg/python:3.11.0-browsers

install_awscli: &install_awscli
name: "Install awscli"
command: |
sudo pip install awscli --upgrade
sudo apt install python3-pip
sudo pip3 install awscli --upgrade
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4.1 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const PROJECT_MEMBER_ROLE = {

export const PROJECT_MEMBER_MANAGER_ROLES = [
PROJECT_MEMBER_ROLE.MANAGER,
PROJECT_MEMBER_ROLE.OBSERVER,
PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER,
PROJECT_MEMBER_ROLE.ACCOUNT_EXECUTIVE,
PROJECT_MEMBER_ROLE.PROJECT_MANAGER,
Expand Down Expand Up @@ -142,6 +141,7 @@ export const BUS_API_EVENT = {
PROJECT_CREATED: 'project.action.create',
PROJECT_UPDATED: 'project.action.update',
PROJECT_DELETED: 'project.action.delete',
PROJECT_BILLING_ACCOUNT_UPDATED: 'project.action.billingAccount.update',

PROJECT_MEMBER_ADDED: 'project.action.create',
PROJECT_MEMBER_REMOVED: 'project.action.delete',
Expand Down
12 changes: 12 additions & 0 deletions src/events/busApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ module.exports = (app, logger) => {
projectUrl: connectProjectUrl(updated.id),
}), logger);

if (!_.isEqual(original.billingAccountId, updated.billingAccountId)) {
logger.debug('project billing account is updated');
createEvent(BUS_API_EVENT.PROJECT_BILLING_ACCOUNT_UPDATED, {
projectId: updated.id,
projectName: updated.name,
directProjectId: updated.directProjectId,
status: updated.status,
oldBillingAccountId: original.billingAccountId,
newBillingAccountId: updated.billingAccountId,
}, logger);
}

/*
Send event for Notification Service
*/
Expand Down
46 changes: 37 additions & 9 deletions src/permissions/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'There are additional limitations on editing some parts of the project.',
},
topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECTS_WRITE,
},

Expand Down Expand Up @@ -365,7 +368,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'Who can update project members with "customer" role.',
},
topcoderRoles: TOPCODER_ROLES_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECT_MEMBERS_WRITE,
},

Expand All @@ -387,7 +393,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'Who can delete project members with "customer" role.',
},
topcoderRoles: TOPCODER_ROLES_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECT_MEMBERS_WRITE,
},

Expand All @@ -412,7 +421,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
...TOPCODER_ROLES_ADMINS,
USER_ROLE.COPILOT_MANAGER,
],
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECT_MEMBERS_WRITE,
},

Expand All @@ -436,7 +448,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'Who can view invites of other users.',
},
topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECT_INVITES_READ,
},

Expand All @@ -447,7 +462,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'Who can invite project members with "customer" role.',
},
topcoderRoles: TOPCODER_ROLES_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECT_INVITES_WRITE,
},

Expand Down Expand Up @@ -576,7 +594,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
group: 'Project Attachment',
},
topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECTS_WRITE,
},

Expand Down Expand Up @@ -608,7 +629,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'Who can edit attachment they created.',
},
topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECTS_WRITE,
},

Expand All @@ -629,7 +653,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
description: 'Who can delete attachment they created.',
},
topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS,
projectRoles: ALL,
projectRoles: [
...PROJECT_ROLES_MANAGEMENT,
PROJECT_MEMBER_ROLE.COPILOT,
],
scopes: SCOPES_PROJECTS_WRITE,
},

Expand Down Expand Up @@ -708,6 +735,7 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
*/
export const PROJECT_TO_TOPCODER_ROLES_MATRIX = {
[PROJECT_MEMBER_ROLE.CUSTOMER]: _.values(USER_ROLE),
[PROJECT_MEMBER_ROLE.OBSERVER]: _.values(USER_ROLE),
[PROJECT_MEMBER_ROLE.MANAGER]: [
USER_ROLE.TOPCODER_ADMIN,
USER_ROLE.CONNECT_ADMIN,
Expand Down