84 lines
2.1 KiB
C#
84 lines
2.1 KiB
C#
using EgwControlCenter.Core;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace EgwControlCenter.App.Components.Pages
|
|
{
|
|
public partial class Index
|
|
{
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected AppControlService ACService { get; set; } = null!;
|
|
|
|
protected string AppKey
|
|
{
|
|
get => ACService.AppKey;
|
|
}
|
|
|
|
protected string MainKey
|
|
{
|
|
get => ACService.MainKey;
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task CheckMainAuth(bool forceCheck)
|
|
{
|
|
// verifica presenza MainKey di auth, mostrando eventualmente la pagina di setup con codice numerico da autorizzare da LiMan
|
|
MissingAuth = string.IsNullOrEmpty(MainKey) || string.IsNullOrEmpty(AppKey);
|
|
if (forceCheck)
|
|
{
|
|
await ForceCheck();
|
|
}
|
|
else
|
|
{
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
|
|
protected async Task ForceCheck()
|
|
{
|
|
await ACService.DoFullCheckAsync(true);
|
|
await ACService.DoTaskCheckAsync(true);
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
//return base.OnInitializedAsync();
|
|
await CheckMainAuth(false);
|
|
}
|
|
|
|
protected async Task SetupMode(bool reqSetup)
|
|
{
|
|
DoSetup = reqSetup;
|
|
if (!DoSetup)
|
|
{
|
|
await ForceCheck();
|
|
}
|
|
}
|
|
|
|
protected void ToggleSetup()
|
|
{
|
|
DoSetup = !DoSetup;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
/// <summary>
|
|
/// Indica richiesta modifica setup applicazione
|
|
/// </summary>
|
|
private bool DoSetup { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Indica mancanza auth di primo e secondo livello e relativa necessità auth da server LiMan o da config esplicito locale
|
|
/// </summary>
|
|
private bool MissingAuth { get; set; } = false;
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |