File tree Expand file tree Collapse file tree
item-page/full/field-components/file-section
themes/custom/app/item-page/full/field-components/file-section Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ <h3 class="h5 simple-view-element-header">{{"item.page.filesection.original.bund
3333 </ dl >
3434 </ div >
3535 < div *ngIf ="!hasNoDownload(file) " class ="col-2 ">
36- < ds-file-download-link [showIcon] ="(canDownload( file) | async) === false " [bitstream] ="file " [item] ="item ">
36+ < ds-file-download-link [showIcon] ="(file.self | dsCanDownloadFile | async) === false " [bitstream] ="file " [item] ="item ">
3737 {{"item.page.filesection.download" | translate}}
3838 </ ds-file-download-link >
3939 </ div >
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import { MetadataFieldWrapperComponent } from '../../../../shared/metadata-field
4242import { NotificationsService } from '../../../../shared/notifications/notifications.service' ;
4343import { PaginationComponent } from '../../../../shared/pagination/pagination.component' ;
4444import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model' ;
45+ import { CanDownloadFilePipe } from '../../../../shared/utils/can-download-file.pipe' ;
4546import { FileSizePipe } from '../../../../shared/utils/file-size-pipe' ;
4647import { followLink } from '../../../../shared/utils/follow-link-config.model' ;
4748import { VarDirective } from '../../../../shared/utils/var.directive' ;
@@ -68,6 +69,7 @@ import { FileSectionComponent } from '../../../simple/field-components/file-sect
6869 ThemedFileDownloadLinkComponent ,
6970 FileSizePipe ,
7071 MetadataFieldWrapperComponent ,
72+ CanDownloadFilePipe ,
7173 ] ,
7274 standalone : true ,
7375} )
Original file line number Diff line number Diff line change 1+ import {
2+ Pipe ,
3+ PipeTransform ,
4+ } from '@angular/core' ;
5+ import { Observable } from 'rxjs' ;
6+
7+ import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service' ;
8+ import { FeatureID } from '../../core/data/feature-authorization/feature-id' ;
9+
10+ @Pipe ( {
11+ name : 'dsCanDownloadFile' ,
12+ standalone : true ,
13+ } )
14+ export class CanDownloadFilePipe implements PipeTransform {
15+ constructor ( private authorizationServcie : AuthorizationDataService ) {
16+ }
17+ transform ( href : string ) : Observable < boolean > {
18+ return this . authorizationServcie . isAuthorized ( FeatureID . CanDownload , href ) ;
19+ }
20+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { FullFileSectionComponent as BaseComponent } from '../../../../../../../
1010import { ThemedFileDownloadLinkComponent } from '../../../../../../../app/shared/file-download-link/themed-file-download-link.component' ;
1111import { MetadataFieldWrapperComponent } from '../../../../../../../app/shared/metadata-field-wrapper/metadata-field-wrapper.component' ;
1212import { PaginationComponent } from '../../../../../../../app/shared/pagination/pagination.component' ;
13+ import { CanDownloadFilePipe } from '../../../../../../../app/shared/utils/can-download-file.pipe' ;
1314import { FileSizePipe } from '../../../../../../../app/shared/utils/file-size-pipe' ;
1415import { VarDirective } from '../../../../../../../app/shared/utils/var.directive' ;
1516import { ThemedThumbnailComponent } from '../../../../../../../app/thumbnail/themed-thumbnail.component' ;
@@ -32,6 +33,7 @@ import { ThemedThumbnailComponent } from '../../../../../../../app/thumbnail/the
3233 ThemedFileDownloadLinkComponent ,
3334 FileSizePipe ,
3435 MetadataFieldWrapperComponent ,
36+ CanDownloadFilePipe ,
3537 ] ,
3638} )
3739export class FullFileSectionComponent extends BaseComponent {
You can’t perform that action at this time.
0 commit comments