From 3ed5df32aef6f9d9007d6bd9721df1c847d3f69b Mon Sep 17 00:00:00 2001
From: Joseph AKEL <joseph.akel@maarch.org>
Date: Mon, 26 Jun 2023 10:48:06 +0200
Subject: [PATCH] FIX #25530 05:25 Allowing the initiator to access the
 "ACTIONS" button

---
 src/frontend/app/search/search.component.html | 6 +++---
 src/frontend/app/search/search.component.ts   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/frontend/app/search/search.component.html b/src/frontend/app/search/search.component.html
index f49702a696..11cbc4ed92 100644
--- a/src/frontend/app/search/search.component.html
+++ b/src/frontend/app/search/search.component.html
@@ -35,7 +35,7 @@
                             <ion-icon name="swap-horizontal-outline"></ion-icon>
                             <ion-label>{{ item.label | translate}}</ion-label>
                             <ion-icon name="close-circle"></ion-icon>
-                            
+
                         </ion-chip>
                     </div>
                     <div *ngIf="currentFilter.id === 'workflowUsers' && currentFilter.val.length > 0">
@@ -149,7 +149,7 @@
                                 {{'lang.download' | translate}}
                             </ion-item-option>
                             <ion-item-option *ngIf="element.status !== 'HARD_DEL'" color="primary"
-                                [disabled]="!isValidPrivilege()" (click)="openActions(element)">
+                                [disabled]="!isValidPrivilege(element)" (click)="openActions(element)">
                                 <ion-icon slot="bottom" name="settings-sharp"></ion-icon>
                                 {{'lang.actions' | translate}}
                             </ion-item-option>
@@ -210,4 +210,4 @@
             </ion-button>
         </div>
     </ion-footer>
-</ng-template>
\ No newline at end of file
+</ng-template>
diff --git a/src/frontend/app/search/search.component.ts b/src/frontend/app/search/search.component.ts
index bbf4444e37..57d92bdd60 100644
--- a/src/frontend/app/search/search.component.ts
+++ b/src/frontend/app/search/search.component.ts
@@ -595,8 +595,8 @@ export class SearchComponent implements OnInit {
         return '';
     }
 
-    isValidPrivilege(): boolean {
+    isValidPrivilege(element): boolean {
         const privileges: string [] = this.authService.user.appPrivileges?.map((item: any) => item.id);
-        return privileges.indexOf('indexation') > -1 && privileges.indexOf('manage_documents') > -1;
+        return (element.typist === this.authService.user.id) || (privileges.indexOf('indexation') > -1 && privileges.indexOf('manage_documents') > -1);
     }
 }
-- 
GitLab