Skip to content

Commit

Permalink
DTSAM-360 civil wa update admin workTypes (#1979)
Browse files Browse the repository at this point in the history
* DTSAM-360 civil wa update admin workTypes

* DTSAM-360 update civil s-062 FTA

* DTSAM-360 review change (disable rules)

---------

Co-authored-by: Matt Nayler <57350764+mattnayler@users.noreply.github.com>
  • Loading branch information
abul-syed and mattnayler authored Jul 11, 2024
1 parent ec5edb0 commit 7ea23f6
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/functionalTest/resources/features/F-007/F-007.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: F-007 :Create Role Assignments for CIVIL Caseworker and Judicial Users
And a successful call [to delete existing role assignments corresponding to the test actorId] as in [S-061_DeleteDataForRoleAssignments].

@S-062
@FeatureToggle(DB:civil_wa_1_0=on) @FeatureToggle(EV:CASEWORKER_FTA_ENABLED=on)
@FeatureToggle(DB:civil_wa_1_6=on) @FeatureToggle(EV:CASEWORKER_FTA_ENABLED=on)
Scenario: must successfully create org role mapping for Hearing Centre Team Leader and Hearing Centre Administrator
Given a user with [an active IDAM profile with full permissions],
And a successful call [to delete existing role assignments corresponding to the test actorId] as in [S-062_DeleteDataForRoleAssignments],
Expand Down
4 changes: 2 additions & 2 deletions src/functionalTest/resources/features/F-007/S-062.td.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"primaryLocation": "[[ANYTHING_PRESENT]]",
"jurisdiction": "CIVIL",
"region": "2",
"workTypes": "hearing_work"
"workTypes": "hearing_work,routine_work"
}
},
{
Expand All @@ -60,7 +60,7 @@
"primaryLocation": "[[ANYTHING_PRESENT]]",
"jurisdiction": "CIVIL",
"region": "2",
"workTypes": "hearing_work,access_requests"
"workTypes": "hearing_work,access_requests,routine_work"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum FeatureFlagEnum {
PUBLICLAW_WA_1_2("publiclaw_wa_1_2"),
CIVIL_WA_1_4("civil_wa_1_4"),
CIVIL_WA_1_5("civil_wa_1_5"),
CIVIL_WA_1_6("civil_wa_1_6"),
PUBLICLAW_WA_1_3("publiclaw_wa_1_3"),
IAC_JRD_1_1("iac_jrd_1_1");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- DTSAM-360: insert civil_wa_1_6 base flag into flag_config table
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'local', 'civil', 'true');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'pr', 'civil', 'true');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'aat', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'demo', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'perftest', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'ithc', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_1_6', 'prod', 'civil', 'false');
69 changes: 69 additions & 0 deletions src/main/resources/validationrules/civil/civil-admin-mapping.drl
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ end;

/*
* CIVIL admin "hearing-centre-team-leader" Org role mapping.
* Made obsolete in DTSAM-360 - disabled by CIVIL_WA_1_6 flag.
* To be removed in DTSAM-381.
*/

rule "civil_hearing_centre_team_leader_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_1_0.getValue())
$f2: FeatureFlag(status == false && flagName == FeatureFlagEnum.CIVIL_WA_1_6.getValue())
$cap: CaseWorkerAccessProfile(roleId in ("3"), serviceCode in ("AAA6", "AAA7"), !suspended)
then
Map<String,JsonNode> attribute = new HashMap<>();
Expand All @@ -165,11 +168,14 @@ end;

/*
* CIVIL admin "hearing-centre-admin" Org role mapping.
* Made obsolete in DTSAM-360 - disabled by CIVIL_WA_1_6 flag.
* To be removed in DTSAM-381.
*/

rule "civil_hearing_centre_admin_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_1_0.getValue())
$f2: FeatureFlag(status == false && flagName == FeatureFlagEnum.CIVIL_WA_1_6.getValue())
$cap: CaseWorkerAccessProfile(roleId in ("4"), serviceCode in ("AAA6", "AAA7"), !suspended)
then
Map<String,JsonNode> attribute = new HashMap<>();
Expand All @@ -195,11 +201,14 @@ end;

/*
* CIVIL admin "hearing-centre-admin" V11 Org role mapping.
* Made obsolete in DTSAM-360 - disabled by CIVIL_WA_1_6 flag.
* To be removed in DTSAM-381.
*/

rule "v11_civil_hearing_centre_admin_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_1_1.getValue())
$f2: FeatureFlag(status == false && flagName == FeatureFlagEnum.CIVIL_WA_1_6.getValue())
$cap: CaseWorkerAccessProfile(roleId in ("3"), serviceCode in ("AAA6", "AAA7"), !suspended)
then
Map<String,JsonNode> attribute = new HashMap<>();
Expand All @@ -223,6 +232,66 @@ then
logMsg("Rule : v11_civil_hearing_centre_admin_org_role");
end;

/*
* CIVIL admin "hearing-centre-team-leader" Org role mapping. v1.6
*/

