@@ -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' ;
@@ -72,7 +69,6 @@ export class MenuResolver implements Resolve<boolean> {
7269 protected menuService : MenuService ,
7370 protected authorizationService : AuthorizationDataService ,
7471 protected modalService : NgbModal ,
75- protected scriptDataService : ScriptDataService ,
7672 protected sectionDataService : SectionDataService ,
7773 protected configService : ConfigurationDataService ,
7874 ) {
@@ -549,18 +545,9 @@ export class MenuResolver implements Resolve<boolean> {
549545 ] ;
550546 menuList . forEach ( ( menuSection ) => this . menuService . addSection ( MenuID . ADMIN , menuSection ) ) ;
551547
552- observableCombineLatest ( [
553- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
554- this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
555- this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
556- ] ) . pipe (
557- filter ( ( [ isAdmin , isCommunityAdmin , isCollectionAdmin ] ) =>
558- isAdmin || isCollectionAdmin || isCommunityAdmin
559- ) ,
548+ this . authorizationService . isAuthorized ( FeatureID . CanExportMetadata ) . pipe (
549+ filter ( ( canExport ) => canExport ) ,
560550 take ( 1 ) ,
561- switchMap ( ( ) => this . scriptDataService . scriptWithNameExistsAndCanExecute ( METADATA_EXPORT_SCRIPT_NAME ) ) ,
562- filter ( ( metadataExportScriptExists : boolean ) => metadataExportScriptExists ) ,
563- take ( 1 )
564551 ) . subscribe ( ( ) => {
565552 // Hides the export menu for unauthorised people
566553 // If in the future more sub-menus are added,
@@ -682,18 +669,9 @@ export class MenuResolver implements Resolve<boolean> {
682669 const menuList = [ ] ;
683670 menuList . forEach ( ( menuSection ) => this . menuService . addSection ( MenuID . ADMIN , menuSection ) ) ;
684671
685- observableCombineLatest ( [
686- this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) ,
687- this . authorizationService . isAuthorized ( FeatureID . IsCommunityAdmin ) ,
688- this . authorizationService . isAuthorized ( FeatureID . IsCollectionAdmin ) ,
689- ] ) . pipe (
690- filter ( ( [ isAdmin , isCommunityAdmin , isCollectionAdmin ] ) =>
691- isAdmin || isCollectionAdmin || isCommunityAdmin
692- ) ,
672+ this . authorizationService . isAuthorized ( FeatureID . CanImportMetadata ) . pipe (
673+ filter ( ( canImport ) => canImport ) ,
693674 take ( 1 ) ,
694- switchMap ( ( ) => this . scriptDataService . scriptWithNameExistsAndCanExecute ( METADATA_IMPORT_SCRIPT_NAME ) ) ,
695- filter ( ( metadataImportScriptExists : boolean ) => metadataImportScriptExists ) ,
696- take ( 1 )
697675 ) . subscribe ( ( ) => {
698676 // Hides the import menu for unauthorised people
699677 // If in the future more sub-menus are added,
0 commit comments