2017-12-14 11:41:26 +01:00
|
|
|
import { Serializable } from '../Serializable';
|
|
|
|
|
|
|
|
export class Principal implements Serializable<Principal> {
|
|
|
|
|
|
|
|
id: number;
|
|
|
|
token: string;
|
|
|
|
name: string;
|
|
|
|
expiresAt: Date;
|
|
|
|
appRoles: Principal.AppRole[];
|
2018-08-30 13:09:36 +02:00
|
|
|
avatarUrl: string;
|
|
|
|
timezone: string;
|
|
|
|
language: string;
|
|
|
|
culture: string;
|
|
|
|
|
2017-12-14 11:41:26 +01:00
|
|
|
fromJSONObject(item: any): Principal {
|
|
|
|
this.id = item.id;
|
|
|
|
this.token = item.token;
|
|
|
|
this.name = item.name;
|
|
|
|
this.expiresAt = item.expiresAt;
|
2018-01-31 16:39:16 +01:00
|
|
|
this.appRoles = item.authorities;
|
2018-08-30 13:09:36 +02:00
|
|
|
this.avatarUrl = item.avatarUrl;
|
|
|
|
this.language = item.language;
|
|
|
|
this.culture = item.culture;
|
|
|
|
this.timezone = item.timezone;
|
2017-12-14 11:41:26 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export namespace Principal {
|
|
|
|
export enum AppRole {
|
2018-05-28 11:50:42 +02:00
|
|
|
Admin = 2,
|
2018-02-02 11:33:37 +01:00
|
|
|
Manager = 1,
|
2018-02-01 15:04:36 +01:00
|
|
|
User = 0,
|
2017-12-14 11:41:26 +01:00
|
|
|
}
|
|
|
|
}
|