Skip to content

Commit

Permalink
Merge pull request #184 from UN-OCHA/HPC-9793
Browse files Browse the repository at this point in the history
HPC-9793: Add global `DELETE_UPLOADED_FILE` permission
  • Loading branch information
enxtur authored Dec 2, 2024
2 parents e50fceb + 5bee5fd commit bda3a6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unocha/hpc-api-core",
"version": "10.5.0",
"version": "10.6.0",
"description": "Core libraries supporting HPC.Tools API Backend",
"license": "Apache-2.0",
"private": false,
Expand Down
1 change: 1 addition & 0 deletions src/auth/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const AUTH_PERMISSIONS = {
* Can add comments to any project
*/
ADD_COMMENT_TO_ANY_PROJECT: 'canAddCommentToAnyProject',
DELETE_UPLOADED_FILE: 'canDeleteUploadedFile',
},
operation: {
/**
Expand Down
3 changes: 3 additions & 0 deletions src/auth/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,19 @@ export const calculatePermissionsFromRolesGrant = async <
global.add(P.global.EDIT_ANY_MEASUREMENT);
global.add(P.global.CHANGE_ANY_PLAN_VISIBILITY_IN_PROJECTS);
global.add(P.global.DELETE_ANY_PLAN);
global.add(P.global.DELETE_UPLOADED_FILE);
} else if (role === 'ftsAdmin') {
// New Permissions
global.add(P.global.VIEW_ANY_FLOW);
global.add(P.global.EDIT_ANY_FLOW);
global.add(P.global.EDIT_CATEGORIES);
global.add(P.global.VIEW_CATEGORIES);
global.add(P.global.DELETE_UPLOADED_FILE);
} else if (role === 'projectsAdmin') {
// New Permissions
global.add(P.global.PROJECT_WORKFLOW_MOVE_TO_ANY_STEP);
global.add(P.global.ADD_COMMENT_TO_ANY_PROJECT);
global.add(P.global.DELETE_UPLOADED_FILE);
} else if (role === 'swaps') {
global.add(P.global.MODIFY_OPERATION_ACCESS_AND_PERMISSIONS);
global.add(P.global.ADD_OPERATION);
Expand Down

0 comments on commit bda3a6d

Please sign in to comment.