From b88380d44e16c823994fc6d957bc15006a085a8b Mon Sep 17 00:00:00 2001 From: Alicia de Dios Fuente <Alicia.DeDiosFuente@unige.ch> Date: Tue, 5 Nov 2019 16:18:04 +0100 Subject: [PATCH] fix: forbidden download archive in access module if not connected --- .../home-archive-detail.presentational.html | 1 + .../home-archive-form/home-archive-detail.presentational.ts | 6 +++++- .../routables/home-detail/home-detail.routable.html | 1 + .../routables/home-detail/home-detail.routable.ts | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html index 6974cc868..5d2c2de49 100644 --- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html +++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html @@ -32,6 +32,7 @@ <button mat-flat-button [dlcmButtonSpinner]="isLoadingPrepareDownload" color="primary" + *ngIf="isLoggedIn" (click)="download(archiveMetadata)" > <mat-icon>play_for_work</mat-icon> diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts index 06888d946..df2cfdbb5 100644 --- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts +++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts @@ -10,6 +10,7 @@ import {AccessOrganizationalUnit} from "@app/generated-api"; import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational"; import {ArchiveMetadata} from "@app/shared/models/business/archive-metadata.model"; import {MetadataUtil} from "@app/shared/utils/metadata.util"; +import {LocalStateModel} from "@shared/models/local-state.model"; import { BehaviorSubject, Observable, @@ -45,8 +46,11 @@ export class HomeArchiveDetailPresentational extends SharedAbstractPresentationa @Input() isLoadingPrepareDownload: boolean; - showCode: boolean = false; + @Input() + isLoggedIn: boolean; + showCode: boolean = false; + ngOnInit(): void { const metadata = this.archiveMetadata.metadata; this.listInfo = [ diff --git a/src/app/features/home/components/routables/home-detail/home-detail.routable.html b/src/app/features/home/components/routables/home-detail/home-detail.routable.html index 0939ee98b..b73b1d323 100644 --- a/src/app/features/home/components/routables/home-detail/home-detail.routable.html +++ b/src/app/features/home/components/routables/home-detail/home-detail.routable.html @@ -4,6 +4,7 @@ [searchScope]="searchScopeObs | async" [organizationalUnit]="organizationalUnitObs | async" [isLoadingPrepareDownload]="isLoadingPrepareDownloadObs | async" + [isLoggedIn]="isLoggedInObs | async" (downloadChange)="download($event)" ></dlcm-home-archive-detail> </div> diff --git a/src/app/features/home/components/routables/home-detail/home-detail.routable.ts b/src/app/features/home/components/routables/home-detail/home-detail.routable.ts index 09bccec86..6cf4e830e 100644 --- a/src/app/features/home/components/routables/home-detail/home-detail.routable.ts +++ b/src/app/features/home/components/routables/home-detail/home-detail.routable.ts @@ -38,6 +38,7 @@ export class HomeDetailRoutable extends SharedAbstractPresentational implements @Select(HomeState.searchScope) searchScopeObs: Observable<SearchScopeEnum>; @Select((state: LocalStateModel) => state.home.home_organizationalUnit.current) organizationalUnitObs: Observable<AccessOrganizationalUnit>; @Select(HomeState) stateObs: AccessOrganizationalUnit; + @Select((state: LocalStateModel) => state.application.isLoggedIn) isLoggedInObs: Observable<boolean>; isLoadingOrgUnitObs: Observable<boolean>; private _resId: string; -- GitLab