Added Login, TTS Login, Policies

This commit is contained in:
Tom
2024-10-25 19:09:34 +00:00
parent 0c7fbf1cb9
commit 65f4172bc2
10 changed files with 275 additions and 40 deletions

View File

@ -4,7 +4,11 @@ export enum PolicyScope {
}
export class Policy {
constructor(public path: string, public usage: number, public span: number, public editing: boolean = false, public isNew: boolean = false) {
public old_path: string|undefined;
public old_usage: number|undefined;
public old_span: number|undefined;
constructor(public id: string, public group_id: string, public path: string, public usage: number, public span: number, public temp_group_name: string = "", public editing: boolean = false, public isNew: boolean = false) {
}
}

View File

@ -1,5 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import EventService from '../EventService';
@Injectable({
providedIn: 'root'
@ -8,7 +9,7 @@ export class ApiAuthenticationService {
private authenticated: boolean;
private lastCheck: Date;
constructor(private http: HttpClient) {
constructor(private http: HttpClient, private events: EventService) {
this.authenticated = false;
this.lastCheck = new Date();
}
@ -36,7 +37,16 @@ export class ApiAuthenticationService {
}
private updateAuthenticated(value: boolean) {
const previous = this.authenticated;
this.authenticated = value;
this.lastCheck = new Date();
if (previous != value) {
if (value) {
this.events.emit('login', null);
} else {
this.events.emit('logoff', null);
}
}
}
}