@@ -93,15 +93,13 @@ export class BitstreamDownloadPageComponent implements OnInit {
9393 map ( ( data ) => data . bitstream ) ) ;
9494
9595 this . bitstream$ = this . bitstreamRD$ . pipe (
96- // TODO: this redirect was commented out earlier...
9796 redirectOn4xx ( this . router , this . auth ) ,
9897 getRemoteDataPayload ( ) ,
9998 ) ;
10099
101100 this . bitstream$ . pipe (
102101 switchMap ( ( bitstream : Bitstream ) => {
103102 const isAuthorized$ = this . authorizationService . isAuthorized ( FeatureID . CanDownload , isNotEmpty ( bitstream ) ? bitstream . self : undefined ) ;
104- // TODO isAuthorizedByToken check here so we already know if this token is going to be valid?
105103 const isLoggedIn$ = this . auth . isAuthenticated ( ) ;
106104 return observableCombineLatest ( [ isAuthorized$ , isLoggedIn$ , accessToken$ , observableOf ( bitstream ) ] ) ;
107105 } ) ,
@@ -116,32 +114,12 @@ export class BitstreamDownloadPageComponent implements OnInit {
116114 return [ isAuthorized , isLoggedIn , bitstream , fileLink ] ;
117115 } ) ) ;
118116 } else if ( hasValue ( accessToken ) ) {
119- // We aren't authorized or logged in, but we might have temp access via the access token
120- console . log ( 'RETRIEVE WITH ACCESS TOKEN' ) ;
121- console . log ( 'BUT - we dont want to retrieve the link with access token eh bro' ) ;
122- // return this.fileService.retrieveFileDownloadLinkWithAccessToken(bitstream._links.content.href, accessToken).pipe(
123- // filter((fileLink) => hasValue(fileLink)),
124- // take(1),
125- // map((fileLink) => {
126- // return [isAuthorized, isLoggedIn, bitstream, fileLink];
127- // }));
128117 return [ [ isAuthorized , ! isLoggedIn , bitstream , '' , accessToken ] ] ;
129118 } else {
130119 return [ [ isAuthorized , isLoggedIn , bitstream , '' ] ] ;
131120 }
132121 } ) ,
133122 ) . subscribe ( ( [ isAuthorized , isLoggedIn , bitstream , fileLink , accessToken ] : [ boolean , boolean , Bitstream , string , string ] ) => {
134- // if (isAuthorized && isLoggedIn && isNotEmpty(fileLink)) {
135- // this.hardRedirectService.redirect(fileLink);
136- // } else if (isAuthorized && !isLoggedIn) {
137- // this.hardRedirectService.redirect(bitstream._links.content.href);
138- // } else if (!isAuthorized && isLoggedIn) {
139- // this.router.navigateByUrl(getForbiddenRoute(), {skipLocationChange: true});
140- // } else if (!isAuthorized && !isLoggedIn) {
141- // this.auth.setRedirectUrl(this.router.url);
142- // this.router.navigateByUrl('login');
143- // }
144-
145123 if ( isAuthorized && isLoggedIn && isNotEmpty ( fileLink ) ) {
146124 this . hardRedirectService . redirect ( fileLink ) ;
147125 } else if ( isAuthorized && ! isLoggedIn && ! hasValue ( accessToken ) ) {
0 commit comments