Skip to content

Commit

Permalink
ufal/fe-email-restricted-download (#430)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
milanmajchrak committed Jun 19, 2024
1 parent c575606 commit 6c6194c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="jumbotron jumbotron-fluid bg-clarin-red rounded">
<div class="container">
<h1 class="display-4 px-3 py-3">The download token is expired, you will be redirected to the download page.</h1>
<h1 class="display-4 px-3 py-3">{{'clarin.bitstream.expired.dtoken.message' | translate}}</h1>
</div>
</div>
4 changes: 4 additions & 0 deletions src/assets/i18n/cs.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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" ,


Expand Down

0 comments on commit 6c6194c

Please sign in to comment.