Revisione modello dati x user/auth

This commit is contained in:
Samuele Locatelli
2021-06-22 16:41:30 +02:00
parent e75cf7d883
commit b743478cae
11 changed files with 198 additions and 560 deletions
+6 -6
View File
@@ -43,9 +43,9 @@ namespace GWMS.Data.Controllers
// imposto limiti e valori attuali...
//currPlant.LevelMax = rnd.Next(24, 28) * 1000;
int simLevel = rnd.Next(1, (int)currPlant.LevelMax);
double simPress = (double)rnd.Next((int)(currPlant.PressMax - 15) * 10, (int)currPlant.PressMax * 10) / 10;
double simPressH = (double)rnd.Next((int)(currPlant.PressBHMax - 20) * 10, (int)currPlant.PressBHMax * 10) / 10;
double simPressL = (double)rnd.Next((int)(currPlant.PressBLMax - 20) * 10, (int)currPlant.PressBLMax * 10) / 10;
double simPress = (double)rnd.Next((int)(currPlant.PressMax - 50) * 10, (int)currPlant.PressMax * 10) / 10;
double simPressH = (double)rnd.Next((int)(currPlant.PressBHMax - 70) * 10, (int)currPlant.PressBHMax * 10) / 10;
double simPressL = (double)rnd.Next((int)(currPlant.PressBLMax - 70) * 10, (int)currPlant.PressBLMax * 10) / 10;
currPlant.LevelAct = simLevel;
currPlant.PressAct = simPress;
currPlant.PressBHAct = simPressH;
@@ -88,9 +88,9 @@ namespace GWMS.Data.Controllers
LogLevels.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "Level", PlantId = plant.PlantId, ValNumber = lastLevel });
// pressioni!
lastPress = lastPress - (double)rnd.Next(-30, 28) / 10;
lastPressH = lastPressH - (double)rnd.Next(-100, 90) / 10;
lastPressL = lastPressL - (double)rnd.Next(-100, 90) / 10;
lastPress = lastPress - (double)rnd.Next(-30, 25) / 10;
lastPressH = lastPressH - (double)rnd.Next(-25, 20) / 10;
lastPressL = lastPressL - (double)rnd.Next(-25, 20) / 10;
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "MainPress", PlantId = plant.PlantId, ValNumber = lastPress });
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "PressBH", PlantId = plant.PlantId, ValNumber = lastPressH });
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "PressBL", PlantId = plant.PlantId, ValNumber = lastPressL });
-31
View File
@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace GWMS.Data.DatabaseModels
{
/// <summary>
/// Tabella Roles
/// </summary>
[Table("Auths")]
public class AuthModel
{
#region Public Properties
[Key, Column("AuthRole", Order = 0), MaxLength(50)]
public string AuthRole { get; set; } = "";
[Column("Description", Order = 1), MaxLength(250)]
public string Description { get; set; } = "";
#endregion Public Properties
}
}
-40
View File
@@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace GWMS.Data.DatabaseModels
{
/// <summary>
/// Tabella User Authorizations
/// </summary>
[Table("UserAuth")]
public class UserAuthModel
{
#region Public Properties
[Column(Order = 0)]
public int UserId { get; set; }
[Column(Order = 1)]
public string AuthRole { get; set; } = "";
[Column(Order = 2)]
public int AuthLevel { get; set; } = 0;
[ForeignKey("AuthRole")]
public virtual AuthModel Role { get; set; }
[ForeignKey("UserId")]
public virtual UserModel User { get; set; }
#endregion Public Properties
}
}
+12
View File
@@ -47,6 +47,18 @@ namespace GWMS.Data.DatabaseModels
[Column(Order = 8)]
public bool IsActive { get; set; } = true;
[Column(Order = 9)]
public UserLevel Livello { get; set; } = UserLevel.ND;
[Column(Order = 10)]
public int MaskPlantId { get; set; } = 9999;
[Column(Order = 11)]
public int MaskSupplierId { get; set; } = 9999;
[Column(Order = 12)]
public int MaskTranspId { get; set; } = 9999;
#endregion Public Properties
}
}
+6 -2
View File
@@ -1,8 +1,12 @@
using System;
namespace GWMS.UI.Data
namespace GWMS.Data
{
public class Enum
public enum UserLevel
{
ND = 0,
SuperAdmin = 1,
Admin = 2,
User = 3
}
}
-1
View File
@@ -26,7 +26,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Resources\" />
</ItemGroup>
</Project>
-4
View File
@@ -39,7 +39,6 @@ namespace GWMS.Data
#region Public Properties
public virtual DbSet<AuthModel> DbSetAuth { get; set; }
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
public virtual DbSet<ItemModel> DbSetItems { get; set; }
@@ -54,7 +53,6 @@ namespace GWMS.Data
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
public virtual DbSet<TransporterModel> DbSetTransporter { get; set; }
public virtual DbSet<UserModel> DbSetUser { get; set; }
public virtual DbSet<UserAuthModel> DbSetUserAuth { get; set; }
#endregion Public Properties
@@ -109,8 +107,6 @@ namespace GWMS.Data
modelBuilder.Entity<ListValModel>().HasKey(c => new { c.TabName, c.FieldName, c.Val });
modelBuilder.Entity<UserAuthModel>().HasKey(c => new { c.UserId, c.AuthRole });
modelBuilder.Entity<PlantStatusModel>().HasKey(c => new { c.PlantId, c.FluxType });
modelBuilder.Entity<PlantSupplWeekPlanModel>().HasKey(c => new { c.PlantId, c.SupplierId, c.DayNum });
@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GWMS.Data.Migrations
{
[DbContext(typeof(GWMSContext))]
[Migration("20210622134348_InitDb")]
[Migration("20210622144037_InitDb")]
partial class InitDb
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -45,50 +45,6 @@ namespace GWMS.Data.Migrations
b.ToTable("AnKeyVal");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b =>
{
b.Property<string>("AuthRole")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("AuthRole");
b.Property<string>("Description")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnName("Description");
b.HasKey("AuthRole");
b.ToTable("Auths");
b.HasData(
new
{
AuthRole = "SuperAdmin",
Description = "App SuperAdmin User"
},
new
{
AuthRole = "Admin",
Description = "Main SUpervisor User"
},
new
{
AuthRole = "PlantUser",
Description = "Plant User"
},
new
{
AuthRole = "Supplier",
Description = "Supplier User"
},
new
{
AuthRole = "Transporter",
Description = "Transporter User"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
{
b.Property<string>("KeyName")
@@ -466,7 +422,7 @@ namespace GWMS.Data.Migrations
TransporterId = 1,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7161),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4204),
TransporterCode = "TSIM01",
TransporterDesc = "Trasportatore SIM 01"
},
@@ -475,7 +431,7 @@ namespace GWMS.Data.Migrations
TransporterId = 2,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7724),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4773),
TransporterCode = "TSIM02",
TransporterDesc = "Trasportatore SIM 02"
},
@@ -484,7 +440,7 @@ namespace GWMS.Data.Migrations
TransporterId = 3,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7733),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4782),
TransporterCode = "TSIM03",
TransporterDesc = "Trasportatore SIM 03"
},
@@ -493,110 +449,12 @@ namespace GWMS.Data.Migrations
TransporterId = 4,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7736),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4785),
TransporterCode = "TSIM04",
TransporterDesc = "Trasportatore SIM 04"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("AuthRole")
.HasColumnType("varchar(50)");
b.Property<int>("AuthLevel")
.HasColumnType("int");
b.HasKey("UserId", "AuthRole");
b.HasIndex("AuthRole");
b.ToTable("UserAuth");
b.HasData(
new
{
UserId = 1,
AuthRole = "SuperAdmin",
AuthLevel = 1
},
new
{
UserId = 2,
AuthRole = "SuperAdmin",
AuthLevel = 1
},
new
{
UserId = 3,
AuthRole = "SuperAdmin",
AuthLevel = 1
},
new
{
UserId = 4,
AuthRole = "Admin",
AuthLevel = 1
},
new
{
UserId = 5,
AuthRole = "Admin",
AuthLevel = 1
},
new
{
UserId = 6,
AuthRole = "Supplier",
AuthLevel = 6
},
new
{
UserId = 7,
AuthRole = "Supplier",
AuthLevel = 7
},
new
{
UserId = 8,
AuthRole = "Transporter",
AuthLevel = 1
},
new
{
UserId = 9,
AuthRole = "Transporter",
AuthLevel = 2
},
new
{
UserId = 10,
AuthRole = "PlantUser",
AuthLevel = 1
},
new
{
UserId = 11,
AuthRole = "PlantUser",
AuthLevel = 2
},
new
{
UserId = 12,
AuthRole = "PlantUser",
AuthLevel = 3
},
new
{
UserId = 13,
AuthRole = "PlantUser",
AuthLevel = 4
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b =>
{
b.Property<int>("UserId")
@@ -626,6 +484,18 @@ namespace GWMS.Data.Migrations
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("Livello")
.HasColumnType("int");
b.Property<int>("MaskPlantId")
.HasColumnType("int");
b.Property<int>("MaskSupplierId")
.HasColumnType("int");
b.Property<int>("MaskTranspId")
.HasColumnType("int");
b.Property<string>("SaltPasswd")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
@@ -648,6 +518,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Locatelli",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "samuele.locatelli"
},
@@ -660,6 +534,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Rottoli",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "giancarlo.rottoli"
},
@@ -672,6 +550,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Admin",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "steamw.admin"
},
@@ -684,6 +566,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Pizzaferri",
Livello = 2,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "angelo.pizzaferri"
},
@@ -696,6 +582,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Valeanu",
Livello = 2,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "andrei.valeanu"
},
@@ -708,6 +598,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "LIQUIGAS",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 1,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "liquigas.user01"
},
@@ -720,6 +614,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "VULKANGAS",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 2,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "vulkangas.user01"
},
@@ -732,6 +630,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "LEVORATO",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 1,
SaltPasswd = "",
UserName = "levorato.user01"
},
@@ -744,6 +646,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "TRAFFIK",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 2,
SaltPasswd = "",
UserName = "traffik.user01"
},
@@ -756,6 +662,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Collecchio",
Livello = 3,
MaskPlantId = 1,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz03.user01"
},
@@ -768,6 +678,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Noceto",
Livello = 3,
MaskPlantId = 2,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz04.user01"
},
@@ -780,6 +694,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Baganzola",
Livello = 3,
MaskPlantId = 3,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz05.user01"
},
@@ -792,6 +710,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Pilastrello",
Livello = 3,
MaskPlantId = 4,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz08.user01"
});
@@ -864,25 +786,6 @@ namespace GWMS.Data.Migrations
b.Navigation("Supplier");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role")
.WithMany()
.HasForeignKey("AuthRole")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
#pragma warning restore 612, 618
}
}
@@ -30,21 +30,6 @@ namespace GWMS.Data.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Auths",
columns: table => new
{
AuthRole = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Auths", x => x.AuthRole);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Config",
columns: table => new
@@ -187,7 +172,11 @@ namespace GWMS.Data.Migrations
.Annotation("MySql:CharSet", "utf8mb4"),
AuthKey = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
Livello = table.Column<int>(type: "int", nullable: false),
MaskPlantId = table.Column<int>(type: "int", nullable: false),
MaskSupplierId = table.Column<int>(type: "int", nullable: false),
MaskTranspId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@@ -317,45 +306,6 @@ namespace GWMS.Data.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "UserAuth",
columns: table => new
{
UserId = table.Column<int>(type: "int", nullable: false),
AuthRole = table.Column<string>(type: "varchar(50)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AuthLevel = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserAuth", x => new { x.UserId, x.AuthRole });
table.ForeignKey(
name: "FK_UserAuth_Auths_AuthRole",
column: x => x.AuthRole,
principalTable: "Auths",
principalColumn: "AuthRole",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserAuth_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "Auths",
columns: new[] { "AuthRole", "Description" },
values: new object[,]
{
{ "SuperAdmin", "App SuperAdmin User" },
{ "Admin", "Main SUpervisor User" },
{ "PlantUser", "Plant User" },
{ "Supplier", "Supplier User" },
{ "Transporter", "Transporter User" }
});
migrationBuilder.InsertData(
table: "PlantDetail",
columns: new[] { "PlantId", "LevelAct", "LevelMax", "PlantCode", "PlantDesc", "PressAct", "PressBHAct", "PressBHMax", "PressBLAct", "PressBLMax", "PressMax" },
@@ -381,50 +331,30 @@ namespace GWMS.Data.Migrations
columns: new[] { "TransporterId", "PositionLatitude", "PositionLongitude", "PositionUpdated", "TransporterCode", "TransporterDesc" },
values: new object[,]
{
{ 4, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7736), "TSIM04", "Trasportatore SIM 04" },
{ 3, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7733), "TSIM03", "Trasportatore SIM 03" },
{ 1, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7161), "TSIM01", "Trasportatore SIM 01" },
{ 2, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7724), "TSIM02", "Trasportatore SIM 02" }
{ 1, 0.0, 0.0, new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4204), "TSIM01", "Trasportatore SIM 01" },
{ 2, 0.0, 0.0, new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4773), "TSIM02", "Trasportatore SIM 02" },
{ 3, 0.0, 0.0, new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4782), "TSIM03", "Trasportatore SIM 03" },
{ 4, 0.0, 0.0, new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4785), "TSIM04", "Trasportatore SIM 04" }
});
migrationBuilder.InsertData(
table: "Users",
columns: new[] { "UserId", "AuthKey", "Email", "Firstname", "IsActive", "Lang", "Lastname", "SaltPasswd", "UserName" },
columns: new[] { "UserId", "AuthKey", "Email", "Firstname", "IsActive", "Lang", "Lastname", "Livello", "MaskPlantId", "MaskSupplierId", "MaskTranspId", "SaltPasswd", "UserName" },
values: new object[,]
{
{ 12, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Baganzola", "", "piz05.user01" },
{ 1, "th1sIsTh3R1vrOfThNgt98", "samuele@steamware.net", "Samuele", true, "IT", "Locatelli", "", "samuele.locatelli" },
{ 2, "th1sIsTh3R1vrOfThNgt91", "giancarlo@steamware.net", "Giancarlo", true, "IT", "Rottoli", "", "giancarlo.rottoli" },
{ 3, "th1sIsTh3R1vrOfThNgt93", "info@steamware.net", "Steamware", true, "IT", "Admin", "", "steamw.admin" },
{ 4, "th1sIsTh3R1vrOfThNgt97", "a.pizzaferri@pizzaferripetroli.it", "Angelo", true, "IT", "Pizzaferri", "", "angelo.pizzaferri" },
{ 5, "th1sIsTh3R1vrOfThNgt99", "andrei.valeanu@winnlab.it", "Andrei", true, "IT", "Valeanu", "", "andrei.valeanu" },
{ 6, "th1sIsTh3R1vrOfThNgt92", "info@steamware.net", "User", true, "IT", "LIQUIGAS", "", "liquigas.user01" },
{ 7, "th1sIsTh3R1vrOfThNgt94", "info@steamware.net", "User", true, "IT", "VULKANGAS", "", "vulkangas.user01" },
{ 8, "th1sIsTh3R1vrOfThNgt95", "info@steamware.net", "User", true, "IT", "LEVORATO", "", "levorato.user01" },
{ 9, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "User", true, "IT", "TRAFFIK", "", "traffik.user01" },
{ 10, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Collecchio", "", "piz03.user01" },
{ 11, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Noceto", "", "piz04.user01" },
{ 13, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Pilastrello", "", "piz08.user01" }
});
migrationBuilder.InsertData(
table: "UserAuth",
columns: new[] { "AuthRole", "UserId", "AuthLevel" },
values: new object[,]
{
{ "SuperAdmin", 1, 1 },
{ "SuperAdmin", 2, 1 },
{ "SuperAdmin", 3, 1 },
{ "Admin", 4, 1 },
{ "Admin", 5, 1 },
{ "Supplier", 6, 6 },
{ "Supplier", 7, 7 },
{ "Transporter", 8, 1 },
{ "Transporter", 9, 2 },
{ "PlantUser", 10, 1 },
{ "PlantUser", 11, 2 },
{ "PlantUser", 12, 3 },
{ "PlantUser", 13, 4 }
{ 11, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Noceto", 3, 2, 0, 0, "", "piz04.user01" },
{ 10, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Collecchio", 3, 1, 0, 0, "", "piz03.user01" },
{ 9, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "User", true, "IT", "TRAFFIK", 3, 0, 0, 2, "", "traffik.user01" },
{ 8, "th1sIsTh3R1vrOfThNgt95", "info@steamware.net", "User", true, "IT", "LEVORATO", 3, 0, 0, 1, "", "levorato.user01" },
{ 7, "th1sIsTh3R1vrOfThNgt94", "info@steamware.net", "User", true, "IT", "VULKANGAS", 3, 0, 2, 0, "", "vulkangas.user01" },
{ 2, "th1sIsTh3R1vrOfThNgt91", "giancarlo@steamware.net", "Giancarlo", true, "IT", "Rottoli", 1, 0, 0, 0, "", "giancarlo.rottoli" },
{ 5, "th1sIsTh3R1vrOfThNgt99", "andrei.valeanu@winnlab.it", "Andrei", true, "IT", "Valeanu", 2, 0, 0, 0, "", "andrei.valeanu" },
{ 4, "th1sIsTh3R1vrOfThNgt97", "a.pizzaferri@pizzaferripetroli.it", "Angelo", true, "IT", "Pizzaferri", 2, 0, 0, 0, "", "angelo.pizzaferri" },
{ 3, "th1sIsTh3R1vrOfThNgt93", "info@steamware.net", "Steamware", true, "IT", "Admin", 1, 0, 0, 0, "", "steamw.admin" },
{ 12, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Baganzola", 3, 3, 0, 0, "", "piz05.user01" },
{ 1, "th1sIsTh3R1vrOfThNgt98", "samuele@steamware.net", "Samuele", true, "IT", "Locatelli", 1, 0, 0, 0, "", "samuele.locatelli" },
{ 6, "th1sIsTh3R1vrOfThNgt92", "info@steamware.net", "User", true, "IT", "LIQUIGAS", 3, 0, 1, 0, "", "liquigas.user01" },
{ 13, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Pilastrello", 3, 4, 0, 0, "", "piz08.user01" }
});
migrationBuilder.CreateIndex(
@@ -451,11 +381,6 @@ namespace GWMS.Data.Migrations
name: "IX_PlantSupplWeekPlan_SupplierId",
table: "PlantSupplWeekPlan",
column: "SupplierId");
migrationBuilder.CreateIndex(
name: "IX_UserAuth_AuthRole",
table: "UserAuth",
column: "AuthRole");
}
protected override void Down(MigrationBuilder migrationBuilder)
@@ -485,7 +410,7 @@ namespace GWMS.Data.Migrations
name: "PlantSupplWeekPlan");
migrationBuilder.DropTable(
name: "UserAuth");
name: "Users");
migrationBuilder.DropTable(
name: "Transporter");
@@ -495,12 +420,6 @@ namespace GWMS.Data.Migrations
migrationBuilder.DropTable(
name: "Supplier");
migrationBuilder.DropTable(
name: "Auths");
migrationBuilder.DropTable(
name: "Users");
}
}
}
+68 -165
View File
@@ -43,50 +43,6 @@ namespace GWMS.Data.Migrations
b.ToTable("AnKeyVal");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b =>
{
b.Property<string>("AuthRole")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("AuthRole");
b.Property<string>("Description")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnName("Description");
b.HasKey("AuthRole");
b.ToTable("Auths");
b.HasData(
new
{
AuthRole = "SuperAdmin",
Description = "App SuperAdmin User"
},
new
{
AuthRole = "Admin",
Description = "Main SUpervisor User"
},
new
{
AuthRole = "PlantUser",
Description = "Plant User"
},
new
{
AuthRole = "Supplier",
Description = "Supplier User"
},
new
{
AuthRole = "Transporter",
Description = "Transporter User"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
{
b.Property<string>("KeyName")
@@ -464,7 +420,7 @@ namespace GWMS.Data.Migrations
TransporterId = 1,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7161),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4204),
TransporterCode = "TSIM01",
TransporterDesc = "Trasportatore SIM 01"
},
@@ -473,7 +429,7 @@ namespace GWMS.Data.Migrations
TransporterId = 2,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7724),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4773),
TransporterCode = "TSIM02",
TransporterDesc = "Trasportatore SIM 02"
},
@@ -482,7 +438,7 @@ namespace GWMS.Data.Migrations
TransporterId = 3,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7733),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4782),
TransporterCode = "TSIM03",
TransporterDesc = "Trasportatore SIM 03"
},
@@ -491,110 +447,12 @@ namespace GWMS.Data.Migrations
TransporterId = 4,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7736),
PositionUpdated = new DateTime(2021, 6, 22, 16, 40, 37, 428, DateTimeKind.Local).AddTicks(4785),
TransporterCode = "TSIM04",
TransporterDesc = "Trasportatore SIM 04"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("AuthRole")
.HasColumnType("varchar(50)");
b.Property<int>("AuthLevel")
.HasColumnType("int");
b.HasKey("UserId", "AuthRole");
b.HasIndex("AuthRole");
b.ToTable("UserAuth");
b.HasData(
new
{
UserId = 1,
AuthRole = "SuperAdmin",
AuthLevel = 1
},
new
{
UserId = 2,
AuthRole = "SuperAdmin",
AuthLevel = 1
},
new
{
UserId = 3,
AuthRole = "SuperAdmin",
AuthLevel = 1
},
new
{
UserId = 4,
AuthRole = "Admin",
AuthLevel = 1
},
new
{
UserId = 5,
AuthRole = "Admin",
AuthLevel = 1
},
new
{
UserId = 6,
AuthRole = "Supplier",
AuthLevel = 6
},
new
{
UserId = 7,
AuthRole = "Supplier",
AuthLevel = 7
},
new
{
UserId = 8,
AuthRole = "Transporter",
AuthLevel = 1
},
new
{
UserId = 9,
AuthRole = "Transporter",
AuthLevel = 2
},
new
{
UserId = 10,
AuthRole = "PlantUser",
AuthLevel = 1
},
new
{
UserId = 11,
AuthRole = "PlantUser",
AuthLevel = 2
},
new
{
UserId = 12,
AuthRole = "PlantUser",
AuthLevel = 3
},
new
{
UserId = 13,
AuthRole = "PlantUser",
AuthLevel = 4
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b =>
{
b.Property<int>("UserId")
@@ -624,6 +482,18 @@ namespace GWMS.Data.Migrations
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("Livello")
.HasColumnType("int");
b.Property<int>("MaskPlantId")
.HasColumnType("int");
b.Property<int>("MaskSupplierId")
.HasColumnType("int");
b.Property<int>("MaskTranspId")
.HasColumnType("int");
b.Property<string>("SaltPasswd")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
@@ -646,6 +516,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Locatelli",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "samuele.locatelli"
},
@@ -658,6 +532,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Rottoli",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "giancarlo.rottoli"
},
@@ -670,6 +548,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Admin",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "steamw.admin"
},
@@ -682,6 +564,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Pizzaferri",
Livello = 2,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "angelo.pizzaferri"
},
@@ -694,6 +580,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Valeanu",
Livello = 2,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "andrei.valeanu"
},
@@ -706,6 +596,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "LIQUIGAS",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 1,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "liquigas.user01"
},
@@ -718,6 +612,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "VULKANGAS",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 2,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "vulkangas.user01"
},
@@ -730,6 +628,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "LEVORATO",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 1,
SaltPasswd = "",
UserName = "levorato.user01"
},
@@ -742,6 +644,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "TRAFFIK",
Livello = 3,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 2,
SaltPasswd = "",
UserName = "traffik.user01"
},
@@ -754,6 +660,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Collecchio",
Livello = 3,
MaskPlantId = 1,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz03.user01"
},
@@ -766,6 +676,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Noceto",
Livello = 3,
MaskPlantId = 2,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz04.user01"
},
@@ -778,6 +692,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Baganzola",
Livello = 3,
MaskPlantId = 3,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz05.user01"
},
@@ -790,6 +708,10 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "Pilastrello",
Livello = 3,
MaskPlantId = 4,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz08.user01"
});
@@ -862,25 +784,6 @@ namespace GWMS.Data.Migrations
b.Navigation("Supplier");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b =>
{
b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role")
.WithMany()
.HasForeignKey("AuthRole")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
#pragma warning restore 612, 618
}
}
+13 -40
View File
@@ -20,46 +20,19 @@ namespace GWMS.Data
{
// inizializzazione dei valori di default x USER
modelBuilder.Entity<UserModel>().HasData(
new UserModel { UserId = 1, AuthKey = "th1sIsTh3R1vrOfThNgt98", UserName = "samuele.locatelli", Email = "samuele@steamware.net", Firstname = "Samuele", Lastname = "Locatelli" },
new UserModel { UserId = 2, AuthKey = "th1sIsTh3R1vrOfThNgt91", UserName = "giancarlo.rottoli", Email = "giancarlo@steamware.net", Firstname = "Giancarlo", Lastname = "Rottoli" },
new UserModel { UserId = 3, AuthKey = "th1sIsTh3R1vrOfThNgt93", UserName = "steamw.admin", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "Admin" },
new UserModel { UserId = 4, AuthKey = "th1sIsTh3R1vrOfThNgt97", UserName = "angelo.pizzaferri", Email = "a.pizzaferri@pizzaferripetroli.it", Firstname = "Angelo", Lastname = "Pizzaferri" },
new UserModel { UserId = 5, AuthKey = "th1sIsTh3R1vrOfThNgt99", UserName = "andrei.valeanu", Email = "andrei.valeanu@winnlab.it", Firstname = "Andrei", Lastname = "Valeanu" },
new UserModel { UserId = 6, AuthKey = "th1sIsTh3R1vrOfThNgt92", UserName = "liquigas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LIQUIGAS" },
new UserModel { UserId = 7, AuthKey = "th1sIsTh3R1vrOfThNgt94", UserName = "vulkangas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "VULKANGAS" },
new UserModel { UserId = 8, AuthKey = "th1sIsTh3R1vrOfThNgt95", UserName = "levorato.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LEVORATO" },
new UserModel { UserId = 9, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "traffik.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "TRAFFIK" },
new UserModel { UserId = 10, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz03.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Collecchio" },
new UserModel { UserId = 11, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz04.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Noceto" },
new UserModel { UserId = 12, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz05.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Baganzola" },
new UserModel { UserId = 13, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz08.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Pilastrello" }
);
// inizializzazione dei valori di default x AUTH
modelBuilder.Entity<AuthModel>().HasData(
//new AuthModel { AuthRole = "User", Description = "Base User" },
new AuthModel { AuthRole = "SuperAdmin", Description = "App SuperAdmin User" },
new AuthModel { AuthRole = "Admin", Description = "Main SUpervisor User" },
new AuthModel { AuthRole = "PlantUser", Description = "Plant User" },
new AuthModel { AuthRole = "Supplier", Description = "Supplier User" },
new AuthModel { AuthRole = "Transporter", Description = "Transporter User" }
);
// inizializzazione dei valori di default x USER
modelBuilder.Entity<UserAuthModel>().HasData(
new UserAuthModel { UserId = 1, AuthRole = "SuperAdmin", AuthLevel = 1 },
new UserAuthModel { UserId = 2, AuthRole = "SuperAdmin", AuthLevel = 1 },
new UserAuthModel { UserId = 3, AuthRole = "SuperAdmin", AuthLevel = 1 },
new UserAuthModel { UserId = 4, AuthRole = "Admin", AuthLevel = 1 },
new UserAuthModel { UserId = 5, AuthRole = "Admin", AuthLevel = 1 },
new UserAuthModel { UserId = 6, AuthRole = "Supplier", AuthLevel = 6 },
new UserAuthModel { UserId = 7, AuthRole = "Supplier", AuthLevel = 7 },
new UserAuthModel { UserId = 8, AuthRole = "Transporter", AuthLevel = 1 },
new UserAuthModel { UserId = 9, AuthRole = "Transporter", AuthLevel = 2 },
new UserAuthModel { UserId = 10, AuthRole = "PlantUser", AuthLevel = 1 },
new UserAuthModel { UserId = 11, AuthRole = "PlantUser", AuthLevel = 2 },
new UserAuthModel { UserId = 12, AuthRole = "PlantUser", AuthLevel = 3 },
new UserAuthModel { UserId = 13, AuthRole = "PlantUser", AuthLevel = 4 }
new UserModel { UserId = 1, AuthKey = "th1sIsTh3R1vrOfThNgt98", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "samuele.locatelli", Email = "samuele@steamware.net", Firstname = "Samuele", Lastname = "Locatelli" },
new UserModel { UserId = 2, AuthKey = "th1sIsTh3R1vrOfThNgt91", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "giancarlo.rottoli", Email = "giancarlo@steamware.net", Firstname = "Giancarlo", Lastname = "Rottoli" },
new UserModel { UserId = 3, AuthKey = "th1sIsTh3R1vrOfThNgt93", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "steamw.admin", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "Admin" },
new UserModel { UserId = 4, AuthKey = "th1sIsTh3R1vrOfThNgt97", Livello = UserLevel.Admin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "angelo.pizzaferri", Email = "a.pizzaferri@pizzaferripetroli.it", Firstname = "Angelo", Lastname = "Pizzaferri" },
new UserModel { UserId = 5, AuthKey = "th1sIsTh3R1vrOfThNgt99", Livello = UserLevel.Admin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "andrei.valeanu", Email = "andrei.valeanu@winnlab.it", Firstname = "Andrei", Lastname = "Valeanu" },
new UserModel { UserId = 6, AuthKey = "th1sIsTh3R1vrOfThNgt92", Livello = UserLevel.User, MaskPlantId = 0, MaskSupplierId = 1, MaskTranspId = 0, UserName = "liquigas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LIQUIGAS" },
new UserModel { UserId = 7, AuthKey = "th1sIsTh3R1vrOfThNgt94", Livello = UserLevel.User, MaskPlantId = 0, MaskSupplierId = 2, MaskTranspId = 0, UserName = "vulkangas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "VULKANGAS" },
new UserModel { UserId = 8, AuthKey = "th1sIsTh3R1vrOfThNgt95", Livello = UserLevel.User, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 1, UserName = "levorato.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LEVORATO" },
new UserModel { UserId = 9, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 2, UserName = "traffik.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "TRAFFIK" },
new UserModel { UserId = 10, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 1, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz03.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Collecchio" },
new UserModel { UserId = 11, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 2, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz04.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Noceto" },
new UserModel { UserId = 12, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 3, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz05.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Baganzola" },
new UserModel { UserId = 13, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 4, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz08.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Pilastrello" }
);
// inizializzazione dei valori di default x Plant