From 6cb8d3cae533997d790391e01ae0d737f72830f7 Mon Sep 17 00:00:00 2001 From: Hassane Diaby Date: Thu, 3 Oct 2024 17:11:19 +0200 Subject: [PATCH] bug #13206 : non-downloadable signed documents for collect --- .../archive-unit-information-tab.component.html | 6 +++++- .../archive-unit-information-tab.component.ts | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.html index 717d69c426a..f1477ac02fd 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.html @@ -106,7 +106,11 @@
- diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.ts index ed614951281..242230fdacb 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-information-tab/archive-unit-information-tab.component.ts @@ -37,7 +37,7 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Observable } from 'rxjs'; -import { Unit } from 'ui-frontend-common'; +import { TenantSelectionService, Unit } from 'ui-frontend-common'; import { ArchiveCollectService } from '../../archive-collect.service'; @Component({ @@ -52,8 +52,12 @@ export class ArchiveUnitInformationTabComponent implements OnInit, OnChanges { uaPath$: Observable<{ fullPath: string; resumePath: string }>; fullPath = false; + hasDownloadDocumentRole = false; - constructor(private archiveService: ArchiveCollectService) {} + constructor( + private archiveService: ArchiveCollectService, + private tenantSelectionService: TenantSelectionService, + ) {} ngOnInit() { // TODO : Créer Web service de création du chemin d'archive @@ -61,6 +65,7 @@ export class ArchiveUnitInformationTabComponent implements OnInit, OnChanges { } ngOnChanges(changes: SimpleChanges): void { + this.checkDownloadPermissions(); if (changes.archiveUnit?.currentValue['#id']) { // TODO : Créer Web service de création du chemin d'archive // this.uaPath$ = this.archiveService.buildArchiveUnitPath(this.archiveUnit, this.accessContract); @@ -75,4 +80,12 @@ export class ArchiveUnitInformationTabComponent implements OnInit, OnChanges { showArchiveUniteFullPath() { this.fullPath = true; } + + private checkDownloadPermissions() { + this.archiveService + .hasCollectRole('ROLE_COLLECT_GET_ARCHIVE_BINARY', this.tenantSelectionService.getSelectedTenant().identifier) + .subscribe((result) => { + this.hasDownloadDocumentRole = result; + }); + } }