@@ -40,11 +40,8 @@ import {
4040} from './shared/dso-selector/modal-wrappers/export-metadata-xls-selector/export-metadata-xls-selector.component' ;
4141import { AuthorizationDataService } from './core/data/feature-authorization/authorization-data.service' ;
4242import { NgbModal } from '@ng-bootstrap/ng-bootstrap' ;
43- import {
44- METADATA_EXPORT_SCRIPT_NAME ,
45- METADATA_IMPORT_SCRIPT_NAME ,
46- ScriptDataService
47- } from './core/data/processes/script-data.service' ;
43+
44+
4845import {
4946 ExportBatchSelectorComponent
5047} from './shared/dso-selector/modal-wrappers/export-batch-selector/export-batch-selector.component' ;
@@ -73,7 +70,6 @@ export class MenuResolver implements Resolve<boolean> {
7370 protected menuService : MenuService ,
7471 protected authorizationService : AuthorizationDataService ,
7572 protected modalService : NgbModal ,
76- protected scriptDataService : ScriptDataService ,
7773 protected authService : AuthService ,
7874 protected sectionDataService : SectionDataService ,
7975 protected configService : ConfigurationDataService ,
@@ -561,18 +557,9 @@ export class MenuResolver implements Resolve<boolean> {
561557 ] ;
562558 menuList . forEach ( ( menuSection ) => this . menuService . addSection ( MenuID . ADMIN , menuSection ) ) ;
563559
564- observableCombineLatest ( [
565- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
566- this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
567- this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
568- ] ) . pipe (
569- filter ( ( [ isAdmin , isCommunityAdmin , isCollectionAdmin ] ) =>
570- isAdmin || isCollectionAdmin || isCommunityAdmin
571- ) ,
560+ this . authorizationService . isAuthorized ( FeatureID . CanExportMetadata ) . pipe (
561+ filter ( ( canExport ) => canExport ) ,
572562 take ( 1 ) ,
573- switchMap ( ( ) => this . scriptDataService . scriptWithNameExistsAndCanExecute ( METADATA_EXPORT_SCRIPT_NAME ) ) ,
574- filter ( ( metadataExportScriptExists : boolean ) => metadataExportScriptExists ) ,
575- take ( 1 )
576563 ) . subscribe ( ( ) => {
577564 // Hides the export menu for unauthorised people
578565 // If in the future more sub-menus are added,
@@ -694,18 +681,9 @@ export class MenuResolver implements Resolve<boolean> {
694681 const menuList = [ ] ;
695682 menuList . forEach ( ( menuSection ) => this . menuService . addSection ( MenuID . ADMIN , menuSection ) ) ;
696683
697- observableCombineLatest ( [
698- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
699- this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
700- this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
701- ] ) . pipe (
702- filter ( ( [ isAdmin , isCommunityAdmin , isCollectionAdmin ] ) =>
703- isAdmin || isCollectionAdmin || isCommunityAdmin
704- ) ,
684+ this . authorizationService . isAuthorized ( FeatureID . CanImportMetadata ) . pipe (
685+ filter ( ( canImport ) => canImport ) ,
705686 take ( 1 ) ,
706- switchMap ( ( ) => this . scriptDataService . scriptWithNameExistsAndCanExecute ( METADATA_IMPORT_SCRIPT_NAME ) ) ,
707- filter ( ( metadataImportScriptExists : boolean ) => metadataImportScriptExists ) ,
708- take ( 1 )
709687 ) . subscribe ( ( ) => {
710688 // Hides the import menu for unauthorised people
711689 // If in the future more sub-menus are added,
0 commit comments