inizio fix navmenu
- ricostruzione servizi lettura dati utente x login
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>WebDoorCreator - Egalware</i>
|
||||
<h4>Version: 0.9.2305.3019</h4>
|
||||
<h4>Version: 0.9.2305.3020</h4>
|
||||
<br /> Release note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2305.3019
|
||||
0.9.2305.3020
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2305.3019</version>
|
||||
<version>0.9.2305.3020</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -235,9 +235,9 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
{
|
||||
if (!string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(userRole))
|
||||
{
|
||||
// FARE!!! rivedere con await WDCUsrServ.UserDataGetById(userId);
|
||||
var user = await _userManager.FindByNameAsync(userId);
|
||||
var obj = await WDCUService.UserDataGetById(user.Id);
|
||||
//var user = await _userManager.FindByNameAsync(userId);
|
||||
//var obj = await WDCUService.UserDataGetById(user.Id);
|
||||
var obj = await WDCUService.UserDataGetByName(userId);
|
||||
if (obj != null)
|
||||
{
|
||||
userClaims = obj.Claims.ToList();
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace WebDoorCreator.UI.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati utente (singolo x searchVal)
|
||||
/// Dati utente (singolo da UID)
|
||||
/// </summary>
|
||||
/// <param name="UserId"></param>
|
||||
/// <returns></returns>
|
||||
@@ -219,6 +219,43 @@ namespace WebDoorCreator.UI.Data
|
||||
Log.Debug($"UserDataGetById | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dataResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Dati utente (singolo x UserName)
|
||||
/// </summary>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<UserData> UserDataGetByName(string UserName)
|
||||
{
|
||||
string source = "FULL";
|
||||
UserData dataResult = new UserData();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// uso metodi helper protected di base...
|
||||
var userRaw = await UserIdentityByName(UserName);
|
||||
var userIdent = new IdentityUser
|
||||
{
|
||||
Id = userRaw.Id,
|
||||
UserName = userRaw.UserName,
|
||||
Email = userRaw.Email,
|
||||
PhoneNumber = userRaw.PhoneNumber,
|
||||
PasswordHash = "*****",
|
||||
EmailConfirmed = userRaw.EmailConfirmed
|
||||
};
|
||||
// cerco ruoli & claims
|
||||
var UserRoles = await UserRolesById(userIdent);
|
||||
var UserClaims = await UserClaimsById(userIdent);
|
||||
// compongo output
|
||||
dataResult = new UserData()
|
||||
{
|
||||
Identity = userIdent,
|
||||
Roles = UserRoles,
|
||||
Claims = UserClaims
|
||||
};
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"UserDataGetByName | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dataResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati utente (filtrati da searchVal)
|
||||
@@ -356,7 +393,7 @@ namespace WebDoorCreator.UI.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati utente IDENTITY da REDIS o DB
|
||||
/// Dati utente IDENTITY da REDIS o DB da UID
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<IdentityUser> UserIdentityById(string UserId)
|
||||
@@ -392,6 +429,43 @@ namespace WebDoorCreator.UI.Data
|
||||
Log.Debug($"UserIdentityById | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dataResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Dati utente IDENTITY da REDIS o DB per NAME
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<IdentityUser> UserIdentityByName(string uName)
|
||||
{
|
||||
string source = "DB";
|
||||
IdentityUser dataResult = new IdentityUser();
|
||||
// cerco da cache
|
||||
string currKey = $"{Constants.rKeyUsersData}:UN:{uName}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<IdentityUser>(rawData);
|
||||
if (tempResult != null)
|
||||
{
|
||||
dataResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dataResult = await _userManager.FindByNameAsync(uName);
|
||||
rawData = JsonConvert.SerializeObject(dataResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
if (dataResult == null)
|
||||
{
|
||||
dataResult = new IdentityUser();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"UserIdentityByName | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dataResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati utente IDENTITY in modalità SEARCH da REDIS o DB
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.9.2305.3019</Version>
|
||||
<Version>0.9.2305.3020</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user