|
1 | 1 | import { Injectable } from '@angular/core'; |
2 | 2 | import { ActivatedRoute, ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router'; |
3 | | -import { combineLatest as observableCombineLatest, Observable } from 'rxjs'; |
| 3 | +import { combineLatest, combineLatest as observableCombineLatest, Observable } from 'rxjs'; |
4 | 4 | import { MenuID } from './shared/menu/menu-id.model'; |
5 | 5 | import { MenuState } from './shared/menu/menu-state.model'; |
6 | 6 | import { MenuItemType } from './shared/menu/menu-item-type.model'; |
@@ -532,8 +532,14 @@ export class MenuResolver implements Resolve<boolean> { |
532 | 532 | ]; |
533 | 533 | menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, menuSection)); |
534 | 534 |
|
535 | | - this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe( |
536 | | - filter((authorized: boolean) => authorized), |
| 535 | + combineLatest([ |
| 536 | + this.authorizationService.isAuthorized(FeatureID.AdministratorOf), |
| 537 | + this.authorizationService.isAuthorized(FeatureID.IsCommunityAdmin), |
| 538 | + this.authorizationService.isAuthorized(FeatureID.IsCollectionAdmin), |
| 539 | + ]).pipe( |
| 540 | + filter(([isAdmin, isCommunityAdmin, isCollectionAdmin]) => |
| 541 | + isAdmin || isCollectionAdmin || isCommunityAdmin |
| 542 | + ), |
537 | 543 | take(1), |
538 | 544 | switchMap(() => this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_EXPORT_SCRIPT_NAME)), |
539 | 545 | filter((metadataExportScriptExists: boolean) => metadataExportScriptExists), |
@@ -659,8 +665,14 @@ export class MenuResolver implements Resolve<boolean> { |
659 | 665 | const menuList = []; |
660 | 666 | menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, menuSection)); |
661 | 667 |
|
662 | | - this.authorizationService.isAuthorized(FeatureID.AdministratorOf).pipe( |
663 | | - filter((authorized: boolean) => authorized), |
| 668 | + combineLatest([ |
| 669 | + this.authorizationService.isAuthorized(FeatureID.AdministratorOf), |
| 670 | + this.authorizationService.isAuthorized(FeatureID.IsCommunityAdmin), |
| 671 | + this.authorizationService.isAuthorized(FeatureID.IsCollectionAdmin), |
| 672 | + ]).pipe( |
| 673 | + filter(([isAdmin, isCommunityAdmin, isCollectionAdmin]) => |
| 674 | + isAdmin || isCollectionAdmin || isCommunityAdmin |
| 675 | + ), |
664 | 676 | take(1), |
665 | 677 | switchMap(() => this.scriptDataService.scriptWithNameExistsAndCanExecute(METADATA_IMPORT_SCRIPT_NAME)), |
666 | 678 | filter((metadataImportScriptExists: boolean) => metadataImportScriptExists), |
|
0 commit comments