Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFDIV-4448: Add configuration for NFD case deletion #4252

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
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
5 changes: 4 additions & 1 deletion ccd-definitions/AuthorisationComplexType.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
{"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationID", "UserRole": "caseworker-approver", "CRUD": "CRU"},
{"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationName", "UserRole": "caseworker-approver", "CRUD": "CRU"},
{"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PrepopulateToUsersOrganisation", "UserRole": "caseworker-approver", "CRUD": "CRU"},
{"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"}
{"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"},
{"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "R"},
{"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CRU"},
{"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}
]
6 changes: 4 additions & 2 deletions src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CftLibConfig implements CFTLibConfigurer {
@Override
public void configure(CFTLib lib) throws Exception {
var users = Map.of(
"[email protected]", List.of("caseworker", "caseworker-divorce", "caseworker-divorce-courtadmin_beta"),
"[email protected]", List.of("caseworker", "caseworker-divorce", "caseworker-divorce-courtadmin_beta", "TTL_profile"),
"[email protected]", List.of(
"caseworker", "caseworker-divorce", "caseworker-divorce-superuser", "caseworker-divorce-courtadmin_beta"),
"[email protected]", List.of("caseworker", "caseworker-divorce", "caseworker-divorce-courtadmin_beta"),
Expand Down Expand Up @@ -65,7 +65,9 @@ public void configure(CFTLib lib) throws Exception {
"pui-case-manager",
"pui-finance-manager",
"pui-organisation-manager",
"pui-user-manager"
"pui-user-manager",
"TTL_profile",
"idam:cft-ttl-manager"
FaisalMoJ marked this conversation as resolved.
Show resolved Hide resolved
);

ResourceLoader resourceLoader = new DefaultResourceLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void configure(final ConfigBuilder<CaseData, State, UserRole> configBuild
Submitted
)
.name(EVENT_NAME_AND_DESCRIPTION)
.ttlIncrement(36524)
.description(EVENT_NAME_AND_DESCRIPTION)
.aboutToSubmitCallback(this::aboutToSubmit)
.showEventNotes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void configure(final ConfigBuilder<CaseData, State, UserRole> configBuild
RequestedInformationSubmitted,
AwaitingHWFEvidence
)
.ttlIncrement(36524)
.name("HWF application accepted")
.description("HWF application accepted")
.aboutToSubmitCallback(this::aboutToSubmit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void configure(final ConfigBuilder<CaseData, State, UserRole> configBuild
RequestedInformationSubmitted,
AwaitingHWFEvidence
)
.ttlIncrement(36524)
.name("Payment made")
.description("Payment made")
.aboutToSubmitCallback(this::aboutToSubmit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void configure(final ConfigBuilder<CaseData, State, UserRole> configBuild
.event(CITIZEN_CREATE)
.initialState(Draft)
.showCondition(NEVER_SHOW)
.ttlIncrement(180)
.name("Create draft case")
.description("Apply for a divorce or dissolution")
.aboutToSubmitCallback(this::aboutToSubmit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void configure(final ConfigBuilder<CaseData, State, UserRole> configBuild
.event(CITIZEN_PAYMENT_MADE)
.forState(AwaitingPayment)
.showCondition(NEVER_SHOW)
.ttlIncrement(36524)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we also need to account for the scenarios where a sol submits an application or a citizen submits using HWF?

.name("Payment made")
.description("Payment made")
.retries(120, 120)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public class HighLevelDataSetupApp extends DataLoaderToDefinitionStore {
new CcdRoleConfig("pui-case-manager", "PUBLIC"),
new CcdRoleConfig("pui-finance-manager", "PUBLIC"),
new CcdRoleConfig("pui-organisation-manager", "PUBLIC"),
new CcdRoleConfig("pui-user-manager", "PUBLIC")
new CcdRoleConfig("pui-user-manager", "PUBLIC"),
new CcdRoleConfig("TTL_profile", "PUBLIC"),
new CcdRoleConfig("idam:cft-ttl-manager", "PUBLIC")
FaisalMoJ marked this conversation as resolved.
Show resolved Hide resolved
};

private final CcdEnvironment environment;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.divorce.common.service.task;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.ccd.sdk.api.CaseDetails;
Expand All @@ -17,6 +18,7 @@
import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview;

@Component
@RequiredArgsConstructor
@Slf4j
public class SetStateAfterSubmission implements CaseTask {

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -19,6 +20,7 @@
import uk.gov.hmcts.ccd.sdk.type.ListValue;
import uk.gov.hmcts.ccd.sdk.type.OrderSummary;
import uk.gov.hmcts.ccd.sdk.type.ScannedDocument;
import uk.gov.hmcts.ccd.sdk.type.TTL;
import uk.gov.hmcts.ccd.sdk.type.YesOrNo;
import uk.gov.hmcts.divorce.caseworker.model.CaseNote;
import uk.gov.hmcts.divorce.divorcecase.model.access.AcaSystemUserAccess;
Expand All @@ -31,6 +33,7 @@
import uk.gov.hmcts.divorce.divorcecase.model.access.DefaultAccess;
import uk.gov.hmcts.divorce.divorcecase.model.access.SolicitorAndSystemUpdateAccess;
import uk.gov.hmcts.divorce.divorcecase.model.access.SystemUpdateAndSuperUserAccess;
import uk.gov.hmcts.divorce.divorcecase.model.access.TtlProfileAccess;
import uk.gov.hmcts.divorce.document.model.DivorceDocument;
import uk.gov.hmcts.divorce.document.model.DocumentType;
import uk.gov.hmcts.divorce.noticeofchange.model.ChangeOfRepresentative;
Expand Down Expand Up @@ -328,6 +331,14 @@ public class CaseData {
@Builder.Default
private SentNotifications sentNotifications = new SentNotifications();

@JsonProperty("TTL")
@CCD(
label = "Set up TTL",
typeOverride = FieldType.TTL,
access = {TtlProfileAccess.class}
FaisalMoJ marked this conversation as resolved.
Show resolved Hide resolved
)
private TTL retainAndDisposeTimeToLive;

@JsonUnwrapped
@Builder.Default
private RequestForInformationList requestForInformationList = new RequestForInformationList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public enum UserRole implements HasRole {
JUDGE("caseworker-divorce-judge", "CRU"),
NOC_APPROVER("caseworker-approver", "CRU"),
RPA_ROBOT("caseworker-divorce-rparobot", "CRU"),
TTL_PROFILE("TTL_profile", "CRU"),

SOLICITOR("caseworker-divorce-solicitor", "CRU"),
APPLICANT_1_SOLICITOR("[APPONESOLICITOR]", "CRU"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package uk.gov.hmcts.divorce.divorcecase.model;

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

@AllArgsConstructor
@Getter
public enum UserRolesForAccessProfiles implements HasRole {

CASE_WORKER("idam:caseworker-divorce-courtadmin_beta", "CRU"),
CASE_WORKER_BULK_SCAN("idam:caseworker-divorce-bulkscan", "CRU"),
LEGAL_ADVISOR("idam:caseworker-divorce-courtadmin-la", "CRU"),
SUPER_USER("idam:caseworker-divorce-superuser", "CRU"),
SYSTEMUPDATE("idam:caseworker-divorce-systemupdate", "CRUD"),
JUDGE("idam:caseworker-divorce-judge", "CRU"),
NOC_APPROVER("idam:caseworker-approver", "CRU"),
RPA_ROBOT("idam:caseworker-divorce-rparobot", "CRU"),
TTL_MANAGER("idam:cft-ttl-manager", "CRU"),

SOLICITOR("idam:caseworker-divorce-solicitor", "CRU"),
APPLICANT_1_SOLICITOR("[APPONESOLICITOR]", "CRU"),
APPLICANT_2_SOLICITOR("[APPTWOSOLICITOR]", "CRU"),
ORGANISATION_CASE_ACCESS_ADMINISTRATOR("idam:caseworker-caa", "CRU"),

CITIZEN("idam:citizen", "CRU"),
CREATOR("[CREATOR]", "CRU"),
APPLICANT_2("[APPLICANTTWO]", "CRU");

@JsonValue
private final String role;
private final String caseTypePermissions;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package uk.gov.hmcts.divorce.divorcecase.model.access;

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.divorce.divorcecase.model.CaseData;
import uk.gov.hmcts.divorce.divorcecase.model.State;
import uk.gov.hmcts.divorce.divorcecase.model.UserRolesForAccessProfiles;

@Component
public class RoleToAccessProfiles implements CCDConfig<CaseData, State, UserRolesForAccessProfiles> {
@Override
public void configure(ConfigBuilder<CaseData, State, UserRolesForAccessProfiles> configBuilder) {
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CASE_WORKER)
.accessProfiles("caseworker-divorce-courtadmin_beta").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CASE_WORKER_BULK_SCAN)
.accessProfiles("caseworker-divorce-bulkscan").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.LEGAL_ADVISOR)
.accessProfiles("caseworker-divorce-courtadmin-la").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.SUPER_USER)
.accessProfiles("caseworker-divorce-superuser").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.SYSTEMUPDATE)
.accessProfiles("caseworker-divorce-systemupdate").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.JUDGE)
.accessProfiles("caseworker-divorce-judge").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.NOC_APPROVER)
.accessProfiles("caseworker-approver").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.RPA_ROBOT)
.accessProfiles("caseworker-divorce-rparobot").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.TTL_MANAGER)
.accessProfiles("TTL_profile").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.SOLICITOR)
.accessProfiles("caseworker-divorce-solicitor").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.APPLICANT_1_SOLICITOR)
.accessProfiles("[APPONESOLICITOR]").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.APPLICANT_2_SOLICITOR)
.accessProfiles("[APPTWOSOLICITOR]").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.ORGANISATION_CASE_ACCESS_ADMINISTRATOR)
.accessProfiles("caseworker-caa").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CITIZEN)
.accessProfiles("citizen").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CREATOR)
.accessProfiles("[CREATOR]").build();
configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.APPLICANT_2)
.accessProfiles("[APPLICANTTWO]").build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package uk.gov.hmcts.divorce.divorcecase.model.access;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.SetMultimap;
import uk.gov.hmcts.ccd.sdk.api.HasAccessControl;
import uk.gov.hmcts.ccd.sdk.api.HasRole;
import uk.gov.hmcts.ccd.sdk.api.Permission;

