This commit is contained in:
zaccaria.majid
2023-05-29 12:42:07 +02:00
3 changed files with 43 additions and 14 deletions
+3 -6
View File
@@ -1,20 +1,17 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Claims;
namespace WebDoorCreator.Data.User
{
/// <summary>
/// Classe generalizzaizone identity (user + roles + claims) x gestione semplificata in editing
/// </summary>
[Serializable]
public class UserData
{
#region Public Properties
public List<System.Security.Claims.Claim> Claims { get; set; } = new List<System.Security.Claims.Claim>();
public List<Claim> Claims { get; set; } = new List<Claim>();
public IdentityUser Identity { get; set; } = null!;
+5 -1
View File
@@ -101,6 +101,11 @@ else
<h3>User Administration</h3>
</div>
<div class="d-flex justify-content-between gap-3 mb-1">
<div class="input-group" title="Search">
<span class="input-group-text"><i class="fa-solid fa-magnifying-glass"></i></span>
<input class="form-control" placeholder="Search" @bind="@searchVal">
<button class="input-group-text" @onclick="resetSearch"><i class="fa-solid fa-xmark"></i></button>
</div>
<div class="input-group">
<span class="input-group-text"><i class="fas fa-user-tag"></i></span>
<select class="form-select" @bind="@FiltUserRole">
@@ -112,7 +117,6 @@ else
</option>
}
</select>
@*<span class="input-group-text">ROLES</span>*@
</div>
<div class="input-group">
<span class="input-group-text"><i class="fa-solid fa-building"></i></span>
+35 -7
View File
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.JSInterop;
using System.Linq;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.Data.User;
@@ -27,14 +28,31 @@ namespace WebDoorCreator.UI.Pages
#region Public Properties
public string searchVal
protected string searchVal
{
get
get => _searchVal;
set
{
return AppMService.SearchVal;
if (value != _searchVal)
{
_searchVal = value;
var pUpd = Task.Run(async () =>
{
await ReloadData();
});
pUpd.Wait();
}
}
}
protected void resetSearch()
{
searchVal = "";
}
private string _searchVal { get; set; } = "";
#endregion Public Properties
#region Public Methods
@@ -125,7 +143,9 @@ namespace WebDoorCreator.UI.Pages
public void Dispose()
{
AppMService.EA_SearchUpdated -= OnSeachUpdated;
#if false
AppMService.EA_SearchUpdated -= OnSeachUpdated;
#endif
}
/// <summary>
@@ -144,7 +164,10 @@ namespace WebDoorCreator.UI.Pages
// filtro visualizzazione x Company, SE richeisto
if (FiltCompany != "0")
{
UsersAll = UsersAll.Where(x => ConvertClaim(x.Claims).Contains(FiltCompany)).ToList();
System.Security.Claims.Claim cClaim = new System.Security.Claims.Claim("CompanyId", $"{FiltCompany}");
UsersAll = UsersAll
.Where(x => x.Claims.Any(c => c.Type == "CompanyId" && c.Value == $"{FiltCompany}"))
.ToList();
}
UsersList = UsersAll
.Skip(numRecord * (currPage - 1)).Take(numRecord)
@@ -179,8 +202,10 @@ namespace WebDoorCreator.UI.Pages
[Inject]
protected UserManager<IdentityUser> _UserManager { get; set; } = null!;
#if false
[Inject]
protected MessageService AppMService { get; set; } = null!;
protected MessageService AppMService { get; set; } = null!;
#endif
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
@@ -225,8 +250,11 @@ namespace WebDoorCreator.UI.Pages
protected override async Task OnInitializedAsync()
{
searchVal = "";
#if false
AppMService.ShowSearch = true;
AppMService.EA_SearchUpdated += OnSeachUpdated;
AppMService.EA_SearchUpdated += OnSeachUpdated;
#endif
// lettura dati
await ReloadData();
#if false