From 48a3e1202fc4a011f5e8646f6c7d2afbb497e4df Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Thu, 21 Nov 2019 12:37:03 +0100
Subject: [PATCH] FEAT #11691 TIME 0:10 add privilege  update attachment

---
 .../attachments-page/attachment-page.component.ts           | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/frontend/app/attachments/attachments-page/attachment-page.component.ts b/src/frontend/app/attachments/attachments-page/attachment-page.component.ts
index cfc4aa549a7..5c4b2440493 100644
--- a/src/frontend/app/attachments/attachments-page/attachment-page.component.ts
+++ b/src/frontend/app/attachments/attachments-page/attachment-page.component.ts
@@ -10,6 +10,7 @@ import { SortPipe } from '../../../plugins/sorting.pipe';
 import { FormControl, Validators } from '@angular/forms';
 import { DocumentViewerComponent } from '../../viewer/document-viewer.component';
 import { PrivilegeService } from '../../../service/privileges.service';
+import { HeaderService } from '../../../service/header.service';
 
 @Component({
     selector: 'app-attachment-page',
@@ -43,6 +44,7 @@ export class AttachmentPageComponent implements OnInit {
         public appService: AppService,
         private notify: NotificationService,
         private sortPipe: SortPipe,
+        private headerService: HeaderService,
         private privilegeService: PrivilegeService) {
     }
 
@@ -65,7 +67,7 @@ export class AttachmentPageComponent implements OnInit {
             tap((data: any) => {
                 //this.attachment = data;
 
-                if (this.privilegeService.hasCurrentUserPrivilege('manage_attachments') && data.status !== 'SIGN') {
+                if ((this.privilegeService.hasCurrentUserPrivilege('manage_attachments') || this.headerService.user.id === data.typist)  && data.status !== 'SIGN') {
                     this.editMode = true;
                 }
 
@@ -144,8 +146,6 @@ export class AttachmentPageComponent implements OnInit {
     getAttachmentValues(newAttachment: boolean = false) {
         let attachmentValues = {};
         Object.keys(this.attachment).forEach(element => {
-            console.log(element);
-            console.log(this.attachment[element]);
             if (this.attachment[element] !== undefined && (this.attachment[element].value !== null && this.attachment[element].value !== undefined)) {
                 if (element === 'validationDate') {
                     let day = this.attachment[element].value.getDate();
-- 
GitLab