diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/security/SecurityUtil.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/security/SecurityUtil.java index 3d9fbf85..f99074c4 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/security/SecurityUtil.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/security/SecurityUtil.java @@ -77,8 +77,14 @@ private static List loadRoles(Jwt jwt) { public static List loadPermissions(Jwt jwt, Map> rolePermissions) { List roles = loadRoles(jwt); List permissions = new ArrayList<>(); - roles.forEach(role -> { - permissions.addAll(rolePermissions.get(role)); + roles.forEach(role -> { + List currentPermissions = rolePermissions.get(role); + if (currentPermissions != null) { + permissions.addAll(currentPermissions); + } else { + logger.warn("Role {} has no permissions defined.", role); + } + }); return permissions; diff --git a/backend/src/main/resources/application.yaml b/backend/src/main/resources/application.yaml index c5a8a829..b10b058a 100644 --- a/backend/src/main/resources/application.yaml +++ b/backend/src/main/resources/application.yaml @@ -26,11 +26,15 @@ v2: # Mapping of roles (SPGs) to specific permissions security: rolePermissions: + DUMMY: + - Dummy E45: - E45 - Eligibility: + ELIGIBILITY: - E45 - R15 - R41 - Dummy: - - Dummy \ No newline at end of file + TRAININGHEALTHAUTH: + - E45 + - R15 + - R41 \ No newline at end of file diff --git a/frontend/src/App.vue b/frontend/src/App.vue index a580e1b3..22047f78 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -26,7 +26,7 @@ name: 'App', data: function () { return { - dev: import.meta.env.MODE === 'DEV', + dev: import.meta.env.MODE === 'development', } }, computed: {