Merge branch 'release/ReleaseCleanup_01'
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DTO
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class AuthDataDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Master Key
|
||||
/// </summary>
|
||||
public string MastKey { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Impiego istanza SubLic
|
||||
/// </summary>
|
||||
public string CodImp { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Chiave SubLic
|
||||
/// </summary>
|
||||
public string AppKey { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Verifica complessiva validità richiesta:
|
||||
/// CodApp presente
|
||||
/// - MainKey oppure CodImp + AppKey presenti
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public virtual bool IsValid
|
||||
{
|
||||
get => (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DTO
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class ManDeclareDTO : AuthDataDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco delle CodApp Gestite
|
||||
/// </summary>
|
||||
public List<string> ListCodApp { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Verifica complessiva validità richiesta:
|
||||
/// CodApp presente
|
||||
/// - MainKey oppure CodImp + AppKey presenti
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public override bool IsValid
|
||||
{
|
||||
get => (ListCodApp != null && ListCodApp.Count > 0) && (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,28 +11,13 @@ namespace Core.DTO
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class ReleaseReqDTO
|
||||
public class ReleaseReqDTO : AuthDataDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// CodApp Richiesta
|
||||
/// </summary>
|
||||
public string CodApp { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Master Key
|
||||
/// </summary>
|
||||
public string MastKey { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Impiego istanza SubLic
|
||||
/// </summary>
|
||||
public string CodImp { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Chiave SubLic
|
||||
/// </summary>
|
||||
public string AppKey { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Versione minima richiesta
|
||||
/// </summary>
|
||||
@@ -54,7 +39,7 @@ namespace Core.DTO
|
||||
/// - MainKey oppure CodImp + AppKey presenti
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsValid
|
||||
public override bool IsValid
|
||||
{
|
||||
get => !string.IsNullOrEmpty(CodApp) && (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace LiMan.APi.Controllers
|
||||
NumImp = CurrRequest.NumImp,
|
||||
VersNum = CurrRequest.VersMin
|
||||
};
|
||||
dataService.InstallRelUpsert(checkRec);
|
||||
dataService.InstallRelUpsert(checkRec);
|
||||
// registro infine chiamata
|
||||
await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getfilt/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}");
|
||||
}
|
||||
@@ -245,6 +245,24 @@ namespace LiMan.APi.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conferma quale sia l'elenco delle app gestite POST api/release/setmanaged
|
||||
/// </summary>
|
||||
/// <param name="ManagedApp">Obj ManDeclareDTO con chiavi + elenco app gestite (x eliminare altre)</param>
|
||||
/// <returns>Numero di record eliminati</returns>
|
||||
[HttpPost("setmanaged")]
|
||||
public async Task<int> SetManaged([FromBody] ManDeclareDTO ManagedApp)
|
||||
{
|
||||
int result = 0;
|
||||
// verifica validità richiesta...
|
||||
if (CheckReqKeys(ManagedApp))
|
||||
{
|
||||
result = dataService.InstallRelClean(ManagedApp.CodImp, ManagedApp.AppKey, ManagedApp.ListCodApp);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
@@ -284,6 +302,23 @@ namespace LiMan.APi.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica validità richiesta
|
||||
/// - dati presenti in chiamata
|
||||
/// - combinazioni CodApp + chiavi valide/attive
|
||||
/// </summary>
|
||||
/// <param name="currReq"></param>
|
||||
/// <returns></returns>
|
||||
private bool CheckReqKeys(ManDeclareDTO currReq)
|
||||
{
|
||||
bool answ = currReq.IsValid;
|
||||
if (answ)
|
||||
{
|
||||
// verifica validità chiavi... TBD!!!
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -609,6 +609,18 @@ namespace LiMan.APi.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua pulizia record registrazione InstalledRelease eliminando quelli non presenti in elenco
|
||||
/// </summary>
|
||||
/// <param name="CodImp">CodImpiego</param>
|
||||
/// <param name="AppKey">Chiave App</param>
|
||||
/// <param name="ListCodApp">Elenco app gestite (=da tenere)</param>
|
||||
/// <returns>Num rec eliminati</returns>
|
||||
public int InstallRelClean(string CodImp, string AppKey, List<string> ListCodApp)
|
||||
{
|
||||
return dbController.InstallRelClean(CodImp, AppKey, ListCodApp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registro su DB il record della licenza attuale relativo alla richiesta di verifica licenza ricevuta
|
||||
/// </summary>
|
||||
@@ -924,7 +936,7 @@ namespace LiMan.APi.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registro su DB le statistiche delle chiavi in elenco, resettando i vari contatori quando fatto
|
||||
/// Registro su DB le statistiche delle chiavi in elenco, resettando i vari contatori quando res
|
||||
/// </summary>
|
||||
/// <param name="keyList">Elenco key nel formato {rKeySampleVars}:{codInst}:{codApp}:{targetUrl}</param>
|
||||
public async Task<bool> saveStatsToDb(List<string> keyList)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>License Manager</i>
|
||||
<h4>Versione: 2.1.2501.1319</h4>
|
||||
<h4>Versione: 2.1.2501.1416</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.2501.1319
|
||||
2.1.2501.1416
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>2.1.2501.1319</version>
|
||||
<version>2.1.2501.1416</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -1401,6 +1401,59 @@ namespace LiMan.DB.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua pulizia record registrazione InstalledRelease eliminando quelli non presenti in elenco
|
||||
/// </summary>
|
||||
/// <param name="CodImp">CodImpiego</param>
|
||||
/// <param name="AppKey">Chiave App</param>
|
||||
/// <param name="ListCodApp">Elenco app gestite (=da tenere)</param>
|
||||
/// <returns>Num rec eliminati</returns>
|
||||
public int InstallRelClean(string CodImp, string AppKey, List<string> ListCodApp)
|
||||
{
|
||||
int numDel = 0;
|
||||
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
|
||||
{
|
||||
// cerco tutti i record associati con le chiavi richieste
|
||||
List<InstalledReleasesModel> listRec = localDbCtx
|
||||
.DbSetInstallRel
|
||||
.Where(x => x.CodImp == CodImp && x.AppKey == AppKey)
|
||||
.ToList();
|
||||
List<InstalledReleasesModel> list2Del = new List<InstalledReleasesModel>();
|
||||
// se ho risultati
|
||||
if (listRec != null && listRec.Count > 0)
|
||||
{
|
||||
// elimino da questo elenco quelli che appartengono all'elenco ricevuto dei dati gestiti
|
||||
foreach (var item in listRec)
|
||||
{
|
||||
if (!ListCodApp.Contains(item.CodApp))
|
||||
{
|
||||
list2Del.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// se ho record da eliminare procedo!
|
||||
if (list2Del.Count > 0)
|
||||
{
|
||||
// altrimenti aggiungo...
|
||||
localDbCtx
|
||||
.DbSetInstallRel
|
||||
.RemoveRange(list2Del);
|
||||
// salvataggio!
|
||||
try
|
||||
{
|
||||
// salvo
|
||||
numDel = localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezoine in InstallRelClean{Environment.NewLine}{ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return numDel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update/insert record registrazione InstalledRelease applicativo
|
||||
/// </summary>
|
||||
@@ -1556,7 +1609,6 @@ namespace LiMan.DB.Controllers
|
||||
.DbSetLicenze
|
||||
.ToList();
|
||||
|
||||
|
||||
// recupero releases
|
||||
var listAllVers = localDbCtx
|
||||
.DbSetReleases
|
||||
@@ -1642,39 +1694,6 @@ namespace LiMan.DB.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue conteggio numero versioni in elenco
|
||||
/// </summary>
|
||||
/// <param name="listRel"></param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<string, int> CountRelVers(List<AppRelStatusDTO> listRel)
|
||||
{
|
||||
Dictionary<string, int> answ = new Dictionary<string, int>();
|
||||
if (listRel != null && listRel.Count > 0)
|
||||
{
|
||||
answ = listRel
|
||||
.GroupBy(x => x.VersNumInstall)
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Esegue conteggio numero versioni in elenco
|
||||
/// </summary>
|
||||
/// <param name="listRel"></param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<int, int> CountRelStatus(List<AppRelStatusDTO> listRel)
|
||||
{
|
||||
Dictionary<int, int> answ = new Dictionary<int, int>();
|
||||
if (listRel != null && listRel.Count > 0)
|
||||
{
|
||||
answ = listRel
|
||||
.GroupBy(x => x.UpToDateStatus)
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua refresh del payload della licenza dato info + enigma generato dal client
|
||||
/// </summary>
|
||||
@@ -2449,6 +2468,44 @@ namespace LiMan.DB.Controllers
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue conteggio numero versioni in elenco
|
||||
/// </summary>
|
||||
/// <param name="listRel"></param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<int, int> CountRelStatus(List<AppRelStatusDTO> listRel)
|
||||
{
|
||||
Dictionary<int, int> answ = new Dictionary<int, int>();
|
||||
if (listRel != null && listRel.Count > 0)
|
||||
{
|
||||
answ = listRel
|
||||
.GroupBy(x => x.UpToDateStatus)
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue conteggio numero versioni in elenco
|
||||
/// </summary>
|
||||
/// <param name="listRel"></param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<string, int> CountRelVers(List<AppRelStatusDTO> listRel)
|
||||
{
|
||||
Dictionary<string, int> answ = new Dictionary<string, int>();
|
||||
if (listRel != null && listRel.Count > 0)
|
||||
{
|
||||
answ = listRel
|
||||
.GroupBy(x => x.VersNumInstall)
|
||||
.ToDictionary(g => g.Key, g => g.Count());
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>License Manager</i>
|
||||
<h4>Versione: 2.1.2501.1319</h4>
|
||||
<h4>Versione: 2.1.2501.1416</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.2501.1319
|
||||
2.1.2501.1416
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>2.1.2501.1319</version>
|
||||
<version>2.1.2501.1416</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>2.1.2501.1319</Version>
|
||||
<Version>2.1.2501.1416</Version>
|
||||
<RootNamespace>LiMan.UI</RootNamespace>
|
||||
<AssemblyName>LiMan.UI</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>License Manager</i>
|
||||
<h4>Versione: 2.1.2501.1319</h4>
|
||||
<h4>Versione: 2.1.2501.1416</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.2501.1319
|
||||
2.1.2501.1416
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>2.1.2501.1319</version>
|
||||
<version>2.1.2501.1416</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user