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

28 lines
507 B
TypeScript

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