214 lines
10 KiB
Plaintext
214 lines
10 KiB
Plaintext
@if (ShowPopup)
|
|
{
|
|
<div class="modal" tabindex="-1" style="display:block" role="dialog">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title">Edit User</h3>
|
|
<!-- Button to close the popup -->
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="ClosePopup">
|
|
</button>
|
|
</div>
|
|
<!-- Edit form for the current user -->
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
@* @if (objUser.Id != "")
|
|
{
|
|
<p>@objUser.Id</p>
|
|
} *@
|
|
<div class="input-group mb-2">
|
|
<span class="input-group-text"><i class="far fa-envelope"></i></span>
|
|
<input class="form-control" type="text" placeholder="Email" @bind="objUser.Email" />
|
|
<div class="input-group-text">
|
|
<input class="form-control2" type="checkbox" title="Email Confirmed" @bind="objUser.EmailConfirmed" />
|
|
</div>
|
|
</div>
|
|
<div class="input-group mb-2">
|
|
<span class="input-group-text"><i class="fas fa-key"></i></span>
|
|
<input class="form-control" type="password" placeholder="Password" @bind="objUser.PasswordHash" />
|
|
</div>
|
|
<div class="input-group mb-2">
|
|
<span class="input-group-text"><i class="fas fa-user-tag"></i></span>
|
|
@if (MultiRoleEnab)
|
|
{
|
|
<select @bind="CurrUserRoles" multiple class="form-control">
|
|
@foreach (var option in RolesList)
|
|
{
|
|
<option value="@option">
|
|
@option
|
|
</option>
|
|
}
|
|
</select>
|
|
}
|
|
else
|
|
{
|
|
<select class="form-select" @bind="@CurrentUserRole">
|
|
@foreach (var option in RolesList)
|
|
{
|
|
<option value="@option">
|
|
@option
|
|
</option>
|
|
}
|
|
</select>
|
|
}
|
|
</div>
|
|
|
|
<div class="input-group mb-2">
|
|
@if (MultiClaimEnab)
|
|
{
|
|
<CmpClaimEdit Value="CurrentUserClaims"></CmpClaimEdit>
|
|
@* foreach (var cClaim in CurrentUserClaims)
|
|
{
|
|
<CmpClaimEdit CurrClaim="cClaim" E_Added="AddClaim" E_Removed="RemClaim" ></CmpClaimEdit>
|
|
} *@
|
|
}
|
|
else
|
|
{
|
|
<span class="input-group-text"><i class="fas fa-tag"></i></span>
|
|
<select class="form-select" @bind="@CurrentUserClaimType">
|
|
@foreach (var option in ClaimsList)
|
|
{
|
|
<option value="@option">
|
|
@option
|
|
</option>
|
|
}
|
|
</select>
|
|
<select class="form-select" @bind="@CurrentUserClaimVal">
|
|
<option value="0">--- Selezionare ---</option>
|
|
@foreach (var option in ClaimValList)
|
|
{
|
|
<option value="@option.Key">
|
|
@option.Value
|
|
</option>
|
|
}
|
|
</select>
|
|
}
|
|
</div>
|
|
<span style="color:red">@strError</span>
|
|
<hr />
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<button class="btn w-100 btn-success" @onclick="SaveUser" title="Save"><i class="fas fa-check"></i> Save</button>
|
|
</div>
|
|
<div class="col-6">
|
|
<button class="btn w-100 btn-primary" @onclick="ClosePopup"><i class="far fa-window-close"></i> Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<!-- Only show Id if not a new user -->
|
|
@if (objUser.Id != "")
|
|
{
|
|
<QrCodeDisplayJS rawCode="@qrCodeVal" Height="450" Width="450"></QrCodeDisplayJS>
|
|
}
|
|
<CopyToClipboard Text="@qrCodeVal"></CopyToClipboard>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<div class="d-flex justify-content-between">
|
|
<div class="px-1 text-truncate">
|
|
<h3>User Administration</h3>
|
|
</div>
|
|
<div class="px-1">
|
|
<div class="input-group">
|
|
<span class="input-group-text"><i class="fas fa-user-tag"></i></span>
|
|
<select class="form-select" @bind="@FiltUserRole">
|
|
<option value="0">--- Tutti ---</option>
|
|
@foreach (var option in RolesList)
|
|
{
|
|
<option value="@option">
|
|
@option
|
|
</option>
|
|
}
|
|
</select>
|
|
<AuthorizeView>
|
|
<Authorized>
|
|
@if (@context.User.IsInRole("SuperAdmin"))
|
|
{
|
|
<button class="btn btn-success btn-block" @onclick="AddNewUser"><i class="fa-solid fa-user-plus"></i> Add User</button>
|
|
}
|
|
</Authorized>
|
|
</AuthorizeView>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<table class="table table-sm table-striped table-responsive-md">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>Id</th>
|
|
<th>User / Email</th>
|
|
<th>Ruolo</th>
|
|
<th>Permessi</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var user in UsersList)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@if (!ShowPopup)
|
|
{
|
|
<button class="btn btn-sm btn-primary" @onclick="(() => EditUser(user.Identity))" title="Edit">
|
|
<i class="fas fa-pen"></i>
|
|
</button>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-sm btn-secondary disabled" title="Edit">
|
|
<i class="fas fa-pen"></i>
|
|
</button>
|
|
}
|
|
</td>
|
|
<td>@user.Identity.Id.Substring(0, 8)...</td>
|
|
<td>
|
|
@if (user.Identity.EmailConfirmed)
|
|
{
|
|
<span class="badge rounded-pill text-bg-success" title="Email validata"><span class="oi oi-check" aria-hidden="true"></span></span>
|
|
}
|
|
else
|
|
{
|
|
<span class="badge rounded-pill text-bg-danger" title="Email NON ancora validata!"><span class="oi oi-check" aria-hidden="true"></span></span>
|
|
}
|
|
@user.Identity.Email
|
|
</td>
|
|
<td>
|
|
@ShowRoles(user.Roles)
|
|
</td>
|
|
<td>
|
|
@ShowClaims(user.Claims)
|
|
</td>
|
|
<td>
|
|
@if (!ShowPopup)
|
|
{
|
|
<button class="btn btn-sm btn-danger" @onclick="(() => DeleteUser(user.Identity))" title="Delete">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-sm btn-secondary disabled" title="Delete">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="card-footer">
|
|
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
|
</div>
|
|
</div> |