rule "v1_6_civil_hearing_centre_team_leader_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_1_6.getValue())
$cap: CaseWorkerAccessProfile(roleId in ("3"), serviceCode in ("AAA6", "AAA7"), !suspended)
then
Map<String,JsonNode> attribute = new HashMap<>();
attribute.put("jurisdiction", JacksonUtils.convertObjectIntoJsonNode("CIVIL"));
attribute.put("primaryLocation", JacksonUtils.convertObjectIntoJsonNode($cap.getPrimaryLocationId()));
attribute.put("workTypes", JacksonUtils.convertObjectIntoJsonNode("hearing_work,access_requests,routine_work"));
attribute.put("region", JacksonUtils.convertObjectIntoJsonNode($cap.getRegionId()));
insert(
RoleAssignment.builder()
.actorIdType(ActorIdType.IDAM)
.actorId($cap.getId())
.roleCategory(RoleCategory.ADMIN)
.roleType(RoleType.ORGANISATION)
.roleName("hearing-centre-team-leader")
.grantType(GrantType.STANDARD)
.classification(Classification.PUBLIC)
.readOnly(false)
.attributes(attribute)
.authorisations($cap.getSkillCodes())
.build());
logMsg("Rule : v1_6_civil_hearing_centre_team_leader_org_role");
end;

/*
* CIVIL admin "hearing-centre-admin" Org role mapping. v1.6
*/

rule "v1_6_civil_hearing_centre_admin_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_1_6.getValue())
$cap: CaseWorkerAccessProfile(roleId in ("3", "4"), serviceCode in ("AAA6", "AAA7"), !suspended)
then
Map<String,JsonNode> attribute = new HashMap<>();
attribute.put("jurisdiction", JacksonUtils.convertObjectIntoJsonNode("CIVIL"));
attribute.put("primaryLocation", JacksonUtils.convertObjectIntoJsonNode($cap.getPrimaryLocationId()));
attribute.put("workTypes", JacksonUtils.convertObjectIntoJsonNode("hearing_work,routine_work"));
attribute.put("region", JacksonUtils.convertObjectIntoJsonNode($cap.getRegionId()));
insert(
RoleAssignment.builder()
.actorIdType(ActorIdType.IDAM)
.actorId($cap.getId())
.roleCategory(RoleCategory.ADMIN)
.roleType(RoleType.ORGANISATION)
.roleName("hearing-centre-admin")
.grantType(GrantType.STANDARD)
.classification(Classification.PUBLIC)
.readOnly(false)
.attributes(attribute)
.authorisations($cap.getSkillCodes())
.build());
logMsg("Rule : v1_6_civil_hearing_centre_admin_org_role");
end;

/*
* CIVIL admin "task-supervisor" Org role mapping.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import uk.gov.hmcts.reform.orgrolemapping.domain.model.CaseWorkerAccessProfile;
import uk.gov.hmcts.reform.orgrolemapping.domain.model.FeatureFlag;
import uk.gov.hmcts.reform.orgrolemapping.domain.model.RoleAssignment;
import uk.gov.hmcts.reform.orgrolemapping.domain.model.enums.ActorIdType;
import uk.gov.hmcts.reform.orgrolemapping.domain.model.enums.GrantType;
Expand All @@ -39,13 +38,13 @@ class DroolCivilStaffOrgRolesTest extends DroolBase {

static Map<String, String> expectedRoleNameWorkTypesMap = new HashMap<>();

{
static {
expectedRoleNameWorkTypesMap.put("hmcts-admin", null);
expectedRoleNameWorkTypesMap.put("hearing-centre-team-leader", "hearing_work,access_requests");
expectedRoleNameWorkTypesMap.put("hearing-centre-team-leader", "hearing_work,access_requests,routine_work");
expectedRoleNameWorkTypesMap.put("hmcts-ctsc", null);
expectedRoleNameWorkTypesMap.put("ctsc", "routine_work");
expectedRoleNameWorkTypesMap.put("ctsc-team-leader", "routine_work,access_requests");
expectedRoleNameWorkTypesMap.put("hearing-centre-admin", "hearing_work");
expectedRoleNameWorkTypesMap.put("hearing-centre-admin", "hearing_work,routine_work");
expectedRoleNameWorkTypesMap.put("senior-tribunal-caseworker", "decision_making_work,access_requests");
expectedRoleNameWorkTypesMap.put("tribunal-caseworker", "decision_making_work");
expectedRoleNameWorkTypesMap.put("hmcts-legal-operations", null);
Expand Down Expand Up @@ -161,11 +160,7 @@ void shouldReturnCivilAdminMappings_v14(String roleId,

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(List.of(FeatureFlag.builder().flagName("civil_wa_1_0").status(true).build(),
FeatureFlag.builder().flagName("civil_wa_1_1").status(true).build(),
FeatureFlag.builder().flagName("civil_wa_1_2").status(true).build(),
FeatureFlag.builder().flagName("civil_wa_1_3").status(true).build(),
FeatureFlag.builder().flagName("civil_wa_1_4").status(true).build()));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("CIVIL", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down

0 comments on commit 7ea23f6

Please sign in to comment.