RED-3800 fix for missing dossier dictionary in prod for some dossiers
This commit is contained in:
parent
04fbbb4572
commit
5ee4f6ba41
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { forkJoin, Observable, throwError } from 'rxjs';
|
||||
import { forkJoin, Observable, of, throwError } from 'rxjs';
|
||||
import { EntitiesService, List, QueryParam, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { Dictionary, DictionaryEntryType, DictionaryEntryTypes, IDictionary, IUpdateDictionary, SuperTypes } from '@red/domain';
|
||||
import { catchError, map, switchMap, tap } from 'rxjs/operators';
|
||||
@ -154,7 +154,7 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
}
|
||||
}
|
||||
|
||||
if (dossierDictionary.addToDictionaryAction) {
|
||||
if (dossierDictionary?.addToDictionaryAction) {
|
||||
possibleDictionaries.push(dossierDictionary);
|
||||
}
|
||||
|
||||
@ -175,6 +175,10 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
tap(dictionary => {
|
||||
this._dossierDictionariesMapService.set(dossierId, [dictionary]);
|
||||
}),
|
||||
catchError(() => {
|
||||
this._dossierDictionariesMapService.set(dossierId, []);
|
||||
return of(null);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import { FeaturesService } from '@services/features.service';
|
||||
import { IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { ROLES } from '@users/roles';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { DossierDictionariesMapService } from '@services/entity-services/dossier-dictionaries-map.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PermissionsService {
|
||||
@ -15,6 +16,7 @@ export class PermissionsService {
|
||||
private readonly _featuresService: FeaturesService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _iqserPermissionsService: IqserPermissionsService,
|
||||
private readonly _dossierDictionariesMapService: DossierDictionariesMapService,
|
||||
) {}
|
||||
|
||||
get #userId(): string {
|
||||
@ -295,7 +297,12 @@ export class PermissionsService {
|
||||
}
|
||||
|
||||
canEditDossierDictionary(dossier: Dossier): boolean {
|
||||
return dossier.isActive && this.isOwner(dossier) && this._iqserPermissionsService.has(ROLES.dossiers.dictionaryEntries.write);
|
||||
return (
|
||||
dossier.isActive &&
|
||||
this._dossierDictionariesMapService.get(dossier.id).length > 0 &&
|
||||
this.isOwner(dossier) &&
|
||||
this._iqserPermissionsService.has(ROLES.dossiers.dictionaryEntries.write)
|
||||
);
|
||||
}
|
||||
|
||||
canEditDossierAttributes(dossier: Dossier): boolean {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"ADMIN_CONTACT_NAME": null,
|
||||
"ADMIN_CONTACT_URL": null,
|
||||
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
|
||||
"API_URL": "https://dev-05.iqser.cloud/redaction-gateway-v1",
|
||||
"APP_NAME": "RedactManager",
|
||||
"AUTO_READ_TIME": 3,
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
@ -11,7 +11,7 @@
|
||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"OAUTH_IDP_HINT": null,
|
||||
"OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction",
|
||||
"OAUTH_URL": "https://dev-05.iqser.cloud/auth/realms/redaction",
|
||||
"RECENT_PERIOD_IN_HOURS": 24,
|
||||
"SELECTION_MODE": "structural",
|
||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user