diff --git a/src/auth/permissions.ts b/src/auth/permissions.ts index e6b06220..915f0ba4 100644 --- a/src/auth/permissions.ts +++ b/src/auth/permissions.ts @@ -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: { /** @@ -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', @@ -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; diff --git a/src/auth/roles.ts b/src/auth/roles.ts index 95661ced..38ec0e25 100644 --- a/src/auth/roles.ts +++ b/src/auth/roles.ts @@ -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); @@ -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') { @@ -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); } }