Skip to content

PM-6438 - update access to read timesheet managers - #60

Merged
vas3a merged 1 commit into
developfrom
PM-6438_get-managers-update-access
Sep 28, 2026
Merged

vas3a merged 1 commit into
developfrom
PM-6438_get-managers-update-access

Conversation

@vas3a

@vas3a vas3a commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

This pull request enhances the authorization logic for retrieving engagement managers by ensuring that only members with an accepted assignment status can access the list. It also updates the associated tests to verify the new access restrictions.

Authorization improvements:

  • Updated the findAll method in EngagementManagersService to require that a member's assignment status is ASSIGNED before allowing access, adding an explicit check on the assignment status.
  • Added AssignmentStatus import from @prisma/client to both the service and its test file to support the new status check. [1] [2]

Test coverage enhancements:

  • Added tests to ensure that access is forbidden if the member has not accepted the assignment or has been rejected, and validated that the correct database query is made for assignment status.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The authorization change is straightforward and covered by tests, with only minor test naming/duplication nits noted.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

This PR tightens read access to the engagement managers list so that only administrators, engagement managers, or members with an accepted/active assignment status (ASSIGNED) can retrieve it, aligning the endpoint with timesheet-approval authority expectations.

Changes:

  • Restricts EngagementManagersService.findAll read access by requiring engagementAssignment.status = ASSIGNED.
  • Updates unit tests to validate the new ASSIGNED status filter and forbidden behavior when the assignment is not accepted.
File Description
src/​engagements/​managers/​engagement-managers.service.ts Adds AssignmentStatus.ASSIGNED constraint to the assignment lookup used for read authorization.
src/​engagements/​managers/​engagement-managers.service.spec.ts Extends tests to assert the new status-filtered query and forbidden access when no accepted assignment is found.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +389 to 403
it("refuses a selected member who has not accepted the assignment", async () => {
db.engagementAssignment.findFirst.mockResolvedValue(null);

await expect(service.findAll("eng1", member)).rejects.toBeInstanceOf(
ForbiddenException,
);
});

it("refuses a rejected member", async () => {
db.engagementAssignment.findFirst.mockResolvedValue(null);

await expect(service.findAll("eng1", member)).rejects.toBeInstanceOf(
ForbiddenException,
);
});
@vas3a
vas3a merged commit b883f9c into develop Sep 28, 2026
4 checks passed
@vas3a
vas3a deleted the PM-6438_get-managers-update-access branch September 28, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants