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 @@
-

The download token is expired, you will be redirected to the download page.

+

{{'clarin.bitstream.expired.dtoken.message' | translate}}

diff --git a/src/assets/i18n/cs.json5 b/src/assets/i18n/cs.json5 index 758f92a42bb..d806f54d5f1 100644 --- a/src/assets/i18n/cs.json5 +++ b/src/assets/i18n/cs.json5 @@ -1039,6 +1039,10 @@ // "clarin.license.agreement.notification.cannot.send.email": "Error: cannot send the email.", "clarin.license.agreement.notification.cannot.send.email": "Error: cannot send the email.", + + // "clarin.bitstream.expired.dtoken.message": "The download token is expired, you will be redirected to the download page.", + "clarin.bitstream.expired.dtoken.message": "Platnost tokenu pro stahování vypršel, budete přesměrováni na stránku stahování.", + // "bitstream.download.page.back": "Back" , "bitstream.download.page.back" : "Zpět", diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index ee5775d97fc..233f1e9ff9f 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -713,6 +713,9 @@ "clarin.license.agreement.notification.check.email": "You will receive email with download link.", "clarin.license.agreement.notification.cannot.send.email": "Error: cannot send the email.", + + "clarin.bitstream.expired.dtoken.message": "The download token is expired, you will be redirected to the download page.", + "bitstream.download.page.back": "Back" ,