Skip to content
Closed
Show file tree
Hide file tree
Changes from 106 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
e5e5d82
HPDI-4063 Adding caseManagementCategory as top level field
spnaik77 Mar 31, 2026
90cf6e1
HDPI-4063 Change caseManagementCategory to Dynamic List
toby-plunkett Apr 1, 2026
c7109b9
HDPI-4063 Change caseManagementLocation to CaseLocation type
toby-plunkett Apr 1, 2026
78e1234
Merge branch 'master' into HPDI-4063-caseManagementCategory-b
toby-plunkett Apr 7, 2026
c8ffc49
HDPI-4063 Styling and tests
toby-plunkett Apr 7, 2026
a2ae320
HDPI-4063 Styling and tests
toby-plunkett Apr 7, 2026
1df1fa6
Merge branch 'master' into HPDI-4063-caseManagementCategory-b
toby-plunkett Apr 8, 2026
c69133d
HDPI-4063 Set case location in test to final field
toby-plunkett Apr 8, 2026
3e1939f
Merge remote-tracking branch 'origin/HPDI-4063-caseManagementCategory…
toby-plunkett Apr 8, 2026
773aa20
Merge branch 'master' into debugglobalsearch
adusumillipraveen Apr 10, 2026
01d2cf4
Merge branch 'master' into HPDI-4063-caseManagementCategory-b
toby-plunkett Apr 10, 2026
9823795
HDPI-4161 Create and grant GS roles.
toby-plunkett Apr 10, 2026
76610f7
HDPI-4161 adjust so role assignments to allow for internal and extern…
toby-plunkett Apr 10, 2026
d905605
Merge branch 'master' into debugglobalsearch
adusumillipraveen Apr 13, 2026
30fcc91
try overriding env vars
adusumillipraveen Apr 13, 2026
2479362
Merge branch 'debugglobalsearch' of github.com:hmcts/pcs-api into deb…
adusumillipraveen Apr 13, 2026
c00584d
try
adusumillipraveen Apr 13, 2026
7eacfa9
add tests
adusumillipraveen Apr 13, 2026
db7ef83
fix
adusumillipraveen Apr 13, 2026
196268a
fix
adusumillipraveen Apr 13, 2026
1971be3
revert
adusumillipraveen Apr 13, 2026
25250ca
try
adusumillipraveen Apr 14, 2026
67a3066
Merge branch 'debugglobalsearch' of github.com:hmcts/pcs-api into deb…
adusumillipraveen Apr 14, 2026
df0a43c
try with pcs
adusumillipraveen Apr 14, 2026
4f231af
revert
adusumillipraveen Apr 14, 2026
c3be642
fix try
adusumillipraveen Apr 14, 2026
a958716
fix
adusumillipraveen Apr 14, 2026
aaf0226
Merge branch 'master' into debugglobalsearch
toby-plunkett Apr 20, 2026
10c4367
testing
toby-plunkett Apr 21, 2026
1575542
HDPI-6150 Whitelist pcs-api
toby-plunkett Apr 22, 2026
ba03bb6
HDPI-6150 Whitelist pcs-api
toby-plunkett Apr 22, 2026
eb1f171
HDPI-6150 Whitelist pcs-api typo
toby-plunkett Apr 23, 2026
664ea45
HDPI-6150 Adjust Helm chart to whitelist pcs
toby-plunkett Apr 23, 2026
503ea8e
HDPI-6150 remove autoindex
toby-plunkett Apr 23, 2026
0936ad1
HDPI-6150 update pipeline to make the api call
toby-plunkett Apr 23, 2026
4c0b41d
HDPI-6150 check env vars are set
toby-plunkett Apr 23, 2026
3efafd2
HDPI-6150 check env vars are set
toby-plunkett Apr 23, 2026
7c45241
HDPI-6150 pull in vars from keyvault
toby-plunkett Apr 23, 2026
8c4a32a
HDPI-6150 remove ccd definition store var from local
toby-plunkett Apr 23, 2026
4899673
HDPI-6150 remove whitespace
toby-plunkett Apr 24, 2026
546031e
Merge branch 'master' into HDPI-6150-Call-ElasticSearch-endpoint-via-…
toby-plunkett Apr 24, 2026
58ce009
HDPI-6150 only trigger GS indexing on PR
toby-plunkett Apr 24, 2026
f074b27
HDPI-6150 Move ES Index to before smoke tests to access secrets
toby-plunkett Apr 24, 2026
17fa2fe
HDPI-6150 Move ES Index to it's own script
toby-plunkett Apr 24, 2026
d943827
HDPI-6150 Make script executable
toby-plunkett Apr 24, 2026
6608255
Merge branch 'debugglobalsearch' into HDPI-6150-Call-ElasticSearch-en…
toby-plunkett Apr 24, 2026
ed7adb0
HDPI-6150 Fix merge conflict
toby-plunkett Apr 24, 2026
f27b9fa
HDPI-6150 Reverting SearchCritera change to see if GS still works
toby-plunkett Apr 24, 2026
e8c35b5
HDPI-6150 Reverting Uneeded changes
toby-plunkett Apr 24, 2026
56dd3f7
HDPI-6150 Reverting Uneeded changes
toby-plunkett Apr 24, 2026
48e914a
HDPI-6150 Check if env.CASE_TYPE_SUFFIX is needed
toby-plunkett Apr 24, 2026
ee5f22c
HDPI-6150 Confirm removal is needed
toby-plunkett Apr 27, 2026
96a99cb
Merge branch 'master' into HDPI-6150-Call-ElasticSearch-endpoint-via-…
toby-plunkett Apr 27, 2026
878ead9
Merge remote-tracking branch 'origin/master' into HPDI-4161-Global-Se…
toby-plunkett Apr 27, 2026
f64b2af
HDPI-4161 merge conflicts
toby-plunkett Apr 27, 2026
74aa952
HDPI-4161 Update tests to handle internal and external roles differing
toby-plunkett Apr 28, 2026
ce7a25d
HDPI-4161 Switch to better naming scheme
toby-plunkett Apr 28, 2026
9c40a32
Merge branch 'master' into HPDI-4161-Global-Search-entries-RoleToAcce…
toby-plunkett Apr 28, 2026
d181dea
HDPI-4161 Make adjustment to role config
toby-plunkett Apr 28, 2026
0b4bac0
Merge remote-tracking branch 'origin/HPDI-4161-Global-Search-entries-…
toby-plunkett Apr 28, 2026
b57ae2b
Merge remote-tracking branch 'refs/remotes/origin/master' into HPDI-4…
toby-plunkett Apr 29, 2026
f09c17d
Merge branch 'master' into HPDI-4161-Global-Search-entries-RoleToAcce…
toby-plunkett Apr 29, 2026
2fd8d59
HDPI-4161 Make adjustment to role tests
toby-plunkett Apr 29, 2026
69557c0
HDPI-4161 add gs_profile access profile to config
toby-plunkett Apr 30, 2026
d61d679
Merge branch 'master' into HPDI-4161-Global-Search-entries-RoleToAcce…
toby-plunkett Apr 30, 2026
684169a
Merge branch 'master' into HDPI-6150-Call-ElasticSearch-endpoint-via-…
Ankita-Kumbhare Apr 30, 2026
640630c
HDPI-4161 add gs_profile access profile to config
toby-plunkett Apr 30, 2026
5bc345f
HDPI-4161 revert renaming
toby-plunkett Apr 30, 2026
e75b417
Merge branch 'master' into HPDI-4161-Global-Search-entries-RoleToAcce…
toby-plunkett May 1, 2026
251b9d4
HDPI-4161 add test
toby-plunkett May 1, 2026
461be8f
HDPI-4161 remove unnecessary stubbing
toby-plunkett May 1, 2026
cccb807
HDPI-4172 Add GS_profile to Auth state and case type
toby-plunkett May 5, 2026
b1d1f5f
Merge branch 'master' into HPDI-4172-GS-Auth-Updates
toby-plunkett May 5, 2026
2fc1779
Merge branch 'master' into HPDI-4161-Global-Search-entries-RoleToAcce…
toby-plunkett May 5, 2026
bb21159
Merge branch 'master' into HPDI-4172-GS-Auth-Updates
toby-plunkett May 5, 2026
131046f
Merge remote-tracking branch 'origin/HPDI-4172-GS-Auth-Updates' into …
toby-plunkett May 5, 2026
db6cc09
Merge branch 'HPDI-4161-Global-Search-entries-RoleToAccessprofiles' i…
toby-plunkett May 5, 2026
29d8bed
Merge branch 'HDPI-6150-Call-ElasticSearch-endpoint-via-pipeline' int…
toby-plunkett May 18, 2026
7a7f502
Merge branch 'HPDI-4161-Global-Search-entries-RoleToAccessprofiles' i…
toby-plunkett May 18, 2026
c91e0b3
Merge branch 'HPDI-4172-GS-Auth-Updates' into HDPI-5335-enable-access…
toby-plunkett May 18, 2026
30fc5d8
HDPI-5335: add roles to globalSearch access profile
benouaer May 18, 2026
e3f2689
HDPI-5335: add claimant searchParty fields
benouaer May 18, 2026
f7e74a4
HDPI-5335: fix failing test
benouaer May 18, 2026
1d98450
HDPI-5335: add GS roles to HighLevelDataSetupApp
benouaer May 18, 2026
ab3a795
HDPI-5335: fix failing test
benouaer May 18, 2026
91629e7
Revert "HDPI-5335: fix failing test"
toby-plunkett May 18, 2026
95b1f74
Revert "HDPI-5335: add GS roles to HighLevelDataSetupApp"
toby-plunkett May 18, 2026
8bd2f08
Revert "HDPI-5335: fix failing test"
toby-plunkett May 18, 2026
69108b6
Revert "HDPI-5335: add claimant searchParty fields"
toby-plunkett May 18, 2026
5366bb5
Revert "HDPI-5335: add roles to globalSearch access profile"
toby-plunkett May 18, 2026
e05ac25
HDPI-5335 Testing revert of Role changes
toby-plunkett May 18, 2026
3492145
HDPI-5335 Add tab only shown to GS profile
toby-plunkett May 19, 2026
0979654
HDPI-5335 Add tab only shown to GS profile
toby-plunkett May 19, 2026
291508a
HDPI-5335 update staff supported juridictions
toby-plunkett May 19, 2026
2219262
HDPI-5335:n update jurisdictions
benouaer May 19, 2026
033c8e7
HDPI-5335 Add roles for HLD from sscs to test globalsearch
toby-plunkett May 20, 2026
261ee6a
Merge branch 'HDPI-5335-enable-access-to-globalsearch-without-parties…
toby-plunkett May 20, 2026
ae34499
HDPI-5335 Cleanup code
toby-plunkett May 20, 2026
dbe80b3
Merge branch 'master' into HDPI-5335-enable-access-to-globalsearch-wi…
toby-plunkett May 20, 2026
47e1d25
HDPI-5335 Remove testing code
toby-plunkett May 20, 2026
a9de490
HDPI-5335 Remove testing code
toby-plunkett May 20, 2026
af808a9
HDPI-5335: add support for multi access profiles
benouaer May 19, 2026
d5b98ee
Merge branch 'master' into HDPI-5335-enable-access-to-globalsearch-wi…
toby-plunkett May 21, 2026
cc97154
HDPI-5335 Only GS access for Case Issued state
toby-plunkett May 21, 2026
b4cb47d
Merge branch 'HDPI-5335-enable-access-to-globalsearch-without-parties…
toby-plunkett May 21, 2026
b582d0a
HDPI-5335 Add back GS access for Pending case issued
toby-plunkett May 21, 2026
4e1606e
Merge branch 'master' into HDPI-5335-enable-access-to-globalsearch-wi…
toby-plunkett May 22, 2026
acc998a
HDPI-5335 merge conflict
toby-plunkett May 22, 2026
e017d5e
Merge branch 'master' into HDPI-5335-enable-access-to-globalsearch-wi…
ArunabhaChowdhury May 25, 2026
03735cf
Merge branch 'master' into HDPI-5335-enable-access-to-globalsearch-wi…
ArunabhaChowdhury May 26, 2026
056ef76
Merge branch 'refs/heads/master' into HDPI-5335-enable-access-to-glob…
toby-plunkett May 28, 2026
4374959
Merge remote-tracking branch 'origin/HDPI-5335-enable-access-to-globa…
toby-plunkett May 28, 2026
900bbcf
HDPI-5335 Merge
toby-plunkett May 28, 2026
d21e87f
HDPI-5335 Update Jurisdiction Name
toby-plunkett May 28, 2026
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
7 changes: 6 additions & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ withPipeline(type, product, component) {
setPreviewEnvVars()
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes. Previously reviewed: #1714

if (githubApi.getLabelsbyPattern(env.BRANCH_NAME, "pr-values:ccd").size() > 0) {
env.CCD_ENABLED = "true"
env.CASE_TYPE_SUFFIX="${CHANGE_ID}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason for removing this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global search wasn't working when we had the case number on the end of the case type.

enableHighLevelDataSetup()
} else {
env.CCD_ENABLED = "false"
Expand Down Expand Up @@ -127,6 +126,12 @@ withPipeline(type, product, component) {
generateDefinitions(builder)
}

before('smoketest:preview') {
if (githubApi.getLabelsbyPattern(env.BRANCH_NAME, "pr-values:ccd").size() > 0) {
sh "./bin/trigger-global-search-index.sh"
}
}

before('smoketest:aat') {
env.CASE_TYPE_SUFFIX="staging"
env.CCD_ENABLED = "true"
Expand Down
27 changes: 27 additions & 0 deletions bin/trigger-global-search-index.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally reviewed under: #1714
No changes have me made

set -ex

S2S_TOKEN=$(curl -s -X POST "${IDAM_S2S_AUTH_URL}/testing-support/lease" \
-H 'Content-Type: application/json' \
-d '{"microservice": "pcs_api"}')

IDAM_TOKEN=$(curl -s -X POST "${IDAM_API_URL}/o/token" \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode "username=${IDAM_SYSTEM_USERNAME}" \
--data-urlencode "password=${IDAM_SYSTEM_USER_PASSWORD}" \
--data-urlencode 'client_id=pcs-api' \
--data-urlencode "client_secret=${PCS_API_IDAM_SECRET}" \
--data-urlencode 'scope=openid profile roles' \
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")

STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${DEFINITION_STORE_URL_BASE}/elastic-support/global-search/index" \
-H "Authorization: Bearer ${IDAM_TOKEN}" \
-H "ServiceAuthorization: Bearer ${S2S_TOKEN}")

if [ "$STATUS" != "201" ]; then
echo "ERROR: Global search index returned status ${STATUS}"
exit 1
fi

echo "Global search index created successfully"
11 changes: 6 additions & 5 deletions charts/pcs-api/values.ccd.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ global:

java:
Copy link
Copy Markdown
Collaborator Author

@toby-plunkett toby-plunkett May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 199-->202 contain the only changes that haven't been reviewed. The rest reviewed under #1714

environment:
CASE_TYPE_SUFFIX: ${CHANGE_ID}
PCS_DB_NAME: "{{ .Values.global.databaseNamePrefix }}pcs"
PCS_DB_HOST: '{{ tpl .Values.global.postgresHostname $}}'
PCS_DB_USER_NAME: "{{ .Values.global.postgresUsername}}"
Expand Down Expand Up @@ -43,7 +42,6 @@ postgresql:
- name: "pr-${CHANGE_ID}-data-store"
- name: "pr-${CHANGE_ID}-definition-store"
- name: "pr-${CHANGE_ID}-pcs"

ccd:
enabled: true
ccd:
Expand Down Expand Up @@ -81,6 +79,7 @@ ccd:
DEFINITION_STORE_DB_OPTIONS: ""
ELASTIC_SEARCH_INDEX_SHARDS: 1
ELASTIC_SEARCH_INDEX_SHARDS_REPLICAS: 0
DEFINITION_STORE_S2S_AUTHORISED_SERVICES: "ccd_data,ccd_gw,ccd_admin,jui_webapp,pui_webapp,aac_manage_case_assignment,xui_webapp,am_org_role_mapping_service,pcs_api"
ingressHost: ccd-definition-store-${SERVICE_FQDN}
keyVaults:
ccd:
Expand Down Expand Up @@ -167,7 +166,7 @@ ccd:
- name: cluster.initial_master_nodes
value: ""
- name: action.auto_create_index
value: .security*,.watches,.triggered_watches,.watcher-history-*,.logstash_dead_letter,.ml*,global_search
value: .security*,.watches,.triggered_watches,.watcher-history-*,.logstash_dead_letter,.ml*
persistence:
enabled: false
ingress:
Expand Down Expand Up @@ -197,8 +196,10 @@ xui-webapp:
SERVICES_CCD_DATA_STORE_API: http://${SERVICE_NAME}-ccd-data-store-api
SERVICES_TERMS_AND_CONDITIONS: http://xui-terms-and-conditions-aat.service.core-compute-aat.internal
SERVICES_HEARINGS_COMPONENT_API: http://jurisdiction-hearings-api-aat.service.core-compute-aat.internal
JURISDICTIONS: PCS,CIVIL
STAFF_SUPPORTED_JURISDICTIONS: PCS
JURISDICTIONS: PCS
GLOBAL_SEARCH_SERVICES: PCS,CIVIL,SSCS
WA_SUPPORTED_JURISDICTIONS: PCS,CIVIL,SSCS
STAFF_SUPPORTED_JURISDICTIONS: PCS,CIVIL,SSCS
FEATURE_REDIS_ENABLED: false
REDISCLOUD_URL: http://dummyrediscloudurl
FEATURE_APP_INSIGHTS_ENABLED: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private void createAccessProfiles(CFTLib lib) {

roleNames.add("caseworker");
roleNames.add("caseworker-ras-validation");
roleNames.add("GS_profile");
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved here: #1743


lib.createRoles(roleNames.toArray(new String[0]));
}
Expand Down
32 changes: 32 additions & 0 deletions src/cftlib/resources/cftlib-am-role-assignments.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,37 @@
"authorisations": []
}
]
},
{
"email": "pcs-solicitor1@test.com",
"id": "f6484bbb-c10e-319b-ab8d-14361a7d2a23",
"roleAssignments": [
{
"roleType": "ORGANISATION",
"roleName": "hmcts-admin",
"grantType": "STANDARD",
"roleCategory": "ADMIN",
"classification": "PUBLIC",
"readOnly": false,
"attributes": {},
"authorisations": []
}
]
},
{
"email": "pcs-solicitor1@test.com",
"id": "f6484bbb-c10e-319b-ab8d-14361a7d2a23",
"roleAssignments": [
{
"roleType": "ORGANISATION",
"roleName": "[HMCTS-ADMIN]",
"grantType": "STANDARD",
"roleCategory": "ADMIN",
"classification": "PUBLIC",
"readOnly": false,
"attributes": {},
"authorisations": []
}
]
}
]
14 changes: 7 additions & 7 deletions src/main/java/uk/gov/hmcts/reform/pcs/ccd/CaseType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.stereotype.Component;
import uk.gov.hmcts.ccd.sdk.api.CCDConfig;
import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder;
import uk.gov.hmcts.reform.pcs.ccd.accesscontrol.UserRole;
import uk.gov.hmcts.reform.pcs.ccd.accesscontrol.AccessProfile;
import uk.gov.hmcts.reform.pcs.ccd.domain.CaseFileCategory;
import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase;
import uk.gov.hmcts.reform.pcs.ccd.domain.State;
Expand All @@ -18,7 +18,7 @@
* Setup some common possessions case type configuration.
*/
@Component
public class CaseType implements CCDConfig<PCSCase, State, UserRole> {
public class CaseType implements CCDConfig<PCSCase, State, AccessProfile> {

private static final String CASE_TYPE_ID = "PCS";
private static final String CASE_TYPE_NAME = "Possession";
Expand Down Expand Up @@ -49,7 +49,7 @@ private static String withSuffix(String base, String separator) {
}

@Override
public void configure(final ConfigBuilder<PCSCase, State, UserRole> builder) {
public void configure(final ConfigBuilder<PCSCase, State, AccessProfile> builder) {
builder.setCallbackHost(getenv().getOrDefault("CASE_API_URL", "http://localhost:3206"));

builder.caseType(getCaseType(), getCaseTypeName(), CASE_TYPE_DESCRIPTION);
Expand Down Expand Up @@ -97,7 +97,7 @@ public void configure(final ConfigBuilder<PCSCase, State, UserRole> builder) {
.field(PCSCase::getCaseFileView, null, "#ARGUMENT(CaseFileView)");

builder.tab("caseLinks", "Linked Cases")
.forRoles(UserRole.PCS_SOLICITOR)
.forRoles(AccessProfile.PCS_SOLICITOR)
.field(PCSCase::getLinkedCasesComponentLauncher, null, "#ARGUMENT(LinkedCases)")
.field(PCSCase::getCaseLinks, "LinkedCasesComponentLauncher!=\"\"", "#ARGUMENT(LinkedCases)");

Expand All @@ -106,17 +106,17 @@ public void configure(final ConfigBuilder<PCSCase, State, UserRole> builder) {
configureCaseFileCategories(builder);
}

private void configureCaseFileCategories(ConfigBuilder<PCSCase, State, UserRole> builder) {
private void configureCaseFileCategories(ConfigBuilder<PCSCase, State, AccessProfile> builder) {
for (CaseFileCategory category : CaseFileCategory.values()) {
builder.categories(UserRole.PCS_SOLICITOR)
builder.categories(AccessProfile.PCS_SOLICITOR)
.categoryID(category.getId())
.categoryLabel(category.getLabel())
.displayOrder(category.getDisplayOrder())
.build();
}
}

private void buildCasePartiesTab(ConfigBuilder<PCSCase, State, UserRole> builder) {
private void buildCasePartiesTab(ConfigBuilder<PCSCase, State, AccessProfile> builder) {
builder.tab("caseParties", "Case Parties")
.label("Case Parties", null, "#### Case Parties")
.field("casePartiesTab_ClaimantDetails")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package uk.gov.hmcts.reform.pcs.ccd.accesscontrol;

import static java.util.Arrays.stream;
import static uk.gov.hmcts.ccd.sdk.api.Permission.CRU;
import static uk.gov.hmcts.ccd.sdk.api.Permission.R;

import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Set;
import lombok.Getter;
import uk.gov.hmcts.ccd.sdk.api.HasRole;
import uk.gov.hmcts.ccd.sdk.api.Permission;

@Getter
public enum AccessProfile implements HasRole {

CREATOR("[CREATOR]", CRU),
RAS_VALIDATOR("caseworker-ras-validation", Set.of(R)),
CITIZEN("citizen", CRU),
DEFENDANT("[DEFENDANT]", CRU),
CLAIMANT_SOLICITOR("[CLAIMANTSOLICITOR]", CRU),
DEFENDANT_SOLICITOR("[DEFENDANTSOLICITOR]", CRU),
PCS_CASE_WORKER("caseworker-pcs", Set.of(R)),
PCS_SOLICITOR("caseworker-pcs-solicitor", CRU),

GS_PROFILE("GS_profile", Set.of(R));

@JsonValue
private final String role;
private final Set<Permission> caseTypePermissions;

AccessProfile(String role, Set<Permission> permissions) {
this.role = role;
this.caseTypePermissions = permissions;
}

public static String[] toRoles(AccessProfile... profiles) {
return stream(profiles)
.map(AccessProfile::getRole)
.toArray(String[]::new);
}

public String getCaseTypePermissions() {
return Permission.toString(caseTypePermissions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public static ExternalUserRole forCcdRole(UserRole ccdRole) {

@Override
public String getRole() {
String rolePrefix = (ccdUserRole.getRoleType() == RoleType.IDAM) ? "idam:" : "";
return rolePrefix + ccdUserRole.getRole();
return ccdUserRole.getRoleType().prefix() + ccdUserRole.getRole();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package uk.gov.hmcts.reform.pcs.ccd.accesscontrol;

import static uk.gov.hmcts.reform.pcs.ccd.accesscontrol.UserRole.PCS_CASE_WORKER;
import static uk.gov.hmcts.reform.pcs.ccd.accesscontrol.UserRole.PCS_SOLICITOR;
import static uk.gov.hmcts.reform.pcs.ccd.accesscontrol.AccessProfile.GS_PROFILE;

import uk.gov.hmcts.ccd.sdk.api.HasAccessControl;
import uk.gov.hmcts.ccd.sdk.api.HasRole;
Expand All @@ -11,17 +10,11 @@
import com.google.common.collect.SetMultimap;

public class GlobalSearchAccess implements HasAccessControl {

@Override
public SetMultimap<HasRole, Permission> getGrants() {
SetMultimap<HasRole, Permission> grants = HashMultimap.create();
grants.putAll(PCS_CASE_WORKER, Permission.CRUD);

/***
* Remove before release
*/

grants.putAll(PCS_SOLICITOR, Permission.CRUD);

grants.put(GS_PROFILE, Permission.R);
return grants;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void configure(ConfigBuilder<PCSCase, State, ExternalUserRole> configBuil
.forEach(userRole ->
configBuilder
.caseRoleToAccessProfile(ExternalUserRole.forCcdRole(userRole))
.accessProfiles(userRole.getRole())
.accessProfiles(userRole.getAccessProfiles())
.build()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

enum RoleType {

IDAM,
RAS
IDAM("idam:"),
RAS("");

private final String prefix;

RoleType(String prefix) {
this.prefix = prefix;
}

public String prefix() {
return prefix;
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,60 @@
package uk.gov.hmcts.reform.pcs.ccd.accesscontrol;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import uk.gov.hmcts.ccd.sdk.api.HasRole;
import uk.gov.hmcts.ccd.sdk.api.Permission;

import java.util.Set;

import static uk.gov.hmcts.ccd.sdk.api.Permission.CRU;
import static uk.gov.hmcts.ccd.sdk.api.Permission.R;
import static uk.gov.hmcts.reform.pcs.ccd.accesscontrol.AccessProfile.GS_PROFILE;
import static uk.gov.hmcts.reform.pcs.ccd.accesscontrol.RoleType.IDAM;
import static uk.gov.hmcts.reform.pcs.ccd.accesscontrol.RoleType.RAS;

/**
* All the different roles for a PCS case.
*/
@AllArgsConstructor
@Getter
public enum UserRole implements HasRole {

CITIZEN("citizen", Permission.CRU, IDAM),
CREATOR("[CREATOR]", Permission.CRU, RAS),
DEFENDANT("[DEFENDANT]", Permission.CRU, RAS),
CLAIMANT_SOLICITOR("[CLAIMANTSOLICITOR]", Permission.CRU, RAS),
PCS_CASE_WORKER("caseworker-pcs", Set.of(R), IDAM),
PCS_SOLICITOR("caseworker-pcs-solicitor", Permission.CRU, IDAM),
CREATOR("[CREATOR]", CRU, RAS),
RAS_VALIDATOR("caseworker-ras-validation", Set.of(R), IDAM),
DEFENDANT_SOLICITOR("[DEFENDANTSOLICITOR]", Permission.CRU, RAS);

CITIZEN("citizen", CRU, IDAM),
DEFENDANT("[DEFENDANT]", CRU, RAS),
CLAIMANT_SOLICITOR("[CLAIMANTSOLICITOR]", CRU, RAS),
DEFENDANT_SOLICITOR("[DEFENDANTSOLICITOR]", CRU, RAS),

PCS_CASE_WORKER("caseworker-pcs", Set.of(R), IDAM),
PCS_SOLICITOR("caseworker-pcs-solicitor", CRU, IDAM),

HMCTS_ADMIN("hmcts-admin", Set.of(R), RAS, GS_PROFILE),
HMCTS_JUDICIARY("hmcts-judiciary", Set.of(R), RAS, GS_PROFILE),
HMCTS_CTSC("hmcts-ctsc", Set.of(R), RAS, GS_PROFILE),
HMCTS_LEGAL_OPERATIONS("hmcts-legal-operations", Set.of(R), RAS, GS_PROFILE);

@JsonValue
private final String role;
private final Set<Permission> caseTypePermissions;
private final RoleType roleType;
private final String[] accessProfiles;

UserRole(String role, Set<Permission> permissions, RoleType roleType) {
this(role, permissions, roleType, role);
}

UserRole(String role, Set<Permission> permissions, RoleType roleType, AccessProfile... accessProfiles) {
this(role, permissions, roleType, AccessProfile.toRoles(accessProfiles));
}

UserRole(String role, Set<Permission> permissions, RoleType roleType, String... accessProfiles) {
this.role = role;
this.caseTypePermissions = permissions;
this.roleType = roleType;
this.accessProfiles = accessProfiles;
}

public String getCaseTypePermissions() {
return Permission.toString(caseTypePermissions);
Expand Down
Loading
Loading