RED-3800: Can't delete system managed entities, fixed hints update error
This commit is contained in:
parent
cabd1291b9
commit
306bd872b8
@ -91,16 +91,18 @@
|
||||
{{ templateStats.dictionarySummary(dict.type)?.entriesCount || 0 }}
|
||||
</div>
|
||||
|
||||
<div *ngIf="permissionsService.canEditEntities()" class="action-buttons">
|
||||
<div class="action-buttons">
|
||||
<iqser-circle-button
|
||||
(action)="openDeleteEntitiesDialog($event, [dict])"
|
||||
[tooltip]="'entities-listing.action.delete' | translate"
|
||||
*ngIf="permissionsService.canDeleteEntity(dict)"
|
||||
[type]="circleButtonTypes.dark"
|
||||
icon="iqser:trash"
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
[routerLink]="dict.routerLink"
|
||||
*ngIf="permissionsService.canEditEntities()"
|
||||
[tooltip]="'entities-listing.action.edit' | translate"
|
||||
[type]="circleButtonTypes.dark"
|
||||
icon="iqser:edit"
|
||||
|
||||
@ -105,18 +105,23 @@ export class AddEditEntityComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
private _formToObject(): IDictionary {
|
||||
// Fields that aren't set for hints, need additional check
|
||||
const caseInsensitive = this.form.get('caseSensitive') ? !this.form.get('caseSensitive').value : null;
|
||||
const addToDictionaryAction = !!this.form.get('addToDictionaryAction')?.value;
|
||||
const hasDictionary = !!this.form.get('addToDictionaryAction')?.value;
|
||||
|
||||
return {
|
||||
type: this.form.get('type').value,
|
||||
label: this.form.get('label').value,
|
||||
caseInsensitive: !this.form.get('caseSensitive').value,
|
||||
description: this.form.get('description').value,
|
||||
hexColor: this.form.get('hexColor').value,
|
||||
recommendationHexColor: this.form.get('recommendationHexColor').value,
|
||||
hint: this.form.get('hint').value,
|
||||
rank: this.form.get('rank').value,
|
||||
addToDictionaryAction: !!this.form.get('addToDictionaryAction').value,
|
||||
dossierTemplateId: this.dossierTemplateId,
|
||||
hasDictionary: !!this.form.get('hasDictionary').value,
|
||||
caseInsensitive,
|
||||
addToDictionaryAction,
|
||||
hasDictionary,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { UserService } from './user.service';
|
||||
import { Dossier, File, IComment, IDossier } from '@red/domain';
|
||||
import { Dictionary, Dossier, File, IComment, IDossier } from '@red/domain';
|
||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||
import { FeaturesService } from '@services/features.service';
|
||||
import { DOSSIERS_ARCHIVE } from '@utils/constants';
|
||||
@ -17,6 +17,10 @@ export class PermissionsService {
|
||||
return user.isAdmin;
|
||||
}
|
||||
|
||||
canDeleteEntity(entity: Dictionary, user = this._userService.currentUser): boolean {
|
||||
return this.canEditEntities(user) && !entity.systemManaged;
|
||||
}
|
||||
|
||||
canPerformDossierStatesActions(user = this._userService.currentUser): boolean {
|
||||
return user.isAdmin;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ export class Dictionary extends Entity<IDictionary> implements IDictionary {
|
||||
readonly type: string;
|
||||
readonly typeId?: string;
|
||||
readonly hasDictionary?: boolean;
|
||||
readonly systemManaged?: boolean;
|
||||
|
||||
entries: List;
|
||||
falsePositiveEntries: List;
|
||||
@ -39,6 +40,7 @@ export class Dictionary extends Entity<IDictionary> implements IDictionary {
|
||||
this.type = entity.type;
|
||||
this.typeId = entity.typeId;
|
||||
this.hasDictionary = entity.hasDictionary;
|
||||
this.systemManaged = entity.systemManaged;
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
|
||||
@ -55,4 +55,6 @@ export interface IDictionary {
|
||||
readonly recommendationHexColor?: string;
|
||||
|
||||
readonly hasDictionary?: boolean;
|
||||
|
||||
readonly systemManaged?: boolean;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user