argos/dmp-frontend/src/app/models/login/Principal.ts

36 lines
727 B
TypeScript

import { Serializable } from '../Serializable';
export class Principal implements Serializable<Principal> {
id: number;
token: string;
name: string;
expiresAt: Date;
appRoles: Principal.AppRole[];
avatarUrl: string;
timezone: string;
language: string;
culture: string;
fromJSONObject(item: any): Principal {
this.id = item.id;
this.token = item.token;
this.name = item.name;
this.expiresAt = item.expiresAt;
this.appRoles = item.authorities;
this.avatarUrl = item.avatarUrl;
this.language = item.language;
this.culture = item.culture;
this.timezone = item.timezone;
return this;
}
}
export namespace Principal {
export enum AppRole {
Admin = 2,
Manager = 1,
User = 0,
}
}