INserito profilatura preliminare permessi encessari x vari ruoli
This commit is contained in:
@@ -81,16 +81,18 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
// verifico ruoli...
|
||||
if (user != null)
|
||||
{
|
||||
bool needCreate = true;
|
||||
// Gestione salvataggio ruoli... SE VARIATO...
|
||||
var UserRoles = await _userManager.GetRolesAsync(user);
|
||||
if (UserRoles != null && UserRoles.Count > 0)
|
||||
{
|
||||
var oldRole = UserRoles.Where(x => x == ADMIN_ROLE).FirstOrDefault();
|
||||
if (oldRole == null)
|
||||
{
|
||||
// aggiungo a ruolo admin
|
||||
await _userManager.AddToRoleAsync(user, ADMIN_ROLE);
|
||||
}
|
||||
needCreate = (oldRole == null);
|
||||
}
|
||||
if (needCreate)
|
||||
{
|
||||
// aggiungo a ruolo admin
|
||||
await _userManager.AddToRoleAsync(user, ADMIN_ROLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +103,7 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
|
||||
public async Task OnGetAsync(string returnUrl = null)
|
||||
{
|
||||
CheckSuperAdmin();
|
||||
await CheckSuperAdmin();
|
||||
if (!string.IsNullOrEmpty(ErrorMessage))
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, ErrorMessage);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-route-returnUrl="@Model.ReturnUrl" method="post">
|
||||
<h4>Create a new account.</h4>
|
||||
<h4>Creazione nuovo account.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
@@ -27,41 +27,41 @@
|
||||
<input asp-for="Input.ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Register</button>
|
||||
<button type="submit" class="btn btn-primary">Registra</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-6 col-md-offset-2">
|
||||
<section>
|
||||
<h4>Use another service to register.</h4>
|
||||
<hr />
|
||||
@{
|
||||
if ((Model.ExternalLogins?.Count ?? 0) == 0)
|
||||
{
|
||||
<div>
|
||||
<p>
|
||||
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
|
||||
for details on setting up this ASP.NET application to support logging in via external services.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
||||
@*<div class="col-md-6 col-md-offset-2">
|
||||
<section>
|
||||
<h4>Use another service to register.</h4>
|
||||
<hr />
|
||||
@{
|
||||
if ((Model.ExternalLogins?.Count ?? 0) == 0)
|
||||
{
|
||||
<div>
|
||||
<p>
|
||||
@foreach (var provider in Model.ExternalLogins)
|
||||
{
|
||||
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
|
||||
}
|
||||
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
|
||||
for details on setting up this ASP.NET application to support logging in via external services.
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
else
|
||||
{
|
||||
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
||||
<div>
|
||||
<p>
|
||||
@foreach (var provider in Model.ExternalLogins)
|
||||
{
|
||||
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<partial name="_ValidationScriptsPartial" />
|
||||
}
|
||||
}
|
||||
@@ -83,8 +83,8 @@ namespace GWMS.UI.Areas.Identity.Pages.Account
|
||||
values: new { area = "Identity", userId = user.Id, code = code, returnUrl = returnUrl },
|
||||
protocol: Request.Scheme);
|
||||
|
||||
await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
|
||||
$"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
|
||||
await _emailSender.SendEmailAsync(Input.Email, "GWMS: Richiesta conferma email",
|
||||
$"Prego cliccare sul <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>seguente link</a> per confermare l'account registrato con questa email.");
|
||||
|
||||
if (_userManager.Options.SignIn.RequireConfirmedAccount)
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<div class="row pt-3">
|
||||
<div class="col-6 col-md-5 col-lg-4 col-xl-3 px-0 text-truncate">
|
||||
<div class="col-6 col-sm-6 col-lg-4 col-xl-3">
|
||||
<LoginDisplay></LoginDisplay>
|
||||
</div>
|
||||
<div class="col-12 col-md-2 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 px-1 text-truncate">
|
||||
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
|
||||
<span class="@PageIcon" aria-hidden="true"></span> @PageName
|
||||
</div>
|
||||
<div class="col-6 col-md-5 col-lg-4 col-xl-3 text-right pl-0">
|
||||
<div class="col-6 col-sm-6 col-lg-4 col-xl-3 text-right">
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
|
||||
@@ -4,26 +4,23 @@
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<div class="input-group">
|
||||
<div class="input-group text-truncate">
|
||||
<div class="input-group-prepend">
|
||||
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger ml-3"><i class="fas fa-sign-out-alt"></i></a>
|
||||
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger"><i class="fas fa-sign-out-alt"></i></a>
|
||||
</div>
|
||||
<a title="Manage" href="Identity/Account/Manage" class="btn btn-sm btn-outline-dark mx-0 px-1">
|
||||
<i class="fas fa-user-alt"></i> @userName
|
||||
<i class="fas fa-user-alt"></i> @userName.Substring(0, 10) ...
|
||||
</a>
|
||||
</div>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success ml-3"><i class="fas fa-sign-in-alt"></i></a>
|
||||
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success"><i class="fas fa-sign-in-alt"></i></a>
|
||||
</div>
|
||||
<div class="form-control form-control-sm">
|
||||
<i class="fas fa-user-alt"></i> @userName
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<a title="Register" href="Identity/Account/Register" class="btn btn-sm btn-primary ml-0"><i class="fas fa-edit"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Version>1.0.2108.2516</Version>
|
||||
<Version>1.0.2108.2517</Version>
|
||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using BlazorBarcodeScanner.ZXing.JS;
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class GasStation : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
@@ -10,6 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class Orders : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GWMS.Data.DTO;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin")]
|
||||
public partial class PlantStatus : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
@@ -10,6 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class Suppliers : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
@@ -10,6 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, UserExt")]
|
||||
public partial class Transporters : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
@@ -11,6 +12,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
||||
public partial class UserManager : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.Data.DTO;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
@@ -11,6 +12,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace GWMS.UI.Pages
|
||||
{
|
||||
[Authorize(Roles = "SuperAdmin, Admin")]
|
||||
public partial class WeekPlan : ComponentBase
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GWMS - Gas Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2108.2516</h4>
|
||||
<h4>Versione: 1.0.2108.2517</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2108.2516
|
||||
1.0.2108.2517
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2108.2516</version>
|
||||
<version>1.0.2108.2517</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user