Skip to content

Commit

Permalink
COT-906 Amended work types for CIVIL hearing centre admin and hearing…
Browse files Browse the repository at this point in the history
… centre … (#2140)

* Amended work types for CIVIL hearing centre admin and hearing centre team leader roles. Changes put behind new v2.1 flag

* Reverted changes incorrectly made to current functional test

* Added work types to test again and updated feature toggle annotation to correct flag version

* Update src/main/resources/db/migration/V20241025_906__COT-906_CIVIL_WA_2_1_base_flag_addition.sql

Co-authored-by: abul-syed <130474274+abul-syed@users.noreply.github.com>

* Update src/main/resources/db/migration/V20241025_906__COT-906_CIVIL_WA_2_1_base_flag_addition.sql

Co-authored-by: abul-syed <130474274+abul-syed@users.noreply.github.com>

* Added comment to remove rules after go-live as part of DTSAM-591

---------

Co-authored-by: abul-syed <130474274+abul-syed@users.noreply.github.com>
Co-authored-by: mikebrownccd <104495891+mikebrownccd@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent 787b945 commit b2fe588
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 5 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_6=on) @FeatureToggle(EV:CASEWORKER_FTA_ENABLED=on)
@FeatureToggle(DB:civil_wa_2_1=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,routine_work"
"workTypes": "hearing_work,multi_track_hearing_work,intermediate_track_hearing_work,routine_work"
}
},
{
Expand All @@ -60,7 +60,7 @@
"primaryLocation": "[[ANYTHING_PRESENT]]",
"jurisdiction": "CIVIL",
"region": "2",
"workTypes": "hearing_work,access_requests,routine_work"
"workTypes": "hearing_work,access_requests"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum FeatureFlagEnum {
CIVIL_WA_1_8("civil_wa_1_8"),
CIVIL_WA_1_9("civil_wa_1_9"),
CIVIL_WA_2_0("civil_wa_2_0"),
CIVIL_WA_2_1("civil_wa_2_1"),
PUBLICLAW_WA_1_3("publiclaw_wa_1_3"),
PUBLICLAW_WA_1_4("publiclaw_wa_1_4"),
IAC_JRD_1_1("iac_jrd_1_1"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- COT-906: insert civil_wa_2_1 base flag into flag_config table
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'local', 'civil', 'true');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'pr', 'civil', 'true');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'aat', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'demo', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'perftest', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'ithc', 'civil', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('civil_wa_2_1', 'prod', 'civil', 'false');
67 changes: 67 additions & 0 deletions src/main/resources/validationrules/civil/civil-admin-mapping.drl
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,14 @@ end;

/*
* CIVIL admin "hearing-centre-team-leader" Org role mapping. v1.6
* Made obsolete in COT-906 - disabled by CIVIL_WA_2_1 flag.
* To be removed in DTSAM-591.
*/

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

/*
* CIVIL admin "hearing-centre-team-leader" Org role mapping. v2.1
*/

rule "v2_1_civil_hearing_centre_team_leader_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_2_1.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"));
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 : v2_1_civil_hearing_centre_team_leader_org_role");
end;

/*
* CIVIL admin "hearing-centre-admin" Org role mapping. v1.6
* Made obsolete in COT-906 - disabled by CIVIL_WA_2_1 flag.
* To be removed in DTSAM-591.
*/

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

/*
* CIVIL admin "hearing-centre-admin" Org role mapping. v2.1
*/

rule "v2_1_civil_hearing_centre_admin_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.CIVIL_WA_2_1.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,multi_track_hearing_work,"
+ "intermediate_track_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 : v2_1_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 @@ -41,11 +41,12 @@ class DroolCivilStaffOrgRolesTest extends DroolBase {

static {
expectedRoleNameWorkTypesMap.put("hmcts-admin", null);
expectedRoleNameWorkTypesMap.put("hearing-centre-team-leader", "hearing_work,access_requests,routine_work");
expectedRoleNameWorkTypesMap.put("hearing-centre-team-leader", "hearing_work,access_requests");
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,routine_work");
expectedRoleNameWorkTypesMap.put("hearing-centre-admin",
"hearing_work,multi_track_hearing_work,intermediate_track_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

0 comments on commit b2fe588

Please sign in to comment.