mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
/**
|
|
* The contents of this file are subject to the license and copyright
|
|
* detailed in the LICENSE and NOTICE files at the root of the source
|
|
* tree and available online at
|
|
*
|
|
* http://www.dspace.org/license/
|
|
*/
|
|
|
|
import { Injectable } from '@angular/core';
|
|
import { combineLatest, map, Observable, } from 'rxjs';
|
|
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
|
|
import { FeatureID } from '../../../core/data/feature-authorization/feature-id';
|
|
import { MenuItemType } from '../menu-item-type.model';
|
|
import { LinkMenuItemModel } from '../menu-item/models/link.model';
|
|
import { AbstractMenuProvider, PartialMenuSection, } from '../menu-provider.model';
|
|
|
|
/**
|
|
* Menu provider to create the curation menu section
|
|
*/
|
|
@Injectable()
|
|
export class CurationMenuProvider extends AbstractMenuProvider {
|
|
constructor(
|
|
protected authorizationService: AuthorizationDataService,
|
|
) {
|
|
super();
|
|
}
|
|
|
|
public getSections(): Observable<PartialMenuSection[]> {
|
|
return combineLatest([
|
|
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
|
]).pipe(
|
|
map(([isSiteAdmin]) => {
|
|
return [
|
|
{
|
|
visible: isSiteAdmin,
|
|
model: {
|
|
type: MenuItemType.LINK,
|
|
text: 'menu.section.curation_task',
|
|
link: 'admin/curation-tasks',
|
|
} as LinkMenuItemModel,
|
|
icon: 'filter',
|
|
},
|
|
] as PartialMenuSection[];
|
|
}),
|
|
);
|
|
}
|
|
}
|