import {Component, Input, OnInit} from '@angular/core'; import {Session, User} from "../../../login/utils/helper.class"; import {UserManagementService} from "../../../services/user-management.service"; import {Subscriber} from "rxjs"; import {ActivatedRoute} from "@angular/router"; @Component({ selector: 'admin-tabs', template: `
` }) export class AdminTabsComponent implements OnInit { @Input() public type: 'community' | 'stakeholder' = null; @Input() portal = null; @Input() public user: User; @Input() public tab: "portal" | "page" | "entity" | "menu" | "class" | "customization" | "template" = 'page'; private subscriptions: any[] = []; constructor(private route: ActivatedRoute, private userManagementService: UserManagementService) { } ngOnInit() { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; })); } ngOnDestroy(): void { this.subscriptions.forEach(value => { if (value instanceof Subscriber) { value.unsubscribe(); } else if (value instanceof Function) { value(); } }); } public get isPortalAdmin() { return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user); } }