Auth
AuthService est le service qui stocke les informations d'authentification du Manager.
Importation
import {inject } from "inversify";import "reflect-metadata";import AuthService from "@adclz/fevermainlib/services/auth"; export default class MyClass { private AuthService : AuthService constructor(@inject (AuthService ) AuthService : AuthService ) { this.AuthService = AuthService }}
📜 Champs
CurrentProfile
AuthService.prototype.CurrentProfile = ProfileType: Profile
Profil d'authentification.
📄 Définitions
Profile
Profile représente les données d'authentification depuis Manager.
RawProfile est l'objet json qui permet de créer une nouvelle classe Profile.
interface RawProfile {
RestToken: string
Name: string
SuperAdmin: boolean
ClientCommands: Record<any, boolean>
RestApiCommands: Record<any, boolean>
}
abstract class Profile implements RawProfile {
public readonly RestToken: string
public readonly Name: string
public readonly SuperAdmin: boolean
public readonly ClientCommands: Record<ClientCommand, boolean>
public readonly RestApiCommands: Record<RestApiCommand, boolean>
}RestToken
Profile.prototype.RestToken = stringToken utlisable pour envoyer des reqûetes à l'api rest.
Name
Profile.prototype.Name = stringNom du profil envoyé depuis Manager.
SuperAdmin
Profile.prototype.SuperAdmin = booleanBooléen indiquant si vous êtes super administrateur.
Cela signifie que vous pouvez tout effectuer sur Manager.
ClientCommands
Profile.prototype.RestToken = Record<ClientCommand, boolean>Liste des commandes du socket qui sont autorisées.
Par défaut toutes les valeurs sont à false.
enum ClientCommand {
AnswerChoice,
ConnectTia,
LockHmi,
LockPlc,
RunTia,
UnlockHmi,
RefreshPlcState,
OpenBlockInEditor,
UnlockPlc
}RestApiCommands
Profile.prototype.RestToken = Record<RestApiCommand, boolean>Liste des commandes de l'api rest qui sont autorisées.
Par défaut toutes les valeurs sont à false.
enum RestApiCommand {
// Images
GetImages,
GetImage,
DeleteImage,
PostImage,
// Graphics
GetGraphics,
GetGraphic,
// Cultures
GetCultures,
// TiaData
GetTiaData,
// PlcData
GetPlcData,
GetInconsistentData,
// ProjectSave
GetProjectSaves,
GetProjectSave,
DeleteProjectSave,
PostProjectSave,
// Plc Template
PostPlcTemplate,
PostFeverPlcTemplate,
ExportFeverProgram,
// Hmi Template
PostHmiTemplate
}