WIP on dossier editor permissions
- added 'dossier info' button instead of 'edit dossier' when user is not a manager - disabled 'dossier info' tab when user is not a manager; - disabled 'download package' tab when user is not a manager;
This commit is contained in:
parent
a3b6d683a0
commit
46e9bb0f49
@ -5,6 +5,7 @@ import { EditDossierSaveResult, EditDossierSectionInterface } from '../edit-doss
|
||||
import { downloadTypesTranslations } from '../../../../../translations/download-types-translations';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { ReportTemplateService } from '@services/report-template.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-edit-dossier-download-package',
|
||||
@ -25,6 +26,7 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _reportTemplateController: ReportTemplateService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
) {}
|
||||
|
||||
get reportTypesLength() {
|
||||
@ -71,6 +73,9 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
||||
(await this._reportTemplateController.getAvailableReportTemplates(this.dossier.dossierTemplateId).toPromise()) || [];
|
||||
|
||||
this.form = this._getForm();
|
||||
if (!this._permissionsService.canEditDossier()) {
|
||||
this.form.disable();
|
||||
}
|
||||
}
|
||||
|
||||
async save(): EditDossierSaveResult {
|
||||
|
||||
@ -14,6 +14,7 @@ import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { EditDossierTeamComponent } from './edit-dossier-team/edit-dossier-team.component';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
|
||||
type Section = 'dossierInfo' | 'downloadPackage' | 'dossierDictionary' | 'members' | 'dossierAttributes' | 'deletedDocuments';
|
||||
|
||||
@ -41,6 +42,7 @@ export class EditDossierDialogComponent extends BaseDialogComponent {
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
private readonly _dialogRef: MatDialogRef<EditDossierDialogComponent>,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
private readonly _data: {
|
||||
dossierId: string;
|
||||
@ -109,7 +111,7 @@ export class EditDossierDialogComponent extends BaseDialogComponent {
|
||||
}
|
||||
|
||||
get showActionButtons(): boolean {
|
||||
return !['deletedDocuments'].includes(this.activeNav);
|
||||
return !['deletedDocuments'].includes(this.activeNav) && this._permissionsService.canEditDossier();
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
|
||||
@ -50,7 +50,13 @@
|
||||
</div>
|
||||
|
||||
<div class="due-date">
|
||||
<mat-checkbox (change)="hasDueDate = !hasDueDate" [checked]="hasDueDate" class="filter-menu-checkbox" color="primary">
|
||||
<mat-checkbox
|
||||
(change)="hasDueDate = !hasDueDate"
|
||||
[checked]="hasDueDate"
|
||||
[disabled]="!permissionsService.canEditDossier()"
|
||||
class="filter-menu-checkbox"
|
||||
color="primary"
|
||||
>
|
||||
{{ 'edit-dossier-dialog.general-info.form.due-date' | translate }}
|
||||
</mat-checkbox>
|
||||
|
||||
|
||||
@ -68,6 +68,9 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
||||
ngOnInit() {
|
||||
this._filterInvalidDossierTemplates();
|
||||
this.form = this._getForm();
|
||||
if (!this.permissionsService.canEditDossier()) {
|
||||
this.form.disable();
|
||||
}
|
||||
this.hasDueDate = !!this.dossier.dueDate;
|
||||
}
|
||||
|
||||
|
||||
@ -9,10 +9,10 @@
|
||||
>
|
||||
<iqser-circle-button
|
||||
(action)="openEditDossierDialog($event, dossier.dossierId)"
|
||||
*ngIf="currentUser.isManager"
|
||||
[tooltip]="'dossier-listing.edit.action' | translate"
|
||||
*ngIf="currentUser.isUser"
|
||||
[tooltip]="(currentUser.isManager ? 'dossier-listing.edit.action' : 'dossier-listing.dossier-info.action') | translate"
|
||||
[type]="circleButtonTypes.dark"
|
||||
icon="iqser:edit"
|
||||
[icon]="currentUser.isManager ? 'iqser:edit' : 'iqser:dossier-info'"
|
||||
iqserHelpMode="edit-dossier-from-list"
|
||||
></iqser-circle-button>
|
||||
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
<div class="label-header">
|
||||
<div class="all-caps-label">{{ label }}</div>
|
||||
<div class="actions">
|
||||
<div (click)="selectAll($event)" class="all-caps-label primary pointer" translate="actions.all"></div>
|
||||
<div (click)="deselectAll($event)" class="all-caps-label primary pointer" translate="actions.none"></div>
|
||||
<div (click)="selectAll($event)" class="all-caps-label primary pointer" [class.disabled]="disabled" translate="actions.all"></div>
|
||||
<div
|
||||
(click)="deselectAll($event)"
|
||||
class="all-caps-label primary pointer"
|
||||
[class.disabled]="disabled"
|
||||
translate="actions.none"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -69,3 +69,8 @@ mat-chip {
|
||||
.mat-standard-chip:focus::after {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
pointer-events: none;
|
||||
color: variables.$grey-5;
|
||||
}
|
||||
|
||||
@ -122,6 +122,10 @@ export class PermissionsService {
|
||||
return dossier.ownerId === this._userService.currentUser.id;
|
||||
}
|
||||
|
||||
canEditDossier(user = this._userService.currentUser) {
|
||||
return user.isManager;
|
||||
}
|
||||
|
||||
isAdmin(user = this._userService.currentUser): boolean {
|
||||
return user.isAdmin;
|
||||
}
|
||||
|
||||
@ -632,6 +632,9 @@
|
||||
"action": "Delete Dossier",
|
||||
"delete-failed": "Failed to delete dossier: {dossierName}"
|
||||
},
|
||||
"dossier-info": {
|
||||
"action": "Dossier Info"
|
||||
},
|
||||
"edit": {
|
||||
"action": "Edit Dossier"
|
||||
},
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 0610684e8fb963fab1f7dd51fd850a7b47287fca
|
||||
Subproject commit 45a12070bfe5c9aa36f24c4e08da157796e881ab
|
||||
Loading…
x
Reference in New Issue
Block a user