import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE;

public class TtlProfileAccess implements HasAccessControl {
@Override
public SetMultimap<HasRole, Permission> getGrants() {

SetMultimap<HasRole, Permission> grants = HashMultimap.create();
grants.putAll(TTL_PROFILE, Permissions.CREATE_READ_UPDATE);

return grants;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private PageBuilder addEventConfig(
.initialState(Draft)
.name("Apply: divorce or dissolution")
.description("Apply: divorce or dissolution")
.ttlIncrement(180)
.showSummary()
.showEventNotes()
.endButtonLabel("Save Application")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ private PageBuilder addEventConfig(final ConfigBuilder<CaseData, State, UserRole
.description("Agree statement of truth, pay & submit")
.showSummary()
.showEventNotes()
.ttlIncrement(36524)
.showCondition("applicationType=\"soleApplication\" OR [STATE]=\"Applicant2Approved\"")
.endButtonLabel("Submit Application")
.aboutToStartCallback(this::aboutToStart)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package uk.gov.hmcts.divorce.systemupdate.event;

import lombok.extern.slf4j.Slf4j;
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.ccd.sdk.type.TTL;
import uk.gov.hmcts.divorce.common.ccd.PageBuilder;
import uk.gov.hmcts.divorce.divorcecase.model.CaseData;
import uk.gov.hmcts.divorce.divorcecase.model.State;
import uk.gov.hmcts.divorce.divorcecase.model.UserRole;

import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW;
import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment;
import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft;
import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE;
import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE;

@Component
@Slf4j
public class ManageCaseTtl implements CCDConfig<CaseData, State, UserRole> {

public static final String MANAGE_CASE_TTL = "manage-case-ttl";
FaisalMoJ marked this conversation as resolved.
Show resolved Hide resolved

@Override
public void configure(final ConfigBuilder<CaseData, State, UserRole> configBuilder) {

new PageBuilder(configBuilder
.event(MANAGE_CASE_TTL)
.forStates(Draft, AwaitingPayment)
.name("Resolve time to live")
.showCondition(NEVER_SHOW)
.description("Resolve time to live")
.fields()
.complex(CaseData::getRetainAndDisposeTimeToLive)
.readonly(TTL::getSystemTTL)
.optional(TTL::getOverrideTTL)
.optional(TTL::getSuspended)
.done()
.done()
.grant(CREATE_READ_UPDATE, TTL_PROFILE));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package uk.gov.hmcts.divorce.systemupdate.event;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
import uk.gov.hmcts.ccd.sdk.ConfigBuilderImpl;
import uk.gov.hmcts.ccd.sdk.api.Event;
import uk.gov.hmcts.divorce.divorcecase.model.CaseData;
import uk.gov.hmcts.divorce.divorcecase.model.State;
import uk.gov.hmcts.divorce.divorcecase.model.UserRole;

import static org.assertj.core.api.Assertions.assertThat;
import static uk.gov.hmcts.divorce.systemupdate.event.ManageCaseTtl.MANAGE_CASE_TTL;
import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder;
import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom;

@ExtendWith(MockitoExtension.class)
class ManageCaseTtlTest {

@InjectMocks
private ManageCaseTtl systemUpdateTTL;

@Test
void shouldAddConfigurationToConfigBuilder() {
final ConfigBuilderImpl<CaseData, State, UserRole> configBuilder = createCaseDataConfigBuilder();

systemUpdateTTL.configure(configBuilder);

assertThat(getEventsFrom(configBuilder).values())
.extracting(Event::getId)
.contains(MANAGE_CASE_TTL);
}
}
Loading