Skip to content
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

Strallia: 🔥 some tasks not showing on dashboard #1178

Merged
Merged
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
13 changes: 11 additions & 2 deletions src/controllers/projectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,21 @@ const projectController = function (Project) {
res.status(400).send('Invalid request');
return;
}
const getId = await hasPermission(req.body.requestor, 'getProjectMembers');

const getProjMembers = await hasPermission(req.body.requestor, 'getProjectMembers');

// If a user has permission to post, edit, or suggest tasks, they also have the ability to assign resources to those tasks.
// Therefore, the _id field must be included when retrieving the user profile for project members (resources).
const postTask = await hasPermission(req.body.requestor, 'postTask');
const updateTask = await hasPermission(req.body.requestor, 'updateTask');
const suggestTask = await hasPermission(req.body.requestor, 'suggestTask');

const canGetId = (getProjMembers || postTask || updateTask || suggestTask);

userProfile
.find(
{ projects: projectId },
{ firstName: 1, lastName: 1, isActive: 1, profilePic: 1, _id: getId },
{ firstName: 1, lastName: 1, isActive: 1, profilePic: 1, _id: canGetId },
)
.sort({ firstName: 1, lastName: 1 })
.then((results) => {
Expand Down
Loading