Merge branch 'release/AddReleaseLic_01'
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body p-1 small">
|
||||
<DipendentiEdit CurrMode="CtrlMode" CurrRecord="RecordEdit" EC_update="ForceReload" EC_Activate="DoActivate" ListDipendenti="@ListDipendentiAttiviOrd" ListOrari="@ListOrari"></DipendentiEdit>
|
||||
<DipendentiEdit CurrMode="CtrlMode" CurrRecord="RecordEdit" EC_update="ForceReload" EC_Activate="DoActivate" EC_Release="ReleaseLicense" ListDipendenti="@ListDipendentiAttiviOrd" ListOrari="@ListOrari"></DipendentiEdit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -129,16 +129,20 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
await LicServ.TryActivationMult(CodList);
|
||||
// cmq faccio refresh
|
||||
await FullRefresh();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(true);
|
||||
}
|
||||
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task DoRefresh()
|
||||
{
|
||||
isLoading = true;
|
||||
await LicServ.resetActivList();
|
||||
await FullRefresh();
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(false);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
@@ -154,13 +158,15 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
CtrlMode = DipendentiEdit.EditMode.None;
|
||||
RecordEdit = null;
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(false);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadConfData();
|
||||
await ReloadData();
|
||||
RefreshLicData();
|
||||
await RefreshLicData(true);
|
||||
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
@@ -270,6 +276,33 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Rilascia licenza e rilegge conf
|
||||
/// </summary>
|
||||
/// <param name="CurrRecord"></param>
|
||||
/// <returns></returns>
|
||||
private async Task ReleaseLicense(DipendentiModel CurrRecord)
|
||||
{
|
||||
// verifica SE ci sono licenze disponibili
|
||||
if (NumLicDispOnline > NumLicActOnline)
|
||||
{
|
||||
// chiamo rimozione licenza
|
||||
var CodImpiego = LicServ.HashDip(CurrRecord);
|
||||
bool fatto = await LicServ.TryRemoveActivation(CodImpiego, CurrRecord.AuthKey);
|
||||
if (fatto)
|
||||
{
|
||||
// disattiva utente
|
||||
GDataServ.DipUpdateActive(CurrRecord.IdxDipendente, false);
|
||||
}
|
||||
LicServ.ResetLicenseData();
|
||||
}
|
||||
// disattivo record mostrato...
|
||||
RecordEdit = null;
|
||||
// ricarico
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(true);
|
||||
}
|
||||
|
||||
private async Task DoActivate(DipendentiModel CurrRecord)
|
||||
{
|
||||
@@ -284,8 +317,9 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
// effettua riassegnazione
|
||||
bool fatto = LicServ.TryActivation(CodImpiego, CurrRecord.AuthKey);
|
||||
}
|
||||
|
||||
await ReloadData();
|
||||
// ricalcolo licenze
|
||||
await RefreshLicData(true);
|
||||
}
|
||||
|
||||
private async Task FullRefresh()
|
||||
@@ -296,22 +330,27 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
bool refreshAct = await LicServ.RefreshLicense();
|
||||
bool refreshPay = LicServ.RefreshPayload();
|
||||
// chiama update di TUTTE le authKey verso il server online
|
||||
int numLoc = 0;
|
||||
foreach (var item in ListDipendentiAttiviOrd)
|
||||
{
|
||||
var CodImpiego = LicServ.HashDip(item);
|
||||
bool fatto = await LicServ.TryRefreshActivation(CodImpiego, item.AuthKey);
|
||||
if (fatto)
|
||||
numLoc++;
|
||||
}
|
||||
Log.Trace($"NumLoc: {numLoc}");
|
||||
}
|
||||
|
||||
private void RefreshLicData()
|
||||
private async Task RefreshLicData(bool forceReload)
|
||||
{
|
||||
if (LicServ.HasAppData)
|
||||
if (!LicServ.HasAppData || forceReload)
|
||||
{
|
||||
NumLicDispLocal = LicServ.NumLicDb;
|
||||
NumLicActLocal = LicServ.ActivList.Count();
|
||||
NumLicDispOnline = LicServ.AppLicense.NumLicenze;
|
||||
NumLicActOnline = LicServ.AppLicense.NumLicenzeAttive;
|
||||
await FullRefresh();
|
||||
}
|
||||
NumLicDispLocal = LicServ.NumLicDb;
|
||||
NumLicActLocal = LicServ.ActivList.Count();
|
||||
NumLicDispOnline = LicServ.AppLicense.NumLicenze;
|
||||
NumLicActOnline = LicServ.AppLicense.NumLicenzeAttive;
|
||||
}
|
||||
|
||||
private async Task ReloadConfData()
|
||||
|
||||
@@ -16,13 +16,17 @@ namespace GPW.CORE.ADM.Components.Pages
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
protected LicenseService LicServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService AuthService { get; set; } = null!;
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
@@ -35,6 +39,8 @@ namespace GPW.CORE.ADM.Components.Pages
|
||||
await Task.Delay(10);
|
||||
await AuthService.FlushRedisCache();
|
||||
await Task.Delay(10);
|
||||
LicServ.ResetLicenseData();
|
||||
await Task.Delay(10);
|
||||
|
||||
AppMServ.clonedRA = null;
|
||||
AppMServ.recordRA = null;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>4.1.2507.2212</Version>
|
||||
<Version>4.1.2509.0110</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -522,6 +522,46 @@ namespace GPW.CORE.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta rimozione licenza dato codice impiego
|
||||
/// </summary>
|
||||
/// <param name="CodImpiego"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TryRemoveActivation(string CodImpiego, string Chiave)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
//client.Authenticator = new HttpBasicAuthenticator("username", "password");
|
||||
string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
|
||||
var request = new RestRequest($"/api/attivazioni/removeKey");
|
||||
Dictionary<string, string> parDict = new Dictionary<string, string>();
|
||||
parDict.Add(CodImpiego, Chiave);
|
||||
UserLicenseRequest newBody = new UserLicenseRequest()
|
||||
{
|
||||
MasterKey = MasterKey,
|
||||
ParamDict = parDict
|
||||
};
|
||||
request.AddJsonBody(newBody);
|
||||
var response = client.Post(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// verifico risposta
|
||||
string rawData = $"{response.Content}";
|
||||
try
|
||||
{
|
||||
bool.TryParse(rawData, out answ);
|
||||
ResetLicenseData();
|
||||
await RefreshLicense();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
Log.Info($"Richiesta TryRemoveActivation | CodImpiego: {CodImpiego} | answ: {answ}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tenta refresh licenza dato codice impiego (aggiorna la authKey...)
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 4.1.2507.2212</h4>
|
||||
<h4>Versione: 4.1.2509.0110</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.1.2507.2212
|
||||
4.1.2509.0110
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>4.1.2507.2212</version>
|
||||
<version>4.1.2509.0110</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user