Skip to content

Commit

Permalink
ADD: new azure group for PVO
Browse files Browse the repository at this point in the history
Co-authored-by: andregroseth <[email protected]>
  • Loading branch information
JeremiahUy and andregroseth committed Feb 14, 2025
1 parent dc7d010 commit 83da783
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/backend/nais/backend-dev-gcp-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ env:
value: bf05a29f-6f80-4da1-b419-22c802fd41e7
- name: AZURE_CLIENT_GROUPS_KRAVEIER
value: d99d875c-c028-46a4-94bc-a87a633b3eee
- name: AZURE_CLIENT_GROUPS_PVO
value: 1e0cb856-a8ba-4294-aab3-8162e3ebe1ea
- name: CLIENT_BEGREPSKATALOG_FRONTEND_URL
value: https://begrepskatalog.intern.nav.no/begrep
2 changes: 2 additions & 0 deletions apps/backend/nais/backend-prod-gcp-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ env:
value: bf05a29f-6f80-4da1-b419-22c802fd41e7
- name: AZURE_CLIENT_GROUPS_KRAVEIER
value: d99d875c-c028-46a4-94bc-a87a633b3eee
- name: AZURE_CLIENT_GROUPS_PVO
value: 1e0cb856-a8ba-4294-aab3-8162e3ebe1ea
- name: CLIENT_BEGREPSKATALOG_FRONTEND_URL
value: https://begrepskatalog.intern.nav.no/begrep
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ private AppRole roleFor(String group) {
if (securityProperties.getKraveierGroups().contains(group)) {
return AppRole.KRAVEIER;
}
if (securityProperties.getPvoGroups().contains(group)) {
return AppRole.PERSONVERNOMBUD;
}
// for future - add team -> system roles here
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class SecurityProperties {
private List<String> writeGroups;
private List<String> adminGroups;
private List<String> kraveierGroups;
private List<String> pvoGroups;
private List<String> redirectUris;
private String env;
private List<String> devEmailAllowList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public static boolean isKravEier() {
return getCurrentUser().map(UserInfo::isKravEier).orElse(false);
}

public static boolean isPersonvernombud() {
return getCurrentUser().map(UserInfo::isPersonvernombud).orElse(false);
}

public static boolean isUserOrAdmin(String ident) {
return getCurrentIdent().equals(ident) || isAdmin();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public boolean isKravEier() {
return groups.contains(AppRole.KRAVEIER.name()) || isAdmin();
}

@Override
public boolean isPersonvernombud() {
return groups.contains(AppRole.PERSONVERNOMBUD.name()) || isAdmin();
}

public UserInfoResponse toResponse() {
return UserInfoResponse.builder()
.loggedIn(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public enum AppRole {
READ,
WRITE,
ADMIN,
KRAVEIER;
KRAVEIER,
PERSONVERNOMBUD;

public static final String ROLE_PREFIX = "ROLE_";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ public interface UserInfo {

boolean isKravEier();

boolean isPersonvernombud();

UserInfoResponse toResponse();
}
1 change: 1 addition & 0 deletions apps/backend/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ AZURE_APP_CLIENT_SECRET: secret
AZURE_CLIENT_GROUPS_ADMIN: bf05a29f-6f80-4da1-b419-22c802fd41e7
AZURE_CLIENT_GROUPS: 2ee0ef50-718c-43d3-8c05-c839f2dc2490
AZURE_CLIENT_GROUPS_KRAVEIER: d99d875c-c028-46a4-94bc-a87a633b3eee
AZURE_CLIENT_GROUPS_PVO: 1e0cb856-a8ba-4294-aab3-8162e3ebe1ea
1 change: 1 addition & 0 deletions apps/backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ etterlev:
enc-key: ${AZURE_TOKEN_ENC_KEY:tokenkey}
env: ${NAIS_CLUSTER_NAME:local}
kraveier-groups: ${AZURE_CLIENT_GROUPS_KRAVEIER:teamdatajegerne}
pvo-groups: ${AZURE_CLIENT_GROUPS_PVO:teamdatajegerne}
redirectUris: http://localhost:3000
write-groups: ${AZURE_CLIENT_GROUPS:teamdatajegerne}

Expand Down

0 comments on commit 83da783

Please sign in to comment.