Merge branch 'develop' of https://gitlab.steamware.net/egalware/webdoorcreator into develop
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
{
|
||||
@if (compToShow != null)
|
||||
{
|
||||
<div>@compToShow.CompanyName</div>
|
||||
<input class="form-control form-control-sm" value="@compToShow.CompanyName" disabled/>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
public EventCallback<Dictionary<string, Dictionary<string, string>>> E_VocLemmas { get; set; }
|
||||
|
||||
public List<CompanyModel> listCompanies { get; set; } = new List<CompanyModel>();
|
||||
protected List<System.Security.Claims.Claim>? userClaims { get; set; } = null;
|
||||
|
||||
public List<string> listRecord { get; set; } = new List<string>();
|
||||
|
||||
@@ -195,7 +196,7 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
compToShow = listCompanies?.FirstOrDefault()!;
|
||||
}
|
||||
userCurrCompany = compToShow.CompanyId;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@@ -230,14 +231,15 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
{
|
||||
// reset preliminare
|
||||
listRecord = new List<string>();
|
||||
listCompanies = new List<CompanyModel>();
|
||||
//listCompanies = new List<CompanyModel>();
|
||||
if (!NavManager.Uri.Contains("UserAdmin"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(userRole))
|
||||
{
|
||||
// FARE!!! rivedere con await WDCUsrServ.UserDataGetById(userId);
|
||||
|
||||
|
||||
var user = await _userManager.FindByNameAsync(userId);
|
||||
#if false
|
||||
var user = await _userManager.FindByNameAsync(userId);
|
||||
var roleList = await _userManager.GetRolesAsync(user);
|
||||
if (roleList != null)
|
||||
@@ -278,10 +280,35 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
}
|
||||
compToShow = listCompanies?.FirstOrDefault()!;
|
||||
}
|
||||
}
|
||||
fixSelCompany();
|
||||
userClaimsList = listRecord;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
var obj = await WDCUService.UserDataGetById(user.Id);
|
||||
if (obj != null)
|
||||
{
|
||||
userClaims = obj.Claims.ToList();
|
||||
if (userClaims != null)
|
||||
{
|
||||
if (obj.Roles.Contains("SuperAdmin"))
|
||||
{
|
||||
listCompanies = await WDCService.CompanyGetByKey(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in obj.Claims.ToList())
|
||||
{
|
||||
List<CompanyModel> rawComp = await WDCService.CompanyGetByKey(int.Parse(item.Value));
|
||||
if (rawComp != null)
|
||||
{
|
||||
CompanyModel comp2Add = rawComp?.FirstOrDefault()!;
|
||||
listCompanies.Add(comp2Add);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fixSelCompany();
|
||||
userClaimsList = listRecord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user