Skip to content

fix(PM-855): allow pm to access all applications #804

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ workflows:
context : org-global
filters:
branches:
only: ['develop', 'migration-setup']
only: ['develop', 'migration-setup', 'pm-855_1']
- deployProd:
context : org-global
filters:
Expand Down
24 changes: 9 additions & 15 deletions src/permissions/copilotApplications.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,17 @@ module.exports = freq => new Promise((resolve, reject) => {
const req = freq;
req.context = req.context || {};
req.context.currentOpportunity = opportunity;
const projectId = opportunity.projectId;
const isProjectManager = util.hasProjectManagerRole(req);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable projectId is declared but never used in the modified code. Consider removing it to clean up the code.


return models.ProjectMember.getActiveProjectMembers(projectId)
.then((members) => {

return models.CopilotApplication.findOne({
where: {
opportunityId: opportunityId,
userId: currentUserId,
},
}).then((copilotApplication) => {
const isPartOfProject = isProjectManager && members.find(member => member.userId === currentUserId);
// check if auth user has access to this project
const hasAccess = util.hasAdminRole(req) || isPartOfProject || !!copilotApplication;
return Promise.resolve(hasAccess);
})
return models.CopilotApplication.findOne({
where: {
opportunityId: opportunityId,
userId: currentUserId,
},
}).then((copilotApplication) => {
// check if auth user has access to this project
const hasAccess = util.hasAdminRole(req) || isProjectManager || !!copilotApplication;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for determining hasAccess has changed. Previously, it checked if the user was part of the project members, but now it only checks if the user is a project manager. Ensure this change aligns with the intended functionality described in the pull request.

return Promise.resolve(hasAccess);
})
})
.then((hasAccess) => {
Expand Down