Skip to content

Commit

Permalink
HPC-9131: Introduce new permissions for update measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
enxtur committed Sep 27, 2023
1 parent 79d1fd4 commit cdb3188
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/auth/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export const AUTH_PERMISSIONS = {
*/
CHANGE_ANY_PLAN_VISIBILITY_IN_PROJECTS:
'canChangeAnyPlanVisiblityInProjects',
/**
* Can edit measurements of any plan in RPM
*/
EDIT_ANY_MEASUREMENTS: 'canEditAnyMeasurements',
},
operation: {
/**
Expand Down Expand Up @@ -175,6 +179,10 @@ export const AUTH_PERMISSIONS = {
* Can make plan visible to projects, in Projects Module
*/
MAKE_VISIBLE_IN_PROJECTS: 'canMakeVisibleInProjects',
/**
* Can edit measurements under this plan
*/
EDIT_MEASUREMENTS: 'canEditMeasurements',
},
project: {
MODIFY_ACCESS_AND_PERMISSIONS: 'canModifyAccessAndPermissions',
Expand Down Expand Up @@ -208,6 +216,10 @@ export const AUTH_PERMISSIONS = {
*/
MODIFY_ACCESS_AND_PERMISSIONS_OF_PROJECTS:
'canModifyAccessAndPermissionsOfProjects',
/**
* Can edit measurements with the governing entity
*/
EDIT_MEASUREMENTS: 'canEditMeasurements',
},
} as const;

Expand Down
3 changes: 3 additions & 0 deletions src/auth/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const calculatePermissionsFromRolesGrant = async <
global.add(P.global.VIEW_ANY_PLAN_DATA);
global.add(P.global.EDIT_ANY_PLAN_DATA);
global.add(P.global.CHANGE_ANY_PLAN_VISIBILITY_IN_PROJECTS);
global.add(P.global.EDIT_ANY_MEASUREMENTS);
} else if (role === 'ftsAdmin') {
// New Permissions
global.add(P.global.VIEW_ANY_FLOW);
Expand Down Expand Up @@ -279,6 +280,7 @@ export const calculatePermissionsFromRolesGrant = async <
planSet.add(P.plan.DELETE_PROJECTS);
planSet.add(P.plan.CLONE_PROJECTS);
planSet.add(P.plan.MAKE_VISIBLE_IN_PROJECTS);
planSet.add(P.plan.EDIT_MEASUREMENTS);
}
}
} else if (grant.type === 'project') {
Expand Down Expand Up @@ -331,6 +333,7 @@ export const calculatePermissionsFromRolesGrant = async <
geSet.add(P.governingEntity.EDIT_PROJECTS);
geSet.add(P.governingEntity.PROJECT_WORKFLOW_MOVE_IF_PLAN_UNLOCKED);
geSet.add(P.governingEntity.MODIFY_ACCESS_AND_PERMISSIONS_OF_PROJECTS);
geSet.add(P.governingEntity.EDIT_MEASUREMENTS);
planSet.add(P.plan.VIEW_DATA);
}
}
Expand Down

0 comments on commit cdb3188

Please sign in to comment.