openaire-library/dashboard/users/dashboard-users.component.ts

41 lines
1.0 KiB
TypeScript

import {Component, Input, OnInit} from "@angular/core";
import {UserManagementService} from "../../services/user-management.service";
import {Session, User} from "../../login/utils/helper.class";
@Component({
selector: 'dashboard-users',
templateUrl: 'dashboard-users.component.html'
})
export class DashboardUsersComponent implements OnInit{
@Input()
public id: string;
@Input()
public type: string;
@Input()
public name: string;
@Input()
public link: string;
@Input()
public messages: Map<"member" | "manager", string> = null;
public user: User;
public tab: "manager" | "member" = 'manager';
constructor(private userManagementService: UserManagementService) {
}
ngOnInit() {
this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
});
}
changeTab(tab: "manager" | "member") {
this.tab = tab;
}
public get isPortalAdmin() {
return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
}
}