Centralize rights management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-11-30 10:26:14 +01:00
parent 74ab902180
commit 184a106542
11 changed files with 209 additions and 235 deletions

View File

@ -1,10 +1,16 @@
import { APIClient } from "./ApiClient";
import { VMInfo } from "./VMApi";
export interface ServerConfig {
authenticated: boolean;
disable_auth: boolean;
}
export interface Rights {
vms: VMInfo[];
sys_info: boolean;
}
let config: ServerConfig | null = null;
export class ServerApi {
@ -27,4 +33,16 @@ export class ServerApi {
if (config === null) throw new Error("Missing configuration!");
return config;
}
/**
* Get application rights
*/
static async GetRights(): Promise<Rights> {
return (
await APIClient.exec({
uri: "/server/rights",
method: "GET",
})
).data;
}
}