@@ -3,7 +3,7 @@ import { Component, Inject, OnInit } from '@angular/core';
33import { rendersContextMenuEntriesForType } from '../context-menu.decorator' ;
44import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model' ;
55import { ContextMenuEntryComponent } from '../context-menu-entry.component' ;
6- import { BehaviorSubject } from 'rxjs' ;
6+ import { BehaviorSubject , combineLatest } from 'rxjs' ;
77import { DSpaceObject } from '../../../core/shared/dspace-object.model' ;
88import { ContextMenuEntryType } from '../context-menu-entry-type' ;
99import { FeatureID } from '../../../core/data/feature-authorization/feature-id' ;
@@ -20,7 +20,7 @@ import { AuthorizationDataService } from '../../../core/data/feature-authorizati
2020@rendersContextMenuEntriesForType ( DSpaceObjectType . ITEM )
2121export class AuditItemMenuComponent extends ContextMenuEntryComponent implements OnInit {
2222
23- public isAdmin : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
23+ public isAuthorized : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
2424
2525 constructor (
2626 @Inject ( 'contextMenuObjectProvider' ) protected injectedContextMenuObject : DSpaceObject ,
@@ -31,8 +31,16 @@ export class AuditItemMenuComponent extends ContextMenuEntryComponent implements
3131 }
3232
3333 ngOnInit ( ) : void {
34- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf , undefined , undefined ) . pipe (
34+ combineLatest (
35+ [
36+ this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
37+ this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
38+ this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
39+ ]
40+ ) . pipe (
3541 take ( 1 )
36- ) . subscribe ( ( isAuthorized : boolean ) => ( this . isAdmin . next ( isAuthorized ) ) ) ;
42+ ) . subscribe ( ( [ isAdmin , isCollectionAdmin , isCommunityAdmin ] ) => {
43+ this . isAuthorized . next ( isAdmin || isCommunityAdmin || isCollectionAdmin ) ;
44+ } ) ;
3745 }
3846}
0 commit comments