diff --git a/config/development.json b/config/development.json index 631024c1..3f3e909b 100644 --- a/config/development.json +++ b/config/development.json @@ -5,5 +5,6 @@ "connectProjectsUrl": "https://connect.topcoder-dev.com/projects/", "fileServiceEndpoint": "https://api.topcoder-dev.com/v3/files/", "connectProjectsUrl": "https://connect.topcoder-dev.com/projects/", - "memberServiceEndpoint": "https://api.topcoder-dev.com/v3/members" + "memberServiceEndpoint": "https://api.topcoder-dev.com/v3/members", + "identityServiceEndpoint": "https://api.topcoder-dev.com/v3/" } diff --git a/docs/permissions.html b/docs/permissions.html index 33f4d536..43823aa0 100644 --- a/docs/permissions.html +++ b/docs/permissions.html @@ -85,6 +85,11 @@ background-color: #b8daff; vertical-align: middle; } + + .badge-crossed { + opacity: 0.4; + text-decoration: line-through; + } @@ -96,11 +101,11 @@

Permissions

Legend:

@@ -175,7 +180,7 @@

Read Project
READ_PROJECT
-
+
Read project when user is a member.
@@ -186,14 +191,6 @@

Connect Admin administrator Connect Manager - Connect Account Manager - Connect Copilot Manager - Business Development Representative - Presales - Account Executive - Program Manager - Solution Architect - Project Manager

@@ -219,14 +216,6 @@

Connect Admin administrator Connect Manager - Connect Account Manager - Connect Copilot Manager - Business Development Representative - Presales - Account Executive - Program Manager - Solution Architect - Project Manager

@@ -1171,10 +1160,12 @@

+ manager + account_manager program_manager + account_executive solution_architect project_manager - manager copilot
@@ -1197,6 +1188,7 @@

Project \ Topcoder
Connect Manager
+
Connect Copilot Manager
Connect Admin
administrator
Connect Account Manager
@@ -1246,6 +1238,9 @@

✅ + + ✅ + ✅ @@ -1260,84 +1255,9 @@

✅ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - copilot - - - - - - - - - - - - - - - - - ✅ - - - - - - - - - - - - - - - - - - - account_manager - - ✅ - - - - - - ✅ @@ -1351,92 +1271,14 @@

- - ✅ - - - ✅ - - + ✅ - + ✅ - - - - - - - account_executive - - - - - - - - - - - - - - - - - - - - ✅ - - - - - - - - - - - - - - - - project_manager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ✅ @@ -1446,13 +1288,7 @@

- solution_architect - - - - - - + copilot @@ -1483,36 +1319,6 @@

- - - program_manager - - - - - - - - - - - - - - - - - - - - - - - - - - ✅ - @@ -1526,7 +1332,7 @@

- +
- means default Project Role if user with according Topcoder Role directly joins the project (if they are allowed to join directly). If user has multiple Topcoder Roles then the most left Topcoder Role on the table would define default Project Role. diff --git a/scripts/permissions-doc/template.hbs b/scripts/permissions-doc/template.hbs index 41d49140..f4a9a644 100644 --- a/scripts/permissions-doc/template.hbs +++ b/scripts/permissions-doc/template.hbs @@ -85,6 +85,11 @@ background-color: #b8daff; vertical-align: middle; } + + .badge-crossed { + opacity: 0.4; + text-decoration: line-through; + } @@ -96,11 +101,11 @@

Legend:

  • allowed Project Role - users with such a Project Role are allowed to perform the action
  • -
  • denied Project Role - users with such a Project Role are denied to perform the action even they have some other allow roles
  • +
  • denied Project Role - users with such a Project Role are denied to perform the action even they have some other allow roles
  • allowed Topcoder Role - users with such a Topcoder Role are allowed to perform the action
  • -
  • denied Topcoder Role - users with such a Topcoder Role are denied to perform the action even they have some other allow roles
  • +
  • denied Topcoder Role - users with such a Topcoder Role are denied to perform the action even they have some other allow roles
  • allowed M2M Scope - M2M tokens with such a scope are allowed to perform the action
  • -
  • denied M2M Scope - M2M tokens with such a scope are allowed to perform the action even they have some other allow scopes
  • +
  • denied M2M Scope - M2M tokens with such a scope are allowed to perform the action even they have some other allow scopes

