@hmcts/ccd-case-ui-toolkit 7.3.74-user-by-idam-rework → 7.3.75-inconsistent-validation-error-message
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1856,13 +1856,13 @@ function getUserDetails(sessionStorageService) {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
function isInternalUser(sessionStorageService) {
|
|
1858
1858
|
const userDetails = getUserDetails(sessionStorageService);
|
|
1859
|
-
return
|
|
1859
|
+
return userDetails && userDetails?.roles
|
|
1860
1860
|
&& !(userDetails.roles.includes(PUI_CASE_MANAGER)
|
|
1861
1861
|
|| userDetails.roles.some((role) => role.toLowerCase().includes(JUDGE)));
|
|
1862
1862
|
}
|
|
1863
1863
|
function isJudiciaryUser(sessionStorageService) {
|
|
1864
1864
|
const userDetails = getUserDetails(sessionStorageService);
|
|
1865
|
-
return
|
|
1865
|
+
return userDetails && userDetails?.roles
|
|
1866
1866
|
&& (userDetails.roles.some((role) => role.toLowerCase().includes(JUDGE)));
|
|
1867
1867
|
}
|
|
1868
1868
|
|
|
@@ -8671,32 +8671,31 @@ class CaseAccessUtils {
|
|
|
8671
8671
|
static CTSC_ROLE = 'ctsc';
|
|
8672
8672
|
static CTSC_ROLE_CATEGORY = 'CTSC';
|
|
8673
8673
|
static CTSC_ROLE_NAME = 'ctsc';
|
|
8674
|
-
|
|
8675
|
-
getMappedRoleCategories(roles = []) {
|
|
8674
|
+
getMappedRoleCategory(roles = [], roleCategories = []) {
|
|
8676
8675
|
const roleKeywords = roles.join().split('-').join().split(',');
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
roleCategoryList.push(CaseAccessUtils.JUDGE_ROLE_CATEGORY);
|
|
8676
|
+
if (this.roleOrCategoryExists(CaseAccessUtils.JUDGE_ROLE, CaseAccessUtils.JUDGE_ROLE_CATEGORY, roleKeywords, roleCategories)) {
|
|
8677
|
+
return CaseAccessUtils.JUDGE_ROLE_CATEGORY;
|
|
8680
8678
|
}
|
|
8681
|
-
if (this.
|
|
8682
|
-
|
|
8679
|
+
else if (this.roleOrCategoryExists(CaseAccessUtils.PROFESSIONAL_ROLE, CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY, roleKeywords, roleCategories)) {
|
|
8680
|
+
return CaseAccessUtils.PROFESSIONAL_ROLE_CATEGORY;
|
|
8683
8681
|
}
|
|
8684
|
-
if (this.
|
|
8685
|
-
|
|
8682
|
+
else if (this.roleOrCategoryExists(CaseAccessUtils.CITIZEN_ROLE, CaseAccessUtils.CITIZEN_ROLE_CATEGORY, roleKeywords, roleCategories)) {
|
|
8683
|
+
return CaseAccessUtils.CITIZEN_ROLE_CATEGORY;
|
|
8686
8684
|
}
|
|
8687
|
-
if (this.
|
|
8688
|
-
|
|
8685
|
+
else if (this.roleOrCategoryExists(CaseAccessUtils.ADMIN_ROLE, CaseAccessUtils.ADMIN_ROLE_CATEGORY, roleKeywords, roleCategories)) {
|
|
8686
|
+
return CaseAccessUtils.ADMIN_ROLE_CATEGORY;
|
|
8689
8687
|
}
|
|
8690
|
-
if (this.
|
|
8691
|
-
|
|
8688
|
+
else if (this.roleOrCategoryExists(CaseAccessUtils.CTSC_ROLE, CaseAccessUtils.CTSC_ROLE_CATEGORY, roleKeywords, roleCategories)) {
|
|
8689
|
+
return CaseAccessUtils.CTSC_ROLE_CATEGORY;
|
|
8692
8690
|
}
|
|
8693
|
-
|
|
8694
|
-
|
|
8691
|
+
else {
|
|
8692
|
+
return CaseAccessUtils.LEGAL_OPERATIONS_ROLE_CATEGORY;
|
|
8695
8693
|
}
|
|
8696
|
-
return roleCategoryList;
|
|
8697
8694
|
}
|
|
8698
|
-
|
|
8699
|
-
|
|
8695
|
+
roleOrCategoryExists(roleKeyword, roleCategory, roleKeywords, roleCategories) {
|
|
8696
|
+
const categoryExists = roleCategories.indexOf(roleCategory) > -1;
|
|
8697
|
+
const keywordExists = roleKeywords.indexOf(roleKeyword) > -1;
|
|
8698
|
+
return categoryExists ? categoryExists : keywordExists;
|
|
8700
8699
|
}
|
|
8701
8700
|
getAMRoleName(accessType, aMRole) {
|
|
8702
8701
|
let roleName = '';
|
|
@@ -9126,10 +9125,10 @@ class CaseworkerService {
|
|
|
9126
9125
|
this.appConfig = appConfig;
|
|
9127
9126
|
this.errorService = errorService;
|
|
9128
9127
|
}
|
|
9129
|
-
|
|
9130
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/caseworker/
|
|
9128
|
+
getCaseworkers(serviceId) {
|
|
9129
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/caseworker/getUsersByServiceName`;
|
|
9131
9130
|
return this.http
|
|
9132
|
-
.post(url,
|
|
9131
|
+
.post(url, { services: [serviceId] })
|
|
9133
9132
|
.pipe(catchError(error => {
|
|
9134
9133
|
this.errorService.setError(error);
|
|
9135
9134
|
return throwError(error);
|
|
@@ -10581,35 +10580,30 @@ class CasesService {
|
|
|
10581
10580
|
}
|
|
10582
10581
|
createChallengedAccessRequest(caseId, request) {
|
|
10583
10582
|
// Assignment API endpoint
|
|
10583
|
+
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
10584
10584
|
const camUtils = new CaseAccessUtils();
|
|
10585
|
-
let userInfo
|
|
10586
|
-
if (
|
|
10587
|
-
|
|
10588
|
-
}
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
const roleCategories = userInfo.roleCategories || camUtils.getMappedRoleCategories(userInfo.roles);
|
|
10592
|
-
// If user has no role categories, default to LEGAL_OPERATIONS
|
|
10593
|
-
const roleName = camUtils.getAMRoleName('challenged', roleCategories?.length > 0 ? roleCategories[0] : "LEGAL_OPERATIONS");
|
|
10585
|
+
let userInfo;
|
|
10586
|
+
if (userInfoStr) {
|
|
10587
|
+
userInfo = JSON.parse(userInfoStr);
|
|
10588
|
+
}
|
|
10589
|
+
const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
|
|
10590
|
+
const roleName = camUtils.getAMRoleName('challenged', roleCategory);
|
|
10594
10591
|
const beginTime = new Date();
|
|
10595
10592
|
const endTime = new Date(new Date().setUTCHours(23, 59, 59, 999));
|
|
10596
10593
|
const id = userInfo.id ? userInfo.id : userInfo.uid;
|
|
10597
10594
|
const isNew = true;
|
|
10598
|
-
const payload = camUtils.getAMPayload(id, id, roleName,
|
|
10599
|
-
// EXUI-4758 - Return first roleCategory as the roleCategory
|
|
10600
|
-
roleCategories[0], 'CHALLENGED', caseId, request, beginTime, endTime, isNew);
|
|
10595
|
+
const payload = camUtils.getAMPayload(id, id, roleName, roleCategory, 'CHALLENGED', caseId, request, beginTime, endTime, isNew);
|
|
10601
10596
|
return this.http.post(`/api/challenged-access-request`, payload);
|
|
10602
10597
|
}
|
|
10603
10598
|
createSpecificAccessRequest(caseId, sar) {
|
|
10599
|
+
// Assignment API endpoint
|
|
10600
|
+
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
10604
10601
|
const camUtils = new CaseAccessUtils();
|
|
10605
|
-
let userInfo
|
|
10606
|
-
if (
|
|
10607
|
-
|
|
10608
|
-
}
|
|
10609
|
-
|
|
10610
|
-
const roleCategories = userInfo.roleCategories || camUtils.getMappedRoleCategories(userInfo.roles);
|
|
10611
|
-
// EXUI-4758 - Return first roleCategory as the roleCategory for now, unless not present, in which case default to LEGAL_OPERATIONS
|
|
10612
|
-
const roleCategory = roleCategories?.length > 0 ? roleCategories[0] : "LEGAL_OPERATIONS";
|
|
10602
|
+
let userInfo;
|
|
10603
|
+
if (userInfoStr) {
|
|
10604
|
+
userInfo = JSON.parse(userInfoStr);
|
|
10605
|
+
}
|
|
10606
|
+
const roleCategory = userInfo.roleCategory || camUtils.getMappedRoleCategory(userInfo.roles, userInfo.roleCategories);
|
|
10613
10607
|
const roleName = camUtils.getAMRoleName('specific', roleCategory);
|
|
10614
10608
|
const id = userInfo.id ? userInfo.id : userInfo.uid;
|
|
10615
10609
|
const payload = camUtils.getAMPayload(null, id, roleName, roleCategory, 'SPECIFIC', caseId, sar, null, null, true);
|
|
@@ -11768,6 +11762,11 @@ class CaseEditPageComponent {
|
|
|
11768
11762
|
this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% exceeds the maximum length`, label });
|
|
11769
11763
|
fieldElement.markAsDirty();
|
|
11770
11764
|
}
|
|
11765
|
+
else if (fieldElement.hasError('markDownPattern')) {
|
|
11766
|
+
this.caseEditDataService.addFormValidationError({
|
|
11767
|
+
id, message: `The data entered is not valid for %FIELDLABEL%. Link mark up characters are not allowed in this field.`, label
|
|
11768
|
+
});
|
|
11769
|
+
}
|
|
11771
11770
|
else if (fieldElement.invalid) {
|
|
11772
11771
|
if (casefield.isComplex()) {
|
|
11773
11772
|
errorPresent = this.generateErrorMessage(casefield.field_type.complex_fields, fieldElement, id, true);
|
|
@@ -12704,9 +12703,12 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
12704
12703
|
this.jurisdiction = task.jurisdiction;
|
|
12705
12704
|
this.caseType = task.case_type_id;
|
|
12706
12705
|
// Current user is a caseworker?
|
|
12707
|
-
this.caseworkerSubscription = this.caseworkerService.
|
|
12708
|
-
if (
|
|
12709
|
-
|
|
12706
|
+
this.caseworkerSubscription = this.caseworkerService.getCaseworkers(task.jurisdiction).subscribe(result => {
|
|
12707
|
+
if (result && result[0].service === task.jurisdiction && result[0].caseworkers) {
|
|
12708
|
+
const caseworker = result[0].caseworkers.find(x => x.idamId === task.assignee);
|
|
12709
|
+
if (caseworker) {
|
|
12710
|
+
this.assignedUserName = `${caseworker.firstName} ${caseworker.lastName}`;
|
|
12711
|
+
}
|
|
12710
12712
|
}
|
|
12711
12713
|
if (!this.assignedUserName) {
|
|
12712
12714
|
// Current user is a judicial user?
|
|
@@ -37830,9 +37832,12 @@ class TaskAssignedComponent {
|
|
|
37830
37832
|
// Current user is a caseworker?
|
|
37831
37833
|
this.jurisdiction = this.task.jurisdiction;
|
|
37832
37834
|
this.caseType = this.task.case_type_id;
|
|
37833
|
-
this.caseworkerSubscription = this.caseworkerService.
|
|
37834
|
-
if (
|
|
37835
|
-
|
|
37835
|
+
this.caseworkerSubscription = this.caseworkerService.getCaseworkers(this.task.jurisdiction).subscribe(result => {
|
|
37836
|
+
if (result && result[0].service === this.task.jurisdiction && result[0].caseworkers) {
|
|
37837
|
+
const caseworker = result[0].caseworkers.find(x => x.idamId === this.task.assignee);
|
|
37838
|
+
if (caseworker) {
|
|
37839
|
+
this.assignedUserName = `${caseworker.firstName} ${caseworker.lastName}`;
|
|
37840
|
+
}
|
|
37836
37841
|
}
|
|
37837
37842
|
if (!this.assignedUserName) {
|
|
37838
37843
|
// Current user is a judicial user?
|