Skip to content

Commit 55777cd

Browse files
committed
Limit PMs to allow consultant endorsement only for momentum projects
1 parent f96015f commit 55777cd

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/components/authorization/policies/by-role/project-manager.policy.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export const projectTransitions = () =>
2727
'Prep for Consultant Endorsement -> Pending Consultant Endorsement',
2828
'Prep for Consultant & Financial Endorsement & Finalizing Proposal -> Pending Concept Approval',
2929
'Prep for Consultant & Financial Endorsement & Finalizing Proposal -> Did Not Develop',
30-
'Pending Consultant Endorsement -> Prep for Financial Endorsement With Consultant Endorsement',
31-
'Pending Consultant Endorsement -> Prep for Financial Endorsement Without Consultant Endorsement',
3230
'Prep for Financial Endorsement -> Pending Financial Endorsement',
3331
'Prep for Financial Endorsement & Finalizing Proposal -> Pending Consultant Endorsement',
3432
'Finalizing Proposal -> Pending Regional Director Approval',
@@ -53,6 +51,12 @@ export const projectTransitions = () =>
5351
'Finalizing Completion -> Completed',
5452
]);
5553

54+
export const momentumProjectsTransitions = () =>
55+
ProjectWorkflow.pickNames([
56+
'Pending Consultant Endorsement -> Prep for Financial Endorsement With Consultant Endorsement',
57+
'Pending Consultant Endorsement -> Prep for Financial Endorsement Without Consultant Endorsement',
58+
]);
59+
5660
// NOTE: There could be other permissions for this role from other policies
5761
@Policy(
5862
[Role.ProjectManager, Role.RegionalDirector, Role.FieldOperationsDirector],
@@ -132,6 +136,12 @@ export const projectTransitions = () =>
132136
member,
133137
r.ProjectWorkflowEvent.isTransitions(projectTransitions),
134138
).execute,
139+
// PMs can also endorse for consultant for momentum projects
140+
r.ProjectWorkflowEvent.whenAll(
141+
field('project.type', 'MomentumTranslation'),
142+
member,
143+
r.ProjectWorkflowEvent.isTransitions(momentumProjectsTransitions),
144+
).execute,
135145
r.Project.read.create
136146
.when(member)
137147
.edit.specifically((p) => [

src/components/authorization/policies/by-role/regional-director.policy.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import * as PM from './project-manager.policy';
99
r.Project.when(member).edit.specifically(
1010
(p) => p.rootDirectory.edit.when(sensMediumOrLower).read,
1111
),
12-
r.ProjectWorkflowEvent.transitions(PM.projectTransitions).execute,
12+
r.ProjectWorkflowEvent.transitions(
13+
PM.projectTransitions,
14+
PM.momentumProjectsTransitions,
15+
).execute,
1316
r.ProjectWorkflowEvent.read.transitions(
1417
'Early Conversations -> Pending Finance Confirmation',
1518
'Pending Concept Approval -> Prep for Consultant Endorsement',

0 commit comments

Comments
 (0)