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

27 lines
491 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 {
Admin = 0,
User = 1
}
}