From f10e3488e1693cf7564bdefe5783af7ffa8cf4b5 Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 17 May 2021 13:21:02 +0300 Subject: [PATCH] dossier dictionary can be edited by anyone --- .../dictionary-overview-screen.component.html | 1 + .../dossier-dictionary-dialog.component.html | 3 ++- .../dossier-dictionary-dialog.component.ts | 8 +++++++- .../dictionary-manager/dictionary-manager.component.html | 4 ++-- .../dictionary-manager/dictionary-manager.component.ts | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html index 172710bbd..b84126c73 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.html @@ -57,6 +57,7 @@ diff --git a/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.html b/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.html index 870b6adfa..76e9212cf 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.html +++ b/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.html @@ -6,12 +6,13 @@
- diff --git a/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.ts index 21e4cd537..efe8ecd7c 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/dossier-dictionary-dialog/dossier-dictionary-dialog.component.ts @@ -4,6 +4,7 @@ import { ProjectWrapper } from '../../../../state/model/project.wrapper'; import { DictionaryManagerComponent } from '../../../shared/components/dictionary-manager/dictionary-manager.component'; import { DictionarySaveService } from '../../../shared/services/dictionary-save.service'; import { AppStateService } from '../../../../state/app-state.service'; +import { PermissionsService } from '../../../../services/permissions.service'; @Component({ selector: 'redaction-dossier-dictionary-dialog', @@ -13,12 +14,17 @@ import { AppStateService } from '../../../../state/app-state.service'; export class DossierDictionaryDialogComponent { @ViewChild('dictionaryManager', { static: false }) private _dictionaryManager: DictionaryManagerComponent; + canEdit: boolean = false; + constructor( + public permissionsService: PermissionsService, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public project: ProjectWrapper, private readonly _appStateService: AppStateService, private readonly _dictionarySaveService: DictionarySaveService - ) {} + ) { + this.canEdit = this.permissionsService.isProjectMember(this.project); + } saveDossierDictionary() { this._dictionarySaveService diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html index 829b735e8..8c67ecbf3 100644 --- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html +++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html @@ -52,7 +52,7 @@ [autoUpdateContent]="true" [mode]="'text'" [options]="aceOptions" - [readOnly]="!permissionsService.isAdmin()" + [readOnly]="!canEdit" [theme]="'eclipse'" class="ace-redaction" > @@ -73,7 +73,7 @@
-
+
diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts index ff9f5e2cd..290d57539 100644 --- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts @@ -24,6 +24,9 @@ export class DictionaryManagerComponent implements OnInit, OnChanges { @Input() initialDictionaryEntries: string[]; + @Input() + canEdit: boolean = false; + @Output() saveDictionary = new EventEmitter(); @@ -47,7 +50,6 @@ export class DictionaryManagerComponent implements OnInit, OnChanges { @ViewChild('compareEditorComponent') private _compareEditorComponent: AceEditorComponent; constructor( - readonly permissionsService: PermissionsService, private readonly _notificationService: NotificationService, protected readonly _translateService: TranslateService, private readonly _dictionaryControllerService: DictionaryControllerService,