diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 34a19cb..1182cd8 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
WebDoorCreator - Egalware
- Version: 0.9.2305.3019
+ Version: 0.9.2305.3020
Release note:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 29a7359..2118f29 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-0.9.2305.3019
+0.9.2305.3020
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 8cd087b..8c337bc 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 0.9.2305.3019
+ 0.9.2305.3020
http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip
http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html
false
diff --git a/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs b/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs
index aa4315f..08d27ff 100644
--- a/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs
+++ b/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs
@@ -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();
diff --git a/WebDoorCreator.UI/Data/WDCUserService.cs b/WebDoorCreator.UI/Data/WDCUserService.cs
index 848048e..e483a17 100644
--- a/WebDoorCreator.UI/Data/WDCUserService.cs
+++ b/WebDoorCreator.UI/Data/WDCUserService.cs
@@ -183,7 +183,7 @@ namespace WebDoorCreator.UI.Data
}
///
- /// Dati utente (singolo x searchVal)
+ /// Dati utente (singolo da UID)
///
///
///
@@ -219,6 +219,43 @@ namespace WebDoorCreator.UI.Data
Log.Debug($"UserDataGetById | {source} in: {ts.TotalMilliseconds} ms");
return dataResult;
}
+ ///
+ /// Dati utente (singolo x UserName)
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
///
/// Dati utente (filtrati da searchVal)
@@ -356,7 +393,7 @@ namespace WebDoorCreator.UI.Data
}
///
- /// Dati utente IDENTITY da REDIS o DB
+ /// Dati utente IDENTITY da REDIS o DB da UID
///
///
protected async Task UserIdentityById(string UserId)
@@ -392,6 +429,43 @@ namespace WebDoorCreator.UI.Data
Log.Debug($"UserIdentityById | {source} in: {ts.TotalMilliseconds} ms");
return dataResult;
}
+ ///
+ /// Dati utente IDENTITY da REDIS o DB per NAME
+ ///
+ ///
+ protected async Task 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(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;
+ }
///
/// Dati utente IDENTITY in modalità SEARCH da REDIS o DB
diff --git a/WebDoorCreator.UI/WebDoorCreator.UI.csproj b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
index 7a1c80f..0e76c93 100644
--- a/WebDoorCreator.UI/WebDoorCreator.UI.csproj
+++ b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 0.9.2305.3019
+ 0.9.2305.3020
enable
aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608