aggiunta seed x utenti

This commit is contained in:
zaccaria.majid
2023-03-08 17:23:14 +01:00
parent cdd8063887
commit aaff2d464b
8 changed files with 1066 additions and 15 deletions
@@ -36,6 +36,7 @@ namespace WebDoorCreator.Data
base.OnModelCreating(builder);
builder.ApplyConfiguration(new RoleConfiguration());
builder.ApplyConfiguration(new UserConfiguration());
}
}
@@ -0,0 +1,358 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebDoorCreator.Data;
#nullable disable
namespace WebDoorCreator.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230308155746_UsersAdd")]
partial class UsersAdd
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.14")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = "31011aea-c9a3-4f34-a9fd-7b7a4bcbefa6",
ConcurrencyStamp = "32cd475f-bbe2-4940-bfd1-fe26cafd4fae",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "c9cb6d11-c9a5-43d8-bd04-70be1724ba4a",
ConcurrencyStamp = "07b2ba6d-4f23-43d1-b48c-5b05d14b7e7e",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
},
new
{
Id = "be0e13af-b32e-490d-b798-36e090e91727",
ConcurrencyStamp = "8bf806ed-63c9-4f86-b20e-836296469772",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "a5ab56f6-fba3-434d-b316-e5bac2631411",
ConcurrencyStamp = "22a4245e-1026-4990-97ce-9e4a851b0f23",
Name = "CompAdmin",
NormalizedName = "COMPADMIN"
},
new
{
Id = "b904f672-414e-4782-b0a5-30c4a0d952f5",
ConcurrencyStamp = "f5e19beb-0c79-41b7-9dee-9b276454eaf8",
Name = "CompUser",
NormalizedName = "COMPUSER"
},
new
{
Id = "2fab1179-1fee-42cd-b82f-396c346afdb8",
ConcurrencyStamp = "f891ca58-2241-46e1-873d-d234112df7d0",
Name = "User",
NormalizedName = "USER"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "798c9676-9aef-493a-888a-cecd3c3b58dc",
AccessFailedCount = 0,
ConcurrencyStamp = "41669fea-608a-4c69-9944-6ee7b8fd99eb",
Email = "zaccaria.majid@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "ZACCARIA.MAJID@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEJsF3vsrOHxvOKtFSMAA4zAQDTt40wlAriFY10kOd5l47GyAIY8KEUgU8ZERefx+Ug==",
PhoneNumberConfirmed = false,
SecurityStamp = "81cabf56-db25-4788-a47a-3dcbe2e76f02",
TwoFactorEnabled = false,
UserName = "zaccaria.majid@egalware.com"
},
new
{
Id = "c67ec685-d035-442f-be3a-f88d412e572a",
AccessFailedCount = 0,
ConcurrencyStamp = "3432d939-4b3c-46b3-b86c-8189cc91ff62",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAELYXZ1ywFpd+nhbxgno7Wl5BXnQaiYG4tgDf6LGRj+fKNXRW0wNesxadeiQXaSafFg==",
PhoneNumberConfirmed = false,
SecurityStamp = "2a467aa8-81a3-483d-9d87-825716966e6f",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
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,120 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebDoorCreator.Data.Migrations
{
public partial class UsersAdd : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "0bef594b-861c-4c48-b967-c408174074c6");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "2bdc3737-48c3-4340-b55d-1739eec7aede");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "2d778017-0768-47f4-b807-9094d4aa39c7");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "585875c2-1787-4c33-aa4d-dfa37ada8766");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "7444754d-5643-461b-a3c1-aeb8665631d7");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "9c1c4523-526d-4efa-af94-a24cb04312b8");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "2fab1179-1fee-42cd-b82f-396c346afdb8", "f891ca58-2241-46e1-873d-d234112df7d0", "User", "USER" },
{ "31011aea-c9a3-4f34-a9fd-7b7a4bcbefa6", "32cd475f-bbe2-4940-bfd1-fe26cafd4fae", "Undef", "UNDEF" },
{ "a5ab56f6-fba3-434d-b316-e5bac2631411", "22a4245e-1026-4990-97ce-9e4a851b0f23", "CompAdmin", "COMPADMIN" },
{ "b904f672-414e-4782-b0a5-30c4a0d952f5", "f5e19beb-0c79-41b7-9dee-9b276454eaf8", "CompUser", "COMPUSER" },
{ "be0e13af-b32e-490d-b798-36e090e91727", "8bf806ed-63c9-4f86-b20e-836296469772", "Admin", "ADMIN" },
{ "c9cb6d11-c9a5-43d8-bd04-70be1724ba4a", "07b2ba6d-4f23-43d1-b48c-5b05d14b7e7e", "SuperAdmin", "SUPERADMIN" }
});
migrationBuilder.InsertData(
table: "AspNetUsers",
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
values: new object[,]
{
{ "798c9676-9aef-493a-888a-cecd3c3b58dc", 0, "41669fea-608a-4c69-9944-6ee7b8fd99eb", "zaccaria.majid@egalware.com", true, false, null, "ZACCARIA.MAJID@EGALWARE.COM", null, "AQAAAAEAACcQAAAAEJsF3vsrOHxvOKtFSMAA4zAQDTt40wlAriFY10kOd5l47GyAIY8KEUgU8ZERefx+Ug==", null, false, "81cabf56-db25-4788-a47a-3dcbe2e76f02", false, "zaccaria.majid@egalware.com" },
{ "c67ec685-d035-442f-be3a-f88d412e572a", 0, "3432d939-4b3c-46b3-b86c-8189cc91ff62", "samuele.locatelli@egalware.com", true, false, null, "SAMUELE.LOCATELLI@EGALWARE.COM", null, "AQAAAAEAACcQAAAAELYXZ1ywFpd+nhbxgno7Wl5BXnQaiYG4tgDf6LGRj+fKNXRW0wNesxadeiQXaSafFg==", null, false, "2a467aa8-81a3-483d-9d87-825716966e6f", false, "samuele.locatelli@egalware.com" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "2fab1179-1fee-42cd-b82f-396c346afdb8");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "31011aea-c9a3-4f34-a9fd-7b7a4bcbefa6");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "a5ab56f6-fba3-434d-b316-e5bac2631411");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "b904f672-414e-4782-b0a5-30c4a0d952f5");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "be0e13af-b32e-490d-b798-36e090e91727");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "c9cb6d11-c9a5-43d8-bd04-70be1724ba4a");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "798c9676-9aef-493a-888a-cecd3c3b58dc");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "c67ec685-d035-442f-be3a-f88d412e572a");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "0bef594b-861c-4c48-b967-c408174074c6", "a470e2f3-6c5e-4123-bf2e-f6f8b4d11328", "Undef", "UNDEF" },
{ "2bdc3737-48c3-4340-b55d-1739eec7aede", "980f5e55-80d8-466d-8451-746acfa837d4", "SuperAdmin", "SUPERADMIN" },
{ "2d778017-0768-47f4-b807-9094d4aa39c7", "b83e70eb-09cd-4ac7-8571-c821029ae152", "Admin", "ADMIN" },
{ "585875c2-1787-4c33-aa4d-dfa37ada8766", "0b6d6096-d9b8-4abe-a6b7-4adac55afc37", "CompAdmin", "COMPADMIN" },
{ "7444754d-5643-461b-a3c1-aeb8665631d7", "9e3fac4e-50ec-437d-a968-a976ecdc27b5", "CompUser", "COMPUSER" },
{ "9c1c4523-526d-4efa-af94-a24cb04312b8", "9ab5dd98-2d81-4baf-b01c-62c0c893c086", "User", "USER" }
});
}
}
}
@@ -0,0 +1,358 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebDoorCreator.Data;
#nullable disable
namespace WebDoorCreator.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230308160217_UsersSeed")]
partial class UsersSeed
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.14")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = "7fb23328-c054-4b3d-92e0-f949745c8924",
ConcurrencyStamp = "d795b502-0429-4271-a12d-2549f1eb1b17",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "24f0ceab-fa6d-427a-8172-f18bfd1030c1",
ConcurrencyStamp = "d167b8a8-baff-4603-997a-4a1d77ae78f4",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
},
new
{
Id = "f5f76968-2225-482a-82ac-f54bd05390b3",
ConcurrencyStamp = "b54f1873-a97b-4bb1-9e61-7bd2db0a2316",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "6abfe01f-48f9-4a48-8e49-ac5f29a8753a",
ConcurrencyStamp = "e981295d-29b1-4805-a70e-3c83dc4bcfd7",
Name = "CompAdmin",
NormalizedName = "COMPADMIN"
},
new
{
Id = "23a4b811-4cb8-4143-9c73-b53a4f623f86",
ConcurrencyStamp = "0052a1f2-5648-4362-9834-0604870eef76",
Name = "CompUser",
NormalizedName = "COMPUSER"
},
new
{
Id = "549ec954-a966-484c-8db8-c7d839e8c4af",
ConcurrencyStamp = "84b61e19-8786-45e4-8977-af6466a87878",
Name = "User",
NormalizedName = "USER"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "6781dd86-4d05-44d6-9a15-8de87a2306c1",
AccessFailedCount = 0,
ConcurrencyStamp = "5787a2ad-495e-4a8a-8218-59f12848ff68",
Email = "zaccaria.majid@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "ZACCARIA.MAJID@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEAmlSOhSFJr3j4c3S+c5cx0BKnjMceNTcfqTr2gmjc7c4yPUOHdxE9E7EOjl3mlZkQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "5017ee27-44f3-4696-a6fe-eef7ee88efa4",
TwoFactorEnabled = false,
UserName = "zaccaria.majid@egalware.com"
},
new
{
Id = "19f4bf5d-a618-49a7-94a3-04c3044e6641",
AccessFailedCount = 0,
ConcurrencyStamp = "71b236df-7e0c-428c-aaf7-01783de0ccaf",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAECfL7qpxoqVW6JrwkI+s+R9ilrD78YbnoWbPT39ITZUpyXMiBxU33jMJLidNT0Ni/g==",
PhoneNumberConfirmed = false,
SecurityStamp = "761914b3-5500-4322-b4a2-14d150aeb858",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
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,139 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebDoorCreator.Data.Migrations
{
public partial class UsersSeed : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "2fab1179-1fee-42cd-b82f-396c346afdb8");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "31011aea-c9a3-4f34-a9fd-7b7a4bcbefa6");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "a5ab56f6-fba3-434d-b316-e5bac2631411");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "b904f672-414e-4782-b0a5-30c4a0d952f5");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "be0e13af-b32e-490d-b798-36e090e91727");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "c9cb6d11-c9a5-43d8-bd04-70be1724ba4a");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "798c9676-9aef-493a-888a-cecd3c3b58dc");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "c67ec685-d035-442f-be3a-f88d412e572a");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "23a4b811-4cb8-4143-9c73-b53a4f623f86", "0052a1f2-5648-4362-9834-0604870eef76", "CompUser", "COMPUSER" },
{ "24f0ceab-fa6d-427a-8172-f18bfd1030c1", "d167b8a8-baff-4603-997a-4a1d77ae78f4", "SuperAdmin", "SUPERADMIN" },
{ "549ec954-a966-484c-8db8-c7d839e8c4af", "84b61e19-8786-45e4-8977-af6466a87878", "User", "USER" },
{ "6abfe01f-48f9-4a48-8e49-ac5f29a8753a", "e981295d-29b1-4805-a70e-3c83dc4bcfd7", "CompAdmin", "COMPADMIN" },
{ "7fb23328-c054-4b3d-92e0-f949745c8924", "d795b502-0429-4271-a12d-2549f1eb1b17", "Undef", "UNDEF" },
{ "f5f76968-2225-482a-82ac-f54bd05390b3", "b54f1873-a97b-4bb1-9e61-7bd2db0a2316", "Admin", "ADMIN" }
});
migrationBuilder.InsertData(
table: "AspNetUsers",
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
values: new object[,]
{
{ "19f4bf5d-a618-49a7-94a3-04c3044e6641", 0, "71b236df-7e0c-428c-aaf7-01783de0ccaf", "samuele.locatelli@egalware.com", true, false, null, "SAMUELE.LOCATELLI@EGALWARE.COM", null, "AQAAAAEAACcQAAAAECfL7qpxoqVW6JrwkI+s+R9ilrD78YbnoWbPT39ITZUpyXMiBxU33jMJLidNT0Ni/g==", null, false, "761914b3-5500-4322-b4a2-14d150aeb858", false, "samuele.locatelli@egalware.com" },
{ "6781dd86-4d05-44d6-9a15-8de87a2306c1", 0, "5787a2ad-495e-4a8a-8218-59f12848ff68", "zaccaria.majid@egalware.com", true, false, null, "ZACCARIA.MAJID@EGALWARE.COM", null, "AQAAAAEAACcQAAAAEAmlSOhSFJr3j4c3S+c5cx0BKnjMceNTcfqTr2gmjc7c4yPUOHdxE9E7EOjl3mlZkQ==", null, false, "5017ee27-44f3-4696-a6fe-eef7ee88efa4", false, "zaccaria.majid@egalware.com" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "23a4b811-4cb8-4143-9c73-b53a4f623f86");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "24f0ceab-fa6d-427a-8172-f18bfd1030c1");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "549ec954-a966-484c-8db8-c7d839e8c4af");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "6abfe01f-48f9-4a48-8e49-ac5f29a8753a");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "7fb23328-c054-4b3d-92e0-f949745c8924");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "f5f76968-2225-482a-82ac-f54bd05390b3");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "19f4bf5d-a618-49a7-94a3-04c3044e6641");
migrationBuilder.DeleteData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "6781dd86-4d05-44d6-9a15-8de87a2306c1");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "2fab1179-1fee-42cd-b82f-396c346afdb8", "f891ca58-2241-46e1-873d-d234112df7d0", "User", "USER" },
{ "31011aea-c9a3-4f34-a9fd-7b7a4bcbefa6", "32cd475f-bbe2-4940-bfd1-fe26cafd4fae", "Undef", "UNDEF" },
{ "a5ab56f6-fba3-434d-b316-e5bac2631411", "22a4245e-1026-4990-97ce-9e4a851b0f23", "CompAdmin", "COMPADMIN" },
{ "b904f672-414e-4782-b0a5-30c4a0d952f5", "f5e19beb-0c79-41b7-9dee-9b276454eaf8", "CompUser", "COMPUSER" },
{ "be0e13af-b32e-490d-b798-36e090e91727", "8bf806ed-63c9-4f86-b20e-836296469772", "Admin", "ADMIN" },
{ "c9cb6d11-c9a5-43d8-bd04-70be1724ba4a", "07b2ba6d-4f23-43d1-b48c-5b05d14b7e7e", "SuperAdmin", "SUPERADMIN" }
});
migrationBuilder.InsertData(
table: "AspNetUsers",
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
values: new object[,]
{
{ "798c9676-9aef-493a-888a-cecd3c3b58dc", 0, "41669fea-608a-4c69-9944-6ee7b8fd99eb", "zaccaria.majid@egalware.com", true, false, null, "ZACCARIA.MAJID@EGALWARE.COM", null, "AQAAAAEAACcQAAAAEJsF3vsrOHxvOKtFSMAA4zAQDTt40wlAriFY10kOd5l47GyAIY8KEUgU8ZERefx+Ug==", null, false, "81cabf56-db25-4788-a47a-3dcbe2e76f02", false, "zaccaria.majid@egalware.com" },
{ "c67ec685-d035-442f-be3a-f88d412e572a", 0, "3432d939-4b3c-46b3-b86c-8189cc91ff62", "samuele.locatelli@egalware.com", true, false, null, "SAMUELE.LOCATELLI@EGALWARE.COM", null, "AQAAAAEAACcQAAAAELYXZ1ywFpd+nhbxgno7Wl5BXnQaiYG4tgDf6LGRj+fKNXRW0wNesxadeiQXaSafFg==", null, false, "2a467aa8-81a3-483d-9d87-825716966e6f", false, "samuele.locatelli@egalware.com" }
});
}
}
}
@@ -51,43 +51,43 @@ namespace WebDoorCreator.Data.Migrations
b.HasData(
new
{
Id = "0bef594b-861c-4c48-b967-c408174074c6",
ConcurrencyStamp = "a470e2f3-6c5e-4123-bf2e-f6f8b4d11328",
Id = "7fb23328-c054-4b3d-92e0-f949745c8924",
ConcurrencyStamp = "d795b502-0429-4271-a12d-2549f1eb1b17",
Name = "Undef",
NormalizedName = "UNDEF"
},
new
{
Id = "2bdc3737-48c3-4340-b55d-1739eec7aede",
ConcurrencyStamp = "980f5e55-80d8-466d-8451-746acfa837d4",
Id = "24f0ceab-fa6d-427a-8172-f18bfd1030c1",
ConcurrencyStamp = "d167b8a8-baff-4603-997a-4a1d77ae78f4",
Name = "SuperAdmin",
NormalizedName = "SUPERADMIN"
},
new
{
Id = "2d778017-0768-47f4-b807-9094d4aa39c7",
ConcurrencyStamp = "b83e70eb-09cd-4ac7-8571-c821029ae152",
Id = "f5f76968-2225-482a-82ac-f54bd05390b3",
ConcurrencyStamp = "b54f1873-a97b-4bb1-9e61-7bd2db0a2316",
Name = "Admin",
NormalizedName = "ADMIN"
},
new
{
Id = "585875c2-1787-4c33-aa4d-dfa37ada8766",
ConcurrencyStamp = "0b6d6096-d9b8-4abe-a6b7-4adac55afc37",
Id = "6abfe01f-48f9-4a48-8e49-ac5f29a8753a",
ConcurrencyStamp = "e981295d-29b1-4805-a70e-3c83dc4bcfd7",
Name = "CompAdmin",
NormalizedName = "COMPADMIN"
},
new
{
Id = "7444754d-5643-461b-a3c1-aeb8665631d7",
ConcurrencyStamp = "9e3fac4e-50ec-437d-a968-a976ecdc27b5",
Id = "23a4b811-4cb8-4143-9c73-b53a4f623f86",
ConcurrencyStamp = "0052a1f2-5648-4362-9834-0604870eef76",
Name = "CompUser",
NormalizedName = "COMPUSER"
},
new
{
Id = "9c1c4523-526d-4efa-af94-a24cb04312b8",
ConcurrencyStamp = "9ab5dd98-2d81-4baf-b01c-62c0c893c086",
Id = "549ec954-a966-484c-8db8-c7d839e8c4af",
ConcurrencyStamp = "84b61e19-8786-45e4-8977-af6466a87878",
Name = "User",
NormalizedName = "USER"
});
@@ -181,6 +181,38 @@ namespace WebDoorCreator.Data.Migrations
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
b.HasData(
new
{
Id = "6781dd86-4d05-44d6-9a15-8de87a2306c1",
AccessFailedCount = 0,
ConcurrencyStamp = "5787a2ad-495e-4a8a-8218-59f12848ff68",
Email = "zaccaria.majid@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "ZACCARIA.MAJID@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAEAmlSOhSFJr3j4c3S+c5cx0BKnjMceNTcfqTr2gmjc7c4yPUOHdxE9E7EOjl3mlZkQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "5017ee27-44f3-4696-a6fe-eef7ee88efa4",
TwoFactorEnabled = false,
UserName = "zaccaria.majid@egalware.com"
},
new
{
Id = "19f4bf5d-a618-49a7-94a3-04c3044e6641",
AccessFailedCount = 0,
ConcurrencyStamp = "71b236df-7e0c-428c-aaf7-01783de0ccaf",
Email = "samuele.locatelli@egalware.com",
EmailConfirmed = true,
LockoutEnabled = false,
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
PasswordHash = "AQAAAAEAACcQAAAAECfL7qpxoqVW6JrwkI+s+R9ilrD78YbnoWbPT39ITZUpyXMiBxU33jMJLidNT0Ni/g==",
PhoneNumberConfirmed = false,
SecurityStamp = "761914b3-5500-4322-b4a2-14d150aeb858",
TwoFactorEnabled = false,
UserName = "samuele.locatelli@egalware.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
@@ -25,6 +25,9 @@ namespace WebDoorCreator.Data
#endif
//aggiungo hasher per pw
//Creo la relazione tra utente e ruolo nella tabella userRoles
#if false
var hasher = new PasswordHasher<IdentityUser>();
// inizializzazione dei valori di default x USER
@@ -37,9 +40,6 @@ namespace WebDoorCreator.Data
EmailConfirmed = true,
PasswordHash = hasher.HashPassword(null, "Pa$$w0rd"),
});
//Creo la relazione tra utente e ruolo nella tabella userRoles
#if false
modelBuilder.Entity<IdentityUserRole<string>>().HasData(
new IdentityUserRole<string>
{
+43
View File
@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection.Emit;
namespace WebDoorCreator.Data
{
public class UserConfiguration : IEntityTypeConfiguration<IdentityUser>
{
#region Public Methods
public void Configure(EntityTypeBuilder<IdentityUser> builder)
{
var hasher = new PasswordHasher<IdentityUser>();
// inizializzazione dei valori di default x USER
builder.HasData(
new IdentityUser
{
UserName = "zaccaria.majid@egalware.com",
Email = "zaccaria.majid@egalware.com",
NormalizedEmail = "ZACCARIA.MAJID@EGALWARE.COM",
EmailConfirmed = true,
PasswordHash = hasher.HashPassword(null, "th1sIsTh3R1vrOfThNgt98"),
},
new IdentityUser
{
UserName = "samuele.locatelli@egalware.com",
Email = "samuele.locatelli@egalware.com",
NormalizedEmail = "SAMUELE.LOCATELLI@EGALWARE.COM",
EmailConfirmed = true,
PasswordHash = hasher.HashPassword(null, "th1sIsTh3R1vrOfThNgt96"),
});
}
#endregion Public Methods
}
}