Aggiunta preliminare migration (da validare)
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GWMS.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace GWMS.User.Migrations
|
||||
{
|
||||
[DbContext(typeof(UserIdentityDbContext))]
|
||||
[Migration("20210824143900_UndefRoleAdd")]
|
||||
partial class UndefRoleAdd
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.8");
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = "bf698c1c-ead1-4d88-83ef-536098876807",
|
||||
ConcurrencyStamp = "28d97b49-8df4-4d20-8680-1d3abbf4ed94",
|
||||
Name = "Undef",
|
||||
NormalizedName = "UNDEF"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "a1280bf2-7e5a-447b-b070-3bea27ba2239",
|
||||
ConcurrencyStamp = "d361332c-1ae0-486c-b1d8-1f2c9c36ad88",
|
||||
Name = "ExtUser",
|
||||
NormalizedName = "EXTUSER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "533995b8-8561-471a-b613-a03685141065",
|
||||
ConcurrencyStamp = "773db769-a518-406f-9144-31e1fd9f7a76",
|
||||
Name = "User",
|
||||
NormalizedName = "USER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "d4790e4e-600b-4bae-876d-04c619adc9b0",
|
||||
ConcurrencyStamp = "70529623-7648-4640-b69e-a1e0ddff10ed",
|
||||
Name = "Admin",
|
||||
NormalizedName = "ADMINISTRATOR"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "3e7ddc7b-94eb-4364-b4d5-311c76dad5b1",
|
||||
ConcurrencyStamp = "1d59afd3-30f6-492c-87eb-cddf0b251f85",
|
||||
Name = "SuperAdmin",
|
||||
NormalizedName = "SUPERADMINISTRATOR"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("varchar(128)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("varchar(128)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("varchar(128)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("varchar(128)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace GWMS.User.Migrations
|
||||
{
|
||||
public partial class UndefRoleAdd : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "0a5335f9-64b2-4196-9d5b-db873cb48d94");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "24a790ae-8eac-4c9f-9043-aa688b626169");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "7a024dca-5e5d-47be-b754-75c8921d88bf");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "f6aa57e0-fac5-45b7-8e27-fd01d8eff87d");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ "bf698c1c-ead1-4d88-83ef-536098876807", "28d97b49-8df4-4d20-8680-1d3abbf4ed94", "Undef", "UNDEF" },
|
||||
{ "a1280bf2-7e5a-447b-b070-3bea27ba2239", "d361332c-1ae0-486c-b1d8-1f2c9c36ad88", "ExtUser", "EXTUSER" },
|
||||
{ "533995b8-8561-471a-b613-a03685141065", "773db769-a518-406f-9144-31e1fd9f7a76", "User", "USER" },
|
||||
{ "d4790e4e-600b-4bae-876d-04c619adc9b0", "70529623-7648-4640-b69e-a1e0ddff10ed", "Admin", "ADMINISTRATOR" },
|
||||
{ "3e7ddc7b-94eb-4364-b4d5-311c76dad5b1", "1d59afd3-30f6-492c-87eb-cddf0b251f85", "SuperAdmin", "SUPERADMINISTRATOR" }
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "3e7ddc7b-94eb-4364-b4d5-311c76dad5b1");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "533995b8-8561-471a-b613-a03685141065");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "a1280bf2-7e5a-447b-b070-3bea27ba2239");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "bf698c1c-ead1-4d88-83ef-536098876807");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: "d4790e4e-600b-4bae-876d-04c619adc9b0");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ "24a790ae-8eac-4c9f-9043-aa688b626169", "c9adff6c-ffac-48e3-899b-8549ca443071", "ExtUser", "EXTUSER" },
|
||||
{ "7a024dca-5e5d-47be-b754-75c8921d88bf", "3b9aab89-73b6-4051-9825-d5381d2896da", "User", "USER" },
|
||||
{ "0a5335f9-64b2-4196-9d5b-db873cb48d94", "25097cab-df45-4bdd-8616-041962c72050", "Admin", "ADMINISTRATOR" },
|
||||
{ "f6aa57e0-fac5-45b7-8e27-fd01d8eff87d", "3c222fe9-d5e5-4ba0-9767-4c1777677105", "SuperAdmin", "SUPERADMINISTRATOR" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,29 +45,36 @@ namespace GWMS.User.Migrations
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = "24a790ae-8eac-4c9f-9043-aa688b626169",
|
||||
ConcurrencyStamp = "c9adff6c-ffac-48e3-899b-8549ca443071",
|
||||
Id = "bf698c1c-ead1-4d88-83ef-536098876807",
|
||||
ConcurrencyStamp = "28d97b49-8df4-4d20-8680-1d3abbf4ed94",
|
||||
Name = "Undef",
|
||||
NormalizedName = "UNDEF"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "a1280bf2-7e5a-447b-b070-3bea27ba2239",
|
||||
ConcurrencyStamp = "d361332c-1ae0-486c-b1d8-1f2c9c36ad88",
|
||||
Name = "ExtUser",
|
||||
NormalizedName = "EXTUSER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "7a024dca-5e5d-47be-b754-75c8921d88bf",
|
||||
ConcurrencyStamp = "3b9aab89-73b6-4051-9825-d5381d2896da",
|
||||
Id = "533995b8-8561-471a-b613-a03685141065",
|
||||
ConcurrencyStamp = "773db769-a518-406f-9144-31e1fd9f7a76",
|
||||
Name = "User",
|
||||
NormalizedName = "USER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "0a5335f9-64b2-4196-9d5b-db873cb48d94",
|
||||
ConcurrencyStamp = "25097cab-df45-4bdd-8616-041962c72050",
|
||||
Id = "d4790e4e-600b-4bae-876d-04c619adc9b0",
|
||||
ConcurrencyStamp = "70529623-7648-4640-b69e-a1e0ddff10ed",
|
||||
Name = "Admin",
|
||||
NormalizedName = "ADMINISTRATOR"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "f6aa57e0-fac5-45b7-8e27-fd01d8eff87d",
|
||||
ConcurrencyStamp = "3c222fe9-d5e5-4ba0-9767-4c1777677105",
|
||||
Id = "3e7ddc7b-94eb-4364-b4d5-311c76dad5b1",
|
||||
ConcurrencyStamp = "1d59afd3-30f6-492c-87eb-cddf0b251f85",
|
||||
Name = "SuperAdmin",
|
||||
NormalizedName = "SUPERADMINISTRATOR"
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace GWMS.Data
|
||||
public void Configure(EntityTypeBuilder<IdentityRole> builder)
|
||||
{
|
||||
builder.HasData(
|
||||
new IdentityRole { Name = "Undef", NormalizedName = "UNDEF" },
|
||||
new IdentityRole { Name = "ExtUser", NormalizedName = "EXTUSER" },
|
||||
new IdentityRole { Name = "User", NormalizedName = "USER" },
|
||||
new IdentityRole { Name = "Admin", NormalizedName = "ADMINISTRATOR" },
|
||||
|
||||
@@ -19,10 +19,16 @@ namespace GWMS.User.Areas.Identity.Pages.Account
|
||||
[AllowAnonymous]
|
||||
public class RegisterModel : PageModel
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private readonly IEmailSender _emailSender;
|
||||
private readonly ILogger<RegisterModel> _logger;
|
||||
private readonly SignInManager<IdentityUser> _signInManager;
|
||||
private readonly UserManager<IdentityUser> _userManager;
|
||||
private readonly ILogger<RegisterModel> _logger;
|
||||
private readonly IEmailSender _emailSender;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public RegisterModel(
|
||||
UserManager<IdentityUser> userManager,
|
||||
@@ -36,31 +42,20 @@ namespace GWMS.User.Areas.Identity.Pages.Account
|
||||
_emailSender = emailSender;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public IList<AuthenticationScheme> ExternalLogins { get; set; }
|
||||
|
||||
[BindProperty]
|
||||
public InputModel Input { get; set; }
|
||||
|
||||
public string ReturnUrl { get; set; }
|
||||
|
||||
public IList<AuthenticationScheme> ExternalLogins { get; set; }
|
||||
#endregion Public Properties
|
||||
|
||||
public class InputModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
#region Public Methods
|
||||
|
||||
public async Task OnGetAsync(string returnUrl = null)
|
||||
{
|
||||
@@ -97,6 +92,10 @@ namespace GWMS.User.Areas.Identity.Pages.Account
|
||||
}
|
||||
else
|
||||
{
|
||||
// aggiunta ruolo UNDEF (da sistemare poi)
|
||||
// https://code-maze.com/using-roles-in-blazor-webassembly-hosted-applications/
|
||||
await _userManager.AddToRoleAsync(user, "Undef");
|
||||
// continuo come default
|
||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
||||
return LocalRedirect(returnUrl);
|
||||
}
|
||||
@@ -110,5 +109,34 @@ namespace GWMS.User.Areas.Identity.Pages.Account
|
||||
// If we got this far, something failed, redisplay form
|
||||
return Page();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class InputModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,21 +17,19 @@
|
||||
<span class="oi oi-plus" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="fetchdata">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
|
||||
</NavLink>
|
||||
</li>
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="fetchdata">
|
||||
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
|
||||
<NavLink class="nav-link" href="UserAdmin">
|
||||
<span class="oi oi-people" aria-hidden="true"></span> UserAdmin
|
||||
</NavLink>
|
||||
</li>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<li class="nav-item px-3">
|
||||
<div class="alert alert-warning">
|
||||
<p>Accesso riservato</p>
|
||||
</div>
|
||||
</li>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -111,6 +111,10 @@ namespace GWMS.User
|
||||
|
||||
services.AddRazorPages();
|
||||
|
||||
// rif auth
|
||||
// https://stackoverflow.com/questions/60687879/require-authorization-on-all-blazor-pages/60688109#60688109
|
||||
// https://www.c-sharpcorner.com/article/understand-basic-of-authorization-in-blazor-server-app/#:~:text=Authentication%20is%20a%20process%20of%20validating%20a%20user,UI%20option%20can%20be%20accessible%20by%20the%20user.
|
||||
|
||||
// non funziona --> messo attributo in _Imports.razor e esclusione in Index page
|
||||
#if false
|
||||
// richiesta esplicita autorizzazione
|
||||
|
||||
Reference in New Issue
Block a user