diff --git a/src/app/item-page/alerts/item-alerts.component.html b/src/app/item-page/alerts/item-alerts.component.html index b4665b38296..462895cd310 100644 --- a/src/app/item-page/alerts/item-alerts.component.html +++ b/src/app/item-page/alerts/item-alerts.component.html @@ -1,4 +1,4 @@ -
+
@@ -8,7 +8,7 @@ {{'item.alerts.withdrawn' | translate}}
-

+

{{"410.link.home-page" | translate}}

diff --git a/src/app/item-page/alerts/item-alerts.component.spec.ts b/src/app/item-page/alerts/item-alerts.component.spec.ts index a933eb6a589..62063890272 100644 --- a/src/app/item-page/alerts/item-alerts.component.spec.ts +++ b/src/app/item-page/alerts/item-alerts.component.spec.ts @@ -4,6 +4,8 @@ import { TranslateModule } from '@ngx-translate/core'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { Item } from '../../core/shared/item.model'; import { By } from '@angular/platform-browser'; +import {AuthorizationDataService} from '../../core/data/feature-authorization/authorization-data.service'; +import {AuthorizationDataServiceStub} from '../../shared/testing/authorization-service.stub'; describe('ItemAlertsComponent', () => { let component: ItemAlertsComponent; @@ -14,7 +16,10 @@ describe('ItemAlertsComponent', () => { TestBed.configureTestingModule({ declarations: [ItemAlertsComponent], imports: [TranslateModule.forRoot()], - schemas: [NO_ERRORS_SCHEMA] + schemas: [NO_ERRORS_SCHEMA], + providers: [ + { provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub } + ] }) .compileComponents(); })); diff --git a/src/app/item-page/alerts/item-alerts.component.ts b/src/app/item-page/alerts/item-alerts.component.ts index 2b1df58c9f7..77acd7d510a 100644 --- a/src/app/item-page/alerts/item-alerts.component.ts +++ b/src/app/item-page/alerts/item-alerts.component.ts @@ -1,6 +1,9 @@ -import { Component, Input } from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; import { Item } from '../../core/shared/item.model'; import { AlertType } from '../../shared/alert/alert-type'; +import {Observable} from 'rxjs'; +import {FeatureID} from '../../core/data/feature-authorization/feature-id'; +import {AuthorizationDataService} from '../../core/data/feature-authorization/authorization-data.service'; @Component({ selector: 'ds-item-alerts', @@ -10,7 +13,7 @@ import { AlertType } from '../../shared/alert/alert-type'; /** * Component displaying alerts for an item */ -export class ItemAlertsComponent { +export class ItemAlertsComponent implements OnInit { /** * The Item to display alerts for */ @@ -21,4 +24,13 @@ export class ItemAlertsComponent { * @type {AlertType} */ public AlertTypeEnum = AlertType; + + isAdministrator$: Observable; + + constructor(private authorizationService: AuthorizationDataService) { + } + + ngOnInit() { + this.isAdministrator$ = this.authorizationService.isAuthorized(FeatureID.AdministratorOf); + } }