Skip to content

Commit d61ed77

Browse files
authored
Merge pull request #790 from topcoder-platform/pm-974
fix(PM-974): allow project manager to view all projects
2 parents 8430f66 + 9612c1a commit d61ed77

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/permissions/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
191191
topcoderRoles: [
192192
...TOPCODER_ROLES_ADMINS,
193193
USER_ROLE.MANAGER,
194+
USER_ROLE.PROJECT_MANAGER,
194195
],
195196
projectRoles: ALL,
196197
scopes: SCOPES_PROJECTS_READ,
@@ -205,6 +206,7 @@ export const PERMISSION = { // eslint-disable-line import/prefer-default-export
205206
topcoderRoles: [
206207
...TOPCODER_ROLES_ADMINS,
207208
USER_ROLE.MANAGER,
209+
USER_ROLE.PROJECT_MANAGER,
208210
],
209211
scopes: SCOPES_PROJECTS_READ,
210212
},

src/routes/projects/list.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ module.exports = [
661661
(sort && _.indexOf(sortableProps, sort) < 0)) {
662662
return util.handleError('Invalid filters or sort', null, req, next);
663663
}
664+
664665
// check if user only wants to retrieve projects where he/she is a member
665666
const memberOnly = _.get(filters, 'memberOnly', false);
666667
filters = _.omit(filters, 'memberOnly');
@@ -674,7 +675,7 @@ module.exports = [
674675
};
675676
req.log.info(criteria);
676677
// TODO refactor (DRY) code below so we don't repeat the same logic for admins and non-admin users
677-
if (!memberOnly && util.hasPermission(PERMISSION.READ_PROJECT_ANY, req.authUser)) {
678+
if (memberOnly !== 'true' && util.hasPermission(PERMISSION.READ_PROJECT_ANY, req.authUser)) {
678679
// admins & topcoder managers can see all projects
679680
return retrieveProjects(req, criteria, sort, req.query.fields)
680681
.then((result) => {

0 commit comments

Comments
 (0)