Prima vers metodi controllo licenze (per ora "light" in verifica versioni
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
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 ReleaseReqDTO
|
||||
{
|
||||
/// <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>
|
||||
public string VersMin { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Versione MAX richiesta
|
||||
/// </summary>
|
||||
public string VersMax { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Verifica complessiva validità richiesta:
|
||||
/// CodApp presente
|
||||
/// - MainKey oppure CodImp + AppKey presenti
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsValid
|
||||
{
|
||||
get => !string.IsNullOrEmpty(CodApp) && (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using static Core.Enum;
|
||||
|
||||
namespace Core.DTO
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class TicketDTO
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace EgwControlCenter.App
|
||||
|
||||
private bool forceClose = false;
|
||||
|
||||
private Size minSize = new Size(636, 409);
|
||||
private Size minSize = new Size(676, 409);
|
||||
private bool showReduced = false;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
<div class="p-0">
|
||||
<h5>App Control Center</h5>
|
||||
</div>
|
||||
<div class="p-0 d-flex">
|
||||
<div class="px-1 input-group">
|
||||
<span class="input-group-text">
|
||||
<div class="p-0 d-flex small">
|
||||
<div class="px-1 input-group input-group-sm">
|
||||
<span class="input-group-text py-0">
|
||||
<span class="form-check form-switch">
|
||||
<label class="form-check-label">Only Updates</label>
|
||||
<input class="form-check-input" type="checkbox" @bind="@ShowOnlyUpdate">
|
||||
</span>
|
||||
</span>
|
||||
<button class="btn btn-outline-success" @onclick="ForceCheck" title="Forza Verifica Immediata">Check Now <i class="fa-solid fa-rotate"></i></button>
|
||||
<button class="btn btn-sm btn-outline-success" @onclick="ForceCheck" title="Forza Verifica Immediata">Check Now <i class="fa-solid fa-rotate"></i></button>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-outline-primary" @onclick="ToggleSetup" title="Setup Controlli"><i class="fa-solid fa-angles-left"></i></button>
|
||||
<button class="btn btn-sm btn-outline-primary" @onclick="ToggleSetup" title="Setup Controlli"><i class="fa-solid fa-angles-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
@if (PwdOk)
|
||||
{
|
||||
<div class="input-group">
|
||||
<button class="btn btn-outline-success shadow" @onclick="DoSave" title="Save All Changes"><i class="fa-regular fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-outline-secondary shadow" @onclick="DoCancel" title="Reload Saved"><i class="fa-solid fa-rotate"></i> Reload</button>
|
||||
<button class="btn btn-outline-danger shadow" @onclick="DoReset" title="Reset to Empty/Standard"><i class="fa-solid fa-ban"></i> Reset</button>
|
||||
<button class="btn btn-outline-dark" @onclick="ToggleSetup" title="Close Configuration Setup"><i class="fa-solid fa-angles-right"></i></button>
|
||||
<button class="btn btn-sm btn-outline-success shadow" @onclick="DoSave" title="Save All Changes"><i class="fa-regular fa-floppy-disk"></i> Save</button>
|
||||
<button class="btn btn-sm btn-outline-secondary shadow" @onclick="DoCancel" title="Reload Saved"><i class="fa-solid fa-rotate"></i> Reload</button>
|
||||
<button class="btn btn-sm btn-outline-danger shadow" @onclick="DoReset" title="Reset to Empty/Standard"><i class="fa-solid fa-ban"></i> Reset</button>
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="ToggleSetup" title="Close Configuration Setup"><i class="fa-solid fa-angles-right"></i></button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="px-1">
|
||||
<button class="btn btn-outline-dark w-100" @onclick="ToggleSetup" title="Chiudi Setup Controlli"><i class="fa-solid fa-angles-right"></i></button>
|
||||
<button class="btn btn-sm btn-outline-dark w-100" @onclick="ToggleSetup" title="Chiudi Setup Controlli"><i class="fa-solid fa-angles-right"></i></button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.1.2409.2611</Version>
|
||||
<Version>1.1.2409.2615</Version>
|
||||
<Configurations>Debug;Release;DEBUG_Local</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>2611</ApplicationRevision>
|
||||
<ApplicationVersion>1.1.2409.2611</ApplicationVersion>
|
||||
<ApplicationRevision>2615</ApplicationRevision>
|
||||
<ApplicationVersion>1.1.2409.2615</ApplicationVersion>
|
||||
<BootstrapperEnabled>True</BootstrapperEnabled>
|
||||
<Configuration>Release</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgwControlCenter.Core.DTO
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class ReleaseReqDTO
|
||||
{
|
||||
/// <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>
|
||||
public string VersMin { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Versione MAX richiesta
|
||||
/// </summary>
|
||||
public string VersMax { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Verifica complessiva validità richiesta:
|
||||
/// CodApp presente
|
||||
/// - MainKey oppure CodImp + AppKey presenti
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsValid
|
||||
{
|
||||
get => !string.IsNullOrEmpty(CodApp) && (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -465,30 +465,65 @@ namespace EgwControlCenter.Core
|
||||
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Indica se usare la chaive appKey x i metodi di recupero informazioni 8elenco versioni...)
|
||||
/// </summary>
|
||||
private bool useAppKey = true;
|
||||
|
||||
private static List<ReleaseDTO> GetRemoteRel(string CodApp, string CurrVers)
|
||||
private List<ReleaseDTO> GetRemoteRel(string CodApp, string CurrVers)
|
||||
{
|
||||
List<ReleaseDTO> answ = new List<ReleaseDTO>();
|
||||
try
|
||||
{
|
||||
// client chiamate rest
|
||||
var client = new RestClient(Const.apiUrl);
|
||||
// Chiamo il metodo!
|
||||
var checkRel = new RestRequest($"/api/Release/filt/{CodApp}?VersMin={CurrVers}", Method.Get);
|
||||
// effettuo vera chiamata
|
||||
var pUpd = Task.Run(async () =>
|
||||
// provo cmq ad inizializzare la richiesta
|
||||
ReleaseReqDTO reqDto = new ReleaseReqDTO()
|
||||
{
|
||||
var currResp = await client.GetAsync(checkRel);
|
||||
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
|
||||
CodApp = CodApp,
|
||||
CodImp = CurrPatrolCont.CodImpiego,
|
||||
AppKey = CurrPatrolCont.AppKey,
|
||||
VersMin = CurrVers
|
||||
};
|
||||
// Chiamo il metodo!
|
||||
if (useAppKey && reqDto.IsValid)
|
||||
{
|
||||
var actReq = new RestRequest($"/api/release/getfilt", Method.Post);
|
||||
string payload = JsonConvert.SerializeObject(reqDto);
|
||||
actReq.AddJsonBody(payload);
|
||||
// effettuo vera chiamata
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
var currList = JsonConvert.DeserializeObject<List<ReleaseDTO>>(currResp.Content);
|
||||
if (currList != null)
|
||||
var currResp = await client.PostAsync(actReq);
|
||||
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
|
||||
{
|
||||
answ = currList;
|
||||
var currList = JsonConvert.DeserializeObject<List<ReleaseDTO>>(currResp.Content);
|
||||
if (currList != null)
|
||||
{
|
||||
answ = currList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
else
|
||||
{
|
||||
var checkRel = new RestRequest($"/api/release/filt/{CodApp}?VersMin={CurrVers}", Method.Get);
|
||||
// effettuo vera chiamata
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
var currResp = await client.GetAsync(checkRel);
|
||||
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
|
||||
{
|
||||
var currList = JsonConvert.DeserializeObject<List<ReleaseDTO>>(currResp.Content);
|
||||
if (currList != null)
|
||||
{
|
||||
answ = currList;
|
||||
}
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@ using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using LiMan.DB.DBModels;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Org.BouncyCastle.Asn1.Crmf;
|
||||
using System;
|
||||
|
||||
namespace LiMan.APi.Controllers
|
||||
{
|
||||
@@ -37,8 +39,7 @@ namespace LiMan.APi.Controllers
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco dati licenza Applicativi (completo)
|
||||
/// GET api/Release/EgtBW
|
||||
/// Recupera elenco dati Release (rilasciate) GET api/release/EgtBW
|
||||
/// </summary>
|
||||
/// <param name="id">Codice Applicazione</param>
|
||||
/// <returns></returns>
|
||||
@@ -46,13 +47,12 @@ namespace LiMan.APi.Controllers
|
||||
public async Task<List<ReleaseDTO>> Get(string id)
|
||||
{
|
||||
var result = await dataService.ReleaseGetByApp(id);
|
||||
await dataService.recordCall(id, id, $"GET:api/Release/{id}");
|
||||
await dataService.recordCall(id, id, $"GET:api/release/{id}");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco dati licenza Applicativi data versione minima
|
||||
/// GET api/Release/EgtBW
|
||||
/// Recupera elenco dati Release (rilasciate) data versione minima GET api/release/EgtBW
|
||||
/// </summary>
|
||||
/// <param name="id">Codice Applicazione</param>
|
||||
/// <param name="VersMin">Versione minima richiesta (attuale)</param>
|
||||
@@ -61,13 +61,13 @@ namespace LiMan.APi.Controllers
|
||||
public async Task<List<ReleaseDTO>> GetFilt(string id, string VersMin)
|
||||
{
|
||||
var result = await dataService.ReleaseGetByAppVers(id, VersMin);
|
||||
await dataService.recordCall(id, id, $"GET:api/Release/filt/{id}");
|
||||
await dataService.recordCall(id, id, $"GET:api/release/filt/{id}");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco dati licenza Applicativi data versione minima + vers limite
|
||||
/// GET api/Release/EgtBW
|
||||
/// Recupera elenco dati Release (rilasciate) data versione minima e massima
|
||||
/// GET api/release/EgtBW
|
||||
/// </summary>
|
||||
/// <param name="id">Codice Applicazione</param>
|
||||
/// <param name="VersMin">Versione minima richiesta (attuale)</param>
|
||||
@@ -77,13 +77,66 @@ namespace LiMan.APi.Controllers
|
||||
public async Task<List<ReleaseDTO>> GetFiltLimit(string id, string VersMin, string VersMax)
|
||||
{
|
||||
var result = await dataService.ReleaseGetByAppVersLimit(id, VersMin, VersMax);
|
||||
await dataService.recordCall(id, id, $"GET:api/Release/filtLimit/{id}");
|
||||
await dataService.recordCall(id, id, $"GET:api/release/filtLimit/{id}");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta di registrazione di una nuova Release applicativa
|
||||
/// POST api/release/save
|
||||
/// Recupera elenco dati Release (rilasciate)
|
||||
/// POST api/release/getall
|
||||
/// </summary>
|
||||
/// <param name="CurrRequest">Obj ReleaseReqDTO con chiavi (master o app)</param>
|
||||
[HttpPost("getall")]
|
||||
public async Task<List<ReleaseDTO>> GetReleases([FromBody] ReleaseReqDTO CurrRequest)
|
||||
{
|
||||
List<ReleaseDTO> result = new List<ReleaseDTO>();
|
||||
// verifica validità richiesta...
|
||||
if (CheckReqKeys(CurrRequest))
|
||||
{
|
||||
result = await dataService.ReleaseGetByApp(CurrRequest.CodApp);
|
||||
await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getall/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco dati Release (rilasciate) data versione minima
|
||||
/// POST api/release/getfilt
|
||||
/// </summary>
|
||||
/// <param name="CurrRequest">Obj ReleaseReqDTO con chiavi (master o app)</param>
|
||||
[HttpPost("getfilt")]
|
||||
public async Task<List<ReleaseDTO>> GetReleasesFilt([FromBody] ReleaseReqDTO CurrRequest)
|
||||
{
|
||||
List<ReleaseDTO> result = new List<ReleaseDTO>();
|
||||
// verifica validità richiesta...
|
||||
if (CheckReqKeys(CurrRequest))
|
||||
{
|
||||
result = await dataService.ReleaseGetByAppVers(CurrRequest.CodApp, CurrRequest.VersMin);
|
||||
await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getfilt/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco dati Release (rilasciate) data versione minima e massima
|
||||
/// POST api/release/getlimit
|
||||
/// </summary>
|
||||
/// <param name="CurrRequest">Obj ReleaseReqDTO con chiavi (master o app)</param>
|
||||
[HttpPost("getlimit")]
|
||||
public async Task<List<ReleaseDTO>> GetReleasesLimit([FromBody] ReleaseReqDTO CurrRequest)
|
||||
{
|
||||
List<ReleaseDTO> result = new List<ReleaseDTO>();
|
||||
// verifica validità richiesta...
|
||||
if (CheckReqKeys(CurrRequest))
|
||||
{
|
||||
result = await dataService.ReleaseGetByAppVersLimit(CurrRequest.CodApp, CurrRequest.VersMin, CurrRequest.VersMax);
|
||||
await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getlimit/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva una nuova release dell'applicativo (eventualmente sovrascrivendo) POST api/release/save
|
||||
/// </summary>
|
||||
/// <param name="CurrRequest">Obj Richiesta</param>
|
||||
[HttpPost("save")]
|
||||
@@ -104,7 +157,6 @@ namespace LiMan.APi.Controllers
|
||||
var licUploader = await dataService.LicenzeSearch(CurrRequest.CodInst, CurrRequest.UplAppID, CurrRequest.MasterKey, false);
|
||||
if (licUploader != null && licUploader.Count > 0)
|
||||
{
|
||||
|
||||
// in primis cerco app...
|
||||
var appList = await dataService.ApplicativiGetAll();
|
||||
ApplicativoModel recApp = new ApplicativoModel();
|
||||
@@ -176,5 +228,26 @@ namespace LiMan.APi.Controllers
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica validità richiesta
|
||||
/// - dati presenti in chiamata
|
||||
/// - combinazioni CodApp + chiavi valide/attive
|
||||
/// </summary>
|
||||
/// <param name="currReq"></param>
|
||||
/// <returns></returns>
|
||||
private bool CheckReqKeys(ReleaseReqDTO currReq)
|
||||
{
|
||||
bool answ = currReq.IsValid;
|
||||
if (answ)
|
||||
{
|
||||
// verifica validità chiavi... TBD!!!
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user