@@ -31,11 +31,6 @@ import { ConfigurationDataService } from './core/data/configuration-data.service
3131import { AuthorizationDataService } from './core/data/feature-authorization/authorization-data.service' ;
3232import { FeatureID } from './core/data/feature-authorization/feature-id' ;
3333import { PaginatedList } from './core/data/paginated-list.model' ;
34- import {
35- METADATA_EXPORT_SCRIPT_NAME ,
36- METADATA_IMPORT_SCRIPT_NAME ,
37- ScriptDataService ,
38- } from './core/data/processes/script-data.service' ;
3934import { RemoteData } from './core/data/remote-data' ;
4035import { Section } from './core/layout/models/section.model' ;
4136import { SectionDataService } from './core/layout/section-data.service' ;
@@ -77,7 +72,6 @@ export class MenuResolverService {
7772 protected menuService : MenuService ,
7873 protected authorizationService : AuthorizationDataService ,
7974 protected modalService : NgbModal ,
80- protected scriptDataService : ScriptDataService ,
8175 protected configurationDataService : ConfigurationDataService ,
8276 protected authService : AuthService ,
8377 protected sectionDataService : SectionDataService ,
@@ -650,17 +644,8 @@ export class MenuResolverService {
650644 ] ;
651645 menuList . forEach ( ( menuSection ) => this . menuService . addSection ( MenuID . ADMIN , menuSection ) ) ;
652646
653- observableCombineLatest ( [
654- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
655- this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
656- this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
657- ] ) . pipe (
658- filter ( ( [ isAdmin , isCommunityAdmin , isCollectionAdmin ] ) =>
659- isAdmin || isCollectionAdmin || isCommunityAdmin ,
660- ) ,
661- take ( 1 ) ,
662- switchMap ( ( ) => this . scriptDataService . scriptWithNameExistsAndCanExecute ( METADATA_EXPORT_SCRIPT_NAME ) ) ,
663- filter ( ( metadataExportScriptExists : boolean ) => metadataExportScriptExists ) ,
647+ this . authorizationService . isAuthorized ( FeatureID . CanExportMetadata ) . pipe (
648+ filter ( ( canExport ) => canExport ) ,
664649 take ( 1 ) ,
665650 ) . subscribe ( ( ) => {
666651 // Hides the export menu for unauthorised people
@@ -783,17 +768,8 @@ export class MenuResolverService {
783768 const menuList = [ ] ;
784769 menuList . forEach ( ( menuSection ) => this . menuService . addSection ( MenuID . ADMIN , menuSection ) ) ;
785770
786- observableCombineLatest ( [
787- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
788- this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
789- this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
790- ] ) . pipe (
791- filter ( ( [ isAdmin , isCommunityAdmin , isCollectionAdmin ] ) =>
792- isAdmin || isCollectionAdmin || isCommunityAdmin ,
793- ) ,
794- take ( 1 ) ,
795- switchMap ( ( ) => this . scriptDataService . scriptWithNameExistsAndCanExecute ( METADATA_IMPORT_SCRIPT_NAME ) ) ,
796- filter ( ( metadataImportScriptExists : boolean ) => metadataImportScriptExists ) ,
771+ this . authorizationService . isAuthorized ( FeatureID . CanImportMetadata ) . pipe (
772+ filter ( ( canImport ) => canImport ) ,
797773 take ( 1 ) ,
798774 ) . subscribe ( ( ) => {
799775 // Hides the import menu for unauthorised people
0 commit comments