Skip to content

Commit c36ca64

Browse files
authoredMay 14, 2025··
Merge pull request #807 from topcoder-platform/pm-1067_1
fix(PM-1067): allow project managers to view applications of opportunity not b…
2 parents f852b5a + cfbbd56 commit c36ca64

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed
 

‎src/permissions/copilotApplications.view.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,17 @@ module.exports = freq => new Promise((resolve, reject) => {
2121
const req = freq;
2222
req.context = req.context || {};
2323
req.context.currentOpportunity = opportunity;
24-
const projectId = opportunity.projectId;
2524
const isProjectManager = util.hasProjectManagerRole(req);
2625

27-
return models.ProjectMember.getActiveProjectMembers(projectId)
28-
.then((members) => {
29-
30-
return models.CopilotApplication.findOne({
31-
where: {
32-
opportunityId: opportunityId,
33-
userId: currentUserId,
34-
},
35-
}).then((copilotApplication) => {
36-
const isPartOfProject = isProjectManager && members.find(member => member.userId === currentUserId);
37-
// check if auth user has access to this project
38-
const hasAccess = util.hasAdminRole(req) || isPartOfProject || !!copilotApplication;
39-
return Promise.resolve(hasAccess);
40-
})
26+
return models.CopilotApplication.findOne({
27+
where: {
28+
opportunityId: opportunityId,
29+
userId: currentUserId,
30+
},
31+
}).then((copilotApplication) => {
32+
// check if auth user has access to this project
33+
const hasAccess = util.hasAdminRole(req) || isProjectManager || !!copilotApplication;
34+
return Promise.resolve(hasAccess);
4135
})
4236
})
4337
.then((hasAccess) => {

0 commit comments

Comments
 (0)
Please sign in to comment.