Permissions
This commit is contained in:
parent
427b0a9402
commit
c8906a04fc
@ -1,4 +1,4 @@
|
||||
<form *ngIf="attributesForm" [formGroup]="attributesForm">
|
||||
<form (submit)="save()" *ngIf="attributesForm" [formGroup]="attributesForm">
|
||||
<div>
|
||||
<div *ngIf="customAttributes.length" class="heading">
|
||||
{{ 'edit-dossier-dialog.attributes.custom-attributes' | translate }}
|
||||
@ -53,6 +53,7 @@
|
||||
<redaction-icon-button
|
||||
(action)="fileInputClick(attr)"
|
||||
*ngIf="!currentAttrValue(attr)"
|
||||
[disabled]="!canEdit"
|
||||
class="upload-button"
|
||||
icon="red:upload"
|
||||
text="edit-dossier-dialog.attributes.upload-image"
|
||||
@ -70,7 +71,7 @@
|
||||
type="file"
|
||||
/>
|
||||
</div>
|
||||
<div *ngIf="currentAttrValue(attr)">
|
||||
<div *ngIf="currentAttrValue(attr) && canEdit">
|
||||
<redaction-circle-button
|
||||
(action)="deleteAttr(attr)"
|
||||
icon="red:trash"
|
||||
|
||||
@ -50,6 +50,10 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
||||
return !this._permissionsService.isOwner(this.dossierWrapper);
|
||||
}
|
||||
|
||||
get canEdit(): boolean {
|
||||
return this._permissionsService.isOwner(this.dossierWrapper);
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this._loadingService.start();
|
||||
await this._loadAttributes();
|
||||
@ -137,7 +141,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
||||
private _initForm() {
|
||||
const controlsConfig = {};
|
||||
for (const attribute of this.attributes) {
|
||||
controlsConfig[attribute.id] = attribute.value;
|
||||
controlsConfig[attribute.id] = [{ value: attribute.value, disabled: !this.canEdit }];
|
||||
}
|
||||
this.attributesForm = this._formBuilder.group(controlsConfig);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user