@@ -131,7 +136,7 @@ {{/each}} {{/if}} {{#each denyRule.projectRoles}} - {{this}} + {{this}} {{/each}}
@@ -144,7 +149,7 @@ {{/each}} {{/if}} {{#each denyRule.topcoderRoles}} - {{this}} + {{this}} {{/each}} @@ -153,7 +158,7 @@ {{this}} {{/each}} {{#each denyRule.scopes}} - {{this}} + {{this}} {{/each}} diff --git a/src/permissions/constants.js b/src/permissions/constants.js index 6c65d0d7..c69cf36f 100644 --- a/src/permissions/constants.js +++ b/src/permissions/constants.js @@ -161,8 +161,12 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export meta: { title: 'Read Project', group: 'Project', + description: 'Read project when user is a member.', }, - topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS, + topcoderRoles: [ + ...TOPCODER_ROLES_ADMINS, + USER_ROLE.MANAGER, + ], projectRoles: ALL, scopes: SCOPES_PROJECTS_READ, }, @@ -173,7 +177,10 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export group: 'Project', description: 'Read any project, even when not a member.', }, - topcoderRoles: TOPCODER_ROLES_MANAGERS_AND_ADMINS, + topcoderRoles: [ + ...TOPCODER_ROLES_ADMINS, + USER_ROLE.MANAGER, + ], scopes: SCOPES_PROJECTS_READ, }, @@ -558,10 +565,7 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export }, topcoderRoles: TOPCODER_ROLES_ADMINS, projectRoles: [ - PROJECT_MEMBER_ROLE.PROGRAM_MANAGER, - PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT, - PROJECT_MEMBER_ROLE.PROJECT_MANAGER, - PROJECT_MEMBER_ROLE.MANAGER, + ...PROJECT_ROLES_MANAGEMENT, PROJECT_MEMBER_ROLE.COPILOT, ], }, @@ -577,12 +581,6 @@ export const PROJECT_TO_TOPCODER_ROLES_MATRIX = { USER_ROLE.TOPCODER_ADMIN, USER_ROLE.CONNECT_ADMIN, USER_ROLE.MANAGER, - ], - [PROJECT_MEMBER_ROLE.COPILOT]: [ - USER_ROLE.COPILOT, - ], - [PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER]: [ - USER_ROLE.MANAGER, USER_ROLE.TOPCODER_ACCOUNT_MANAGER, USER_ROLE.BUSINESS_DEVELOPMENT_REPRESENTATIVE, USER_ROLE.PRESALES, @@ -590,18 +588,10 @@ export const PROJECT_TO_TOPCODER_ROLES_MATRIX = { USER_ROLE.PROGRAM_MANAGER, USER_ROLE.SOLUTION_ARCHITECT, USER_ROLE.PROJECT_MANAGER, + USER_ROLE.COPILOT_MANAGER, ], - [PROJECT_MEMBER_ROLE.ACCOUNT_EXECUTIVE]: [ - USER_ROLE.ACCOUNT_EXECUTIVE, - ], - [PROJECT_MEMBER_ROLE.PROJECT_MANAGER]: [ - USER_ROLE.PROJECT_MANAGER, - ], - [PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT]: [ - USER_ROLE.SOLUTION_ARCHITECT, - ], - [PROJECT_MEMBER_ROLE.PROGRAM_MANAGER]: [ - USER_ROLE.PROGRAM_MANAGER, + [PROJECT_MEMBER_ROLE.COPILOT]: [ + USER_ROLE.COPILOT, ], }; @@ -618,6 +608,9 @@ export const DEFAULT_PROJECT_ROLE = [ { topcoderRole: USER_ROLE.MANAGER, projectRole: PROJECT_MEMBER_ROLE.MANAGER, + }, { + topcoderRole: USER_ROLE.COPILOT_MANAGER, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.CONNECT_ADMIN, projectRole: PROJECT_MEMBER_ROLE.MANAGER, @@ -626,28 +619,28 @@ export const DEFAULT_PROJECT_ROLE = [ projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.TOPCODER_ACCOUNT_MANAGER, - projectRole: PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.BUSINESS_DEVELOPMENT_REPRESENTATIVE, - projectRole: PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.PRESALES, - projectRole: PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.COPILOT, projectRole: PROJECT_MEMBER_ROLE.COPILOT, }, { topcoderRole: USER_ROLE.ACCOUNT_EXECUTIVE, - projectRole: PROJECT_MEMBER_ROLE.ACCOUNT_EXECUTIVE, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.PROGRAM_MANAGER, - projectRole: PROJECT_MEMBER_ROLE.PROGRAM_MANAGER, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.SOLUTION_ARCHITECT, - projectRole: PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.PROJECT_MANAGER, - projectRole: PROJECT_MEMBER_ROLE.PROJECT_MANAGER, + projectRole: PROJECT_MEMBER_ROLE.MANAGER, }, { topcoderRole: USER_ROLE.TOPCODER_USER, projectRole: PROJECT_MEMBER_ROLE.CUSTOMER, diff --git a/src/routes/projectMemberInvites/create.spec.js b/src/routes/projectMemberInvites/create.spec.js index 0beba23c..2ed2f15c 100644 --- a/src/routes/projectMemberInvites/create.spec.js +++ b/src/routes/projectMemberInvites/create.spec.js @@ -709,30 +709,6 @@ describe('Project Member Invite create', () => { }); }); - it('should return 201 if try to create account_manager with MANAGER_ROLES', (done) => { - util.getUserRoles.restore(); - sandbox.stub(util, 'getUserRoles', () => Promise.resolve([USER_ROLE.MANAGER])); - request(server) - .post(`/v5/projects/${project1.id}/invites`) - .set({ - Authorization: `Bearer ${testUtil.jwts.manager}`, - }) - .send({ - handles: ['test_manager4'], - role: 'account_manager', - }) - .expect('Content-Type', /json/) - .expect(201) - .end((err, res) => { - const resJson = res.body.success[0]; - should.exist(resJson); - resJson.role.should.equal('account_manager'); - resJson.projectId.should.equal(project1.id); - resJson.userId.should.equal(40051336); - done(); - }); - }); - it('should return 403 if try to create account_manager with CUSTOMER_ROLE', (done) => { util.getUserRoles.restore(); sandbox.stub(util, 'getUserRoles', () => Promise.resolve(['Topcoder User'])); diff --git a/src/routes/projectMembers/create.spec.js b/src/routes/projectMembers/create.spec.js index 4e294d25..e607131a 100644 --- a/src/routes/projectMembers/create.spec.js +++ b/src/routes/projectMembers/create.spec.js @@ -338,17 +338,6 @@ describe('Project Members create', () => { .expect(401, done); }); - it('should return 401 if register admin as role other than manager (project manager) ', (done) => { - request(server) - .post(`/v5/projects/${project1.id}/members/`) - .set({ - Authorization: `Bearer ${testUtil.jwts.admin}`, - }) - .send({ role: PROJECT_MEMBER_ROLE.PROJECT_MANAGER }) - .expect('Content-Type', /json/) - .expect(401, done); - }); - describe('Bus api', () => { let createEventSpy;