Skip to content

Roshini Seelamsetty : fix: implement permissions logic for task extension count visibility#2181

Open
roshini1212 wants to merge 1 commit into
developmentfrom
Roshini_feature/task-extension
Open

Roshini Seelamsetty : fix: implement permissions logic for task extension count visibility#2181
roshini1212 wants to merge 1 commit into
developmentfrom
Roshini_feature/task-extension

Conversation

@roshini1212
Copy link
Copy Markdown

@roshini1212 roshini1212 commented Apr 25, 2026

Description

Screenshot 2026-04-25 at 11 56 24

Related PRS (if any):

This backend #2181 PR is related to the #5199 PR Frontend.
To test this backend #2181 PR you need to checkout the #5199 PR frontend.

Main changes explained:

  • Update taskController.js to check seeNumberOfTimesTimeAdded / viewTaskExtensionCount permission before returning deadlineCount in getTasks, getTaskById, and getTasksForTeamsByUser
  • Add canSeeTaskExtensionCount helper that checks the permission via hasPermission
  • Add removeTaskExtensionCounts helper that strips deadlineCount from task results when permission is absent
  • Update taskController.spec.js to cover the case where deadlineCount is hidden when permission is missing

How to test:

  1. Check into current backend branch
  2. Run npm start
  3. Clear site data/cache
  4. Log in as Admin
  5. Go to Dashboard → Tasks tab
  6. Verify deadlineCount is visible for Admin/Owner by default
  7. Go to Permissions Management and remove seeNumberOfTimesTimeAdded from a user

Screenshots or videos of changes:

Note:

Requires the frontend PR #5199 to be checked out for full end-to-end testing.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown
Contributor

@nathanah nathanah left a comment

Choose a reason for hiding this comment

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

Looks good.

Comment on lines +17 to +18
(await hasPermission(requestor, 'seeNumberOfTimesTimeAdded')) ||
(await hasPermission(requestor, 'viewTaskExtensionCount'));
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
(await hasPermission(requestor, 'seeNumberOfTimesTimeAdded')) ||
(await hasPermission(requestor, 'viewTaskExtensionCount'));
(await hasPermission(requestor, 'seeNumberOfTimesTimeAdded'));

Is viewTaskExtensionCount implemented as something else or a different name for what ended up as seeNumberOfTimesTimeAdded? I don't see it used anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants