From 6c6194ca42d4afcd0313614c3e28aea240190dce Mon Sep 17 00:00:00 2001 From: milanmajchrak <90026355+milanmajchrak@users.noreply.github.com> Date: Thu, 21 Dec 2023 09:19:18 +0100 Subject: [PATCH] ufal/fe-email-restricted-download (#430) * ClarinAuthorization passed, but vanilla not because of vanilla check - I added dtoken into vanilla authorization url and because of that the vanilla authorization will be passed. * Added message for the expiration token message - it was hardcoded. --- .../clarin-bitstream-download-page.component.ts | 4 +++- .../clarin-bitstream-token-expired.component.html | 2 +- src/assets/i18n/cs.json5 | 4 ++++ src/assets/i18n/en.json5 | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/bitstream-page/clarin-bitstream-download-page/clarin-bitstream-download-page.component.ts b/src/app/bitstream-page/clarin-bitstream-download-page/clarin-bitstream-download-page.component.ts index b9e5c356b35..04d2fe87bb9 100644 --- a/src/app/bitstream-page/clarin-bitstream-download-page/clarin-bitstream-download-page.component.ts +++ b/src/app/bitstream-page/clarin-bitstream-download-page/clarin-bitstream-download-page.component.ts @@ -85,7 +85,9 @@ export class ClarinBitstreamDownloadPageComponent implements OnInit { this.requestService.send(headRequest); const clarinIsAuthorized$ = this.rdbService.buildFromRequestUUID(requestId); - const isAuthorized$ = this.authorizationService.isAuthorized(FeatureID.CanDownload, isNotEmpty(bitstream) ? bitstream.self : undefined); + // Clarin authorization will check dtoken parameter from the request + const dtoken = isNotEmpty(this.dtoken) ? '?dtoken=' + this.dtoken : ''; + const isAuthorized$ = this.authorizationService.isAuthorized(FeatureID.CanDownload, isNotEmpty(bitstream) ? bitstream.self + dtoken : undefined); const isLoggedIn$ = this.auth.isAuthenticated(); return observableCombineLatest([clarinIsAuthorized$, isAuthorized$, isLoggedIn$, observableOf(bitstream)]); }), diff --git a/src/app/bitstream-page/clarin-bitstream-token-expired/clarin-bitstream-token-expired.component.html b/src/app/bitstream-page/clarin-bitstream-token-expired/clarin-bitstream-token-expired.component.html index 835832bb45a..ec0a094f6f2 100644 --- a/src/app/bitstream-page/clarin-bitstream-token-expired/clarin-bitstream-token-expired.component.html +++ b/src/app/bitstream-page/clarin-bitstream-token-expired/clarin-bitstream-token-expired.component.html @@ -1,5 +1,5 @@