Skip to content

Commit

Permalink
feat(FSADT1-1525): Add FAM role CLIENT_SUSPEND (#1247)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia authored Oct 17, 2024
1 parent b1d6570 commit 7aa77de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ left join nrfc.province_code pc on (pc.province_code = sl.province_code and pc.c
public static final String ROLE_VIEWER = "CLIENT_VIEWER";
public static final String ROLE_EDITOR = "CLIENT_EDITOR";
public static final String ROLE_ADMIN = "CLIENT_ADMIN";
public static final String ROLE_SUSPEND = "CLIENT_SUSPEND";

public static final String OPENDATA_FILTER = "<Filter><Or><PropertyIsLike wildCard=\"*\" singleChar=\".\" escape=\"!\"><PropertyName>%s</PropertyName><Literal>*%s*</Literal></PropertyIsLike><PropertyIsLike wildCard=\"*\" singleChar=\".\" escape=\"!\"><PropertyName>%s</PropertyName><Literal>*%s*</Literal></PropertyIsLike><PropertyIsLike wildCard=\"*\" singleChar=\".\" escape=\"!\"><PropertyName>%s</PropertyName><Literal>*%s*</Literal></PropertyIsLike><PropertyIsLike wildCard=\"*\" singleChar=\".\" escape=\"!\"><PropertyName>%s</PropertyName><Literal>*%s*</Literal></PropertyIsLike></Or></Filter>";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ public void customize(AuthorizeExchangeSpec authorize) {
ApplicationConstant.ROLE_VIEWER,
ApplicationConstant.ROLE_EDITOR,
ApplicationConstant.ROLE_ADMIN);

// Viewer, editor, suspend and admin users can GET from the clients endpoint
authorize
.pathMatchers(HttpMethod.GET, "/api/clients/search/**")
.hasAnyRole(
ApplicationConstant.ROLE_VIEWER,
ApplicationConstant.ROLE_EDITOR,
ApplicationConstant.ROLE_ADMIN,
ApplicationConstant.ROLE_SUSPEND);

// Deny all other requests
authorize.anyExchange().denyAll();
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Cypress.Commands.add(

const userId = generateRandomHex(32);

const roles = provider === "idir" ? ["CLIENT_VIEWER", "CLIENT_EDITOR", "CLIENT_ADMIN"] : ["USER"];
const roles = provider === "idir" ? ["CLIENT_VIEWER", "CLIENT_EDITOR", "CLIENT_ADMIN", "CLIENT_SUSPEND"] : ["USER"];

const jwtBody = {
"custom:idp_display_name": name,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/SearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
const summitSvg = useSvg(summit);
const userhasAuthority = ["CLIENT_VIEWER", "CLIENT_EDITOR", "CLIENT_ADMIN"].some(authority => ForestClientUserSession.authorities.includes(authority));
const userhasAuthority = ["CLIENT_VIEWER", "CLIENT_EDITOR", "CLIENT_ADMIN", "CLIENT_SUSPEND"].some(authority => ForestClientUserSession.authorities.includes(authority));
let networkErrorMsg = ref("");
Expand Down

0 comments on commit 7aa77de

Please sign in to comment.