Skip to content
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
5 changes: 5 additions & 0 deletions src/components/PermissionsManagement/Permissions.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@
"label": "Unassign Team Members from Tasks",
"key": "deleteDashboardTask",
"description": "Gives the user permission to UNASSIGN tasks from only their TEAM members through the Dashboard -> task -> red X."
},
{
"label": "See # of Times Time Added to Task",
"key": "seeNumberOfTimesTimeAdded",
"description": "Gives the user permission to see how many times a time entry has been added to a task. \"Admin/Owner Login\" -> \"Dashboard\" -> \"Tasks tab\" -> \"Task Details\" -> \"# of Times Time Added\""
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/TeamMemberTasks/TeamMemberTask.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ const TeamMemberTask = React.memo(
const rolesAllowedToSeeDeadlineCount = ['Manager', 'Mentor', 'Administrator', 'Owner'];
const isAllowedToResolveTasks =
rolesAllowedToResolveTasks.includes(userRole) || dispatch(hasPermission('resolveTask'));
const isAllowedToSeeDeadlineCount = rolesAllowedToSeeDeadlineCount.includes(userRole);
const isAllowedToSeeDeadlineCount =
rolesAllowedToSeeDeadlineCount.includes(userRole) ||
dispatch(hasPermission('seeNumberOfTimesTimeAdded'));
Comment on lines +151 to +153
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const isAllowedToSeeDeadlineCount =
rolesAllowedToSeeDeadlineCount.includes(userRole) ||
dispatch(hasPermission('seeNumberOfTimesTimeAdded'));
const isAllowedToSeeDeadlineCount = dispatch(hasPermission('seeNumberOfTimesTimeAdded'));

hasPermission() checks role permissions, which it looks like you set up on the backend through createInitialPermissions.js. Checking against this hard-coded array can potentially create conflicting sources of truth.


const canGetWeeklySummaries = dispatch(hasPermission('getWeeklySummaries'));
const canSeeReports =
Expand Down
Loading