Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPC-9131: Introduce new permissions for update measurements #129

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
*/
EDIT_ANY_MEASUREMENT: 'canEditAnyMeasurement',
},
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 @@ -177,6 +177,7 @@ export const calculatePermissionsFromRolesGrant = async <
// New Permissions
global.add(P.global.VIEW_ANY_PLAN_DATA);
global.add(P.global.EDIT_ANY_PLAN_DATA);
global.add(P.global.EDIT_ANY_MEASUREMENT);
global.add(P.global.CHANGE_ANY_PLAN_VISIBILITY_IN_PROJECTS);
} else if (role === 'ftsAdmin') {
// New Permissions
Expand Down Expand Up @@ -274,6 +275,7 @@ export const calculatePermissionsFromRolesGrant = async <
planSet.add(P.plan.PROJECT_WORKFLOW_MOVE_TO_ANY_STEP);
planSet.add(P.plan.VIEW_DATA);
planSet.add(P.plan.EDIT_DATA);
planSet.add(P.plan.EDIT_MEASUREMENTS);
planSet.add(P.plan.MODIFY_ACCESS_AND_PERMISSIONS_OF_PROJECTS);
planSet.add(P.plan.EDIT_PROJECTS);
planSet.add(P.plan.DELETE_PROJECTS);
Expand Down Expand Up @@ -329,6 +331,7 @@ export const calculatePermissionsFromRolesGrant = async <
if (role === 'clusterLead') {
geSet.add(P.governingEntity.EDIT_DATA);
geSet.add(P.governingEntity.EDIT_PROJECTS);
geSet.add(P.governingEntity.EDIT_MEASUREMENTS);
geSet.add(P.governingEntity.PROJECT_WORKFLOW_MOVE_IF_PLAN_UNLOCKED);
geSet.add(P.governingEntity.MODIFY_ACCESS_AND_PERMISSIONS_OF_PROJECTS);
planSet.add(P.plan.VIEW_DATA);
Expand Down