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

39 lines
911 B
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;
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);
}
}