PM-6451 TM/PM role update - #58
Merged
Merged
Conversation
Signed-off-by: Vasilica Olariu <olariu.vasilica@gmail.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The engagement list response role regresses for managers and TM date-range filtering can drop the submitted-only constraint, risking incorrect authorization behavior.
Review effort: Lite
Findings: 3
Open (4)
What changed in this PR
This PR refines role-based authorization in the timesheets and engagement-manager flows by introducing a distinct Talent Manager (TM) role with read-only timesheet access and the ability to assign/remove engagement managers, while ensuring Project Managers no longer receive elevated timesheet privileges.
Changes:
- Add TM as a dedicated timesheet viewer role and enforce TM read-only behavior across timesheet actions.
- Adjust role resolution/authorization so PMs are treated as unrelated (404) and TMs can manage engagement managers.
- Update unit/e2e tests, DTOs, and API docs/error messages to reflect the new role behavior.
| File | Description |
|---|---|
| src/timesheets/timesheets.service.ts | Enforces TM read-only behavior; adjusts engagement list access and filtering logic. |
| src/timesheets/timesheets.service.spec.ts | Updates unit tests for TM read-only behavior and PM denial. |
| src/timesheets/timesheet-roles.ts | Adds the TM viewer role constant. |
| src/timesheets/timesheet-engagements.controller.ts | Updates endpoint documentation to include TM engagement list semantics. |
| src/timesheets/timesheet-authorization.e2e.spec.ts | Expands e2e coverage for TM access and PM being unrelated. |
| src/timesheets/timesheet-access.service.ts | Adds TM detection, separates “timesheet admin” vs TM, and adds canManageEngagementManagers. |
| src/timesheets/timesheet-access.service.spec.ts | Updates role-resolution unit tests for TM/PM behavior. |
| src/timesheets/dto/timesheet-engagement-list.dto.ts | Adjusts DTO typing/examples for viewer role changes. |
| src/integrations/member.service.ts | Fixes query parameter formatting for member lookups by user IDs. |
| src/engagements/managers/engagement-managers.service.ts | Switches authorization from “admin only” to “admin or TM”. |
| src/engagements/managers/engagement-managers.service.spec.ts | Adds test coverage for TM allowed and PM refused manager changes. |
| src/engagements/managers/engagement-managers.controller.ts | Updates docs/guards usage to align with TM ability to manage managers. |
| src/common/constants.ts | Adds TM read-only error message. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This pull request refines timesheet and engagement manager authorization, introducing a distinct Talent Manager (TM) platform role with read-only timesheet access and the ability to assign or remove engagement managers. It ensures Project Managers no longer have elevated timesheet privileges, clarifies role-based behaviors, and updates error messages and tests to reflect these changes.
Authorization and Role Handling
TimesheetViewerRole.Tm), and updated logic so TMs can assign and remove engagement managers, while Project Managers can no longer do so (canManageEngagementManagers,isTimesheetTm, and related logic intimesheet-access.service.ts). [1] [2] [3]ADMINISTRATOR, engagement managers areMANAGER, TMs areTM(read-only), and Project Managers are treated as unrelated (404). [1] [2] [3]API and Error Message Updates
Testing Enhancements
DTO and API Response Adjustments
viewerRolecan beTMorundefined, and changed example values to reflect the new TM role. [1] [2]Bugfixes and Minor Improvements
MemberServicefor fetching user details.