From 980a79fff5a894d131c94f2213e51c52f314c6c3 Mon Sep 17 00:00:00 2001 From: benedwards Date: Tue, 21 Jan 2025 09:58:15 +0000 Subject: [PATCH 1/7] Added new security role --- .../V1_428__added_role_MEDIA_IN_PERPETUITY.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/resources/db/migration/common/V1_428__added_role_MEDIA_IN_PERPETUITY.sql diff --git a/src/main/resources/db/migration/common/V1_428__added_role_MEDIA_IN_PERPETUITY.sql b/src/main/resources/db/migration/common/V1_428__added_role_MEDIA_IN_PERPETUITY.sql new file mode 100644 index 0000000000..e66e666d38 --- /dev/null +++ b/src/main/resources/db/migration/common/V1_428__added_role_MEDIA_IN_PERPETUITY.sql @@ -0,0 +1,16 @@ +insert into security_role (rol_id, role_name, display_name, display_state) +values (nextval('rol_seq'), 'MEDIA_IN_PERPETUITY', 'Media in Perpetuity', TRUE); + + +update security_group +set rol_id = (select rol_id from security_role where role_name = 'MEDIA_IN_PERPETUITY') +where grp_id = 7; + +update security_role +set display_state = FALSE +where role_name = 'MEDIA_ACCESSOR'; + + + + + From 1b0b1c4a10d1853368e3edb478c8ef00c6d0dbb5 Mon Sep 17 00:00:00 2001 From: benedwards Date: Tue, 21 Jan 2025 11:26:50 +0000 Subject: [PATCH 2/7] Renamed migration --- ..._PERPETUITY.sql => V1_429__added_role_MEDIA_IN_PERPETUITY.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/common/{V1_428__added_role_MEDIA_IN_PERPETUITY.sql => V1_429__added_role_MEDIA_IN_PERPETUITY.sql} (100%) diff --git a/src/main/resources/db/migration/common/V1_428__added_role_MEDIA_IN_PERPETUITY.sql b/src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql similarity index 100% rename from src/main/resources/db/migration/common/V1_428__added_role_MEDIA_IN_PERPETUITY.sql rename to src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql From 8e4045d92fcea70cd27c18453590e8841296893f Mon Sep 17 00:00:00 2001 From: benedwards Date: Tue, 21 Jan 2025 15:53:46 +0000 Subject: [PATCH 3/7] Fixed tests --- .../common/repository/SecurityRoleRepositoryTest.java | 2 +- .../controller/SecurityRoleControllerIntTest.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/integrationTest/java/uk/gov/hmcts/darts/common/repository/SecurityRoleRepositoryTest.java b/src/integrationTest/java/uk/gov/hmcts/darts/common/repository/SecurityRoleRepositoryTest.java index 5a764c0128..3afa0fdce0 100644 --- a/src/integrationTest/java/uk/gov/hmcts/darts/common/repository/SecurityRoleRepositoryTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/darts/common/repository/SecurityRoleRepositoryTest.java @@ -43,7 +43,7 @@ void closeHibernateSession() { @Test void shouldFindAllSecurityRoles() { List securityRoleEntityList = securityRoleRepository.findAll(); - assertEquals(14, securityRoleEntityList.size()); + assertEquals(15, securityRoleEntityList.size()); } @Test diff --git a/src/integrationTest/java/uk/gov/hmcts/darts/usermanagement/controller/SecurityRoleControllerIntTest.java b/src/integrationTest/java/uk/gov/hmcts/darts/usermanagement/controller/SecurityRoleControllerIntTest.java index 80abcc4199..d64d5330c2 100644 --- a/src/integrationTest/java/uk/gov/hmcts/darts/usermanagement/controller/SecurityRoleControllerIntTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/darts/usermanagement/controller/SecurityRoleControllerIntTest.java @@ -98,7 +98,7 @@ void getSecurityRolesShouldSucceedAndReturnAllRoles() throws Exception { "id": 9, "role_name": "MEDIA_ACCESSOR", "display_name": "Media Accessor", - "display_state": true + "display_state": false }, { "id": 10, @@ -129,6 +129,12 @@ void getSecurityRolesShouldSucceedAndReturnAllRoles() throws Exception { "role_name": "MID_TIER", "display_name": "Mid Tier", "display_state": false + }, + { + "id": 15, + "role_name": "MEDIA_IN_PERPETUITY", + "display_name": "Media in Perpetuity", + "display_state": true } ] """; From fd1e27252812fdda4d6bec967ee468dd9c408ec0 Mon Sep 17 00:00:00 2001 From: benedwards Date: Tue, 21 Jan 2025 16:44:01 +0000 Subject: [PATCH 4/7] Review comments --- .../migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql b/src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql index e66e666d38..da6889ac1e 100644 --- a/src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql +++ b/src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql @@ -4,7 +4,7 @@ values (nextval('rol_seq'), 'MEDIA_IN_PERPETUITY', 'Media in Perpetuity', TRUE); update security_group set rol_id = (select rol_id from security_role where role_name = 'MEDIA_IN_PERPETUITY') -where grp_id = 7; +where grp_id = (select grp_id from security_group where group_name = 'MEDIA_IN_PERPETUITY'); update security_role set display_state = FALSE From b0e92a858d2abd8f98c16f3c59634b96e6373a49 Mon Sep 17 00:00:00 2001 From: benedwards Date: Wed, 22 Jan 2025 09:55:25 +0000 Subject: [PATCH 5/7] Fixed tests --- .../securityGroupsGetEndpointAllReturned.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/integrationTest/resources/tests/usermanagement/SecurityGroupControllerGetTest/securityGroupsGetEndpointAllReturned.json b/src/integrationTest/resources/tests/usermanagement/SecurityGroupControllerGetTest/securityGroupsGetEndpointAllReturned.json index c28d36a6d6..6c9028a1aa 100644 --- a/src/integrationTest/resources/tests/usermanagement/SecurityGroupControllerGetTest/securityGroupsGetEndpointAllReturned.json +++ b/src/integrationTest/resources/tests/usermanagement/SecurityGroupControllerGetTest/securityGroupsGetEndpointAllReturned.json @@ -147,6 +147,6 @@ "courthouse_ids": [], "name": "MEDIA_IN_PERPETUITY", "display_name": "MEDIA_IN_PERPETUITY", - "security_role_id": 10 + "security_role_id": 15 } ] \ No newline at end of file From 148f190cd6d345623f675e466309be606bc04616 Mon Sep 17 00:00:00 2001 From: benedwards Date: Wed, 22 Jan 2025 16:06:59 +0000 Subject: [PATCH 6/7] Updated some tests --- .../darts/usermanagement/SecurityGroupFunctionalTest.java | 4 ++-- .../darts/usermanagement/SecurityRoleFunctionalTest.java | 8 +++++++- ...ITY.sql => V1_431__added_role_MEDIA_IN_PERPETUITY.sql} | 0 3 files changed, 9 insertions(+), 3 deletions(-) rename src/main/resources/db/migration/common/{V1_429__added_role_MEDIA_IN_PERPETUITY.sql => V1_431__added_role_MEDIA_IN_PERPETUITY.sql} (100%) diff --git a/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java b/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java index 7627ab9109..2d6c4215bf 100644 --- a/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java +++ b/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java @@ -137,8 +137,8 @@ void shouldGetSecurityGroups() throws JsonProcessingException { checkGroup(staticGroups.get(6), "hmcts_staff_4", false, 4, true, 127); checkGroup(staticGroups.get(7), "hmcts_staff_5", true, 5, true, 127); checkGroup(staticGroups.get(8), "hmcts_staff_6", true, 6, true, 127); - checkGroup(staticGroups.get(9), "MEDIA_IN_PERPETUITY", false, 10, true, null); - checkGroup(staticGroups.get(10), "MID_TIER", true, 14, false, null); + checkGroup(staticGroups.get(9), "MID_TIER", true, 14, false, null); + checkGroup(staticGroups.get(10), "MEDIA_IN_PERPETUITY", false, 10, true, null); checkGroup(staticGroups.get(11), "SUPER_ADMIN", true, 8, true, null); checkGroup(staticGroups.get(12), "SUPER_USER", true, 7, true, null); checkGroup(staticGroups.get(13), "XHIBIT", true, 11, false, null); diff --git a/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityRoleFunctionalTest.java b/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityRoleFunctionalTest.java index 66fcd7fa6a..0db3b25300 100644 --- a/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityRoleFunctionalTest.java +++ b/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityRoleFunctionalTest.java @@ -80,7 +80,7 @@ void shouldGetSecurityRoles() { "id": 9, "role_name": "MEDIA_ACCESSOR", "display_name": "Media Accessor", - "display_state": true + "display_state": false }, { "id": 10, @@ -111,6 +111,12 @@ void shouldGetSecurityRoles() { "role_name": "MID_TIER", "display_name": "Mid Tier", "display_state": false + }, + { + "id": 15, + "role_name": "MEDIA_IN_PERPETUITY", + "display_name": "Media in Perpetuity", + "display_state": true } ] """, diff --git a/src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql b/src/main/resources/db/migration/common/V1_431__added_role_MEDIA_IN_PERPETUITY.sql similarity index 100% rename from src/main/resources/db/migration/common/V1_429__added_role_MEDIA_IN_PERPETUITY.sql rename to src/main/resources/db/migration/common/V1_431__added_role_MEDIA_IN_PERPETUITY.sql From c6a64334bf18437ef7fba1e20317aab1c0a9c96f Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 23 Jan 2025 09:22:56 +0000 Subject: [PATCH 7/7] Test update --- .../darts/usermanagement/SecurityGroupFunctionalTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java b/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java index 2d6c4215bf..d8f36c70d6 100644 --- a/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java +++ b/src/functionalTest/java/uk/gov/hmcts/darts/usermanagement/SecurityGroupFunctionalTest.java @@ -138,10 +138,9 @@ void shouldGetSecurityGroups() throws JsonProcessingException { checkGroup(staticGroups.get(7), "hmcts_staff_5", true, 5, true, 127); checkGroup(staticGroups.get(8), "hmcts_staff_6", true, 6, true, 127); checkGroup(staticGroups.get(9), "MID_TIER", true, 14, false, null); - checkGroup(staticGroups.get(10), "MEDIA_IN_PERPETUITY", false, 10, true, null); - checkGroup(staticGroups.get(11), "SUPER_ADMIN", true, 8, true, null); - checkGroup(staticGroups.get(12), "SUPER_USER", true, 7, true, null); - checkGroup(staticGroups.get(13), "XHIBIT", true, 11, false, null); + checkGroup(staticGroups.get(10), "SUPER_ADMIN", true, 8, true, null); + checkGroup(staticGroups.get(11), "SUPER_USER", true, 7, true, null); + checkGroup(staticGroups.get(12), "XHIBIT", true, 11, false, null); }