diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210328165041_AddDescriptionInEnviromentSettings.Designer.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210328165041_AddDescriptionInEnviromentSettings.Designer.cs
new file mode 100644
index 0000000..4ac44f7
--- /dev/null
+++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210328165041_AddDescriptionInEnviromentSettings.Designer.cs
@@ -0,0 +1,220 @@
+//
+using System;
+using DatabaseCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace DatabaseCore.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20210328165041_AddDescriptionInEnviromentSettings")]
+ partial class AddDescriptionInEnviromentSettings
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AccessOperation")
+ .HasColumnType("int");
+
+ b.Property("AccessType")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("Accesses");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.EnviromentSetting", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Key")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("EnviromentSettings");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("RoleName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RolePriority")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Roles");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Avatar")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("CountAttempt")
+ .HasColumnType("int");
+
+ b.Property("DateBanned")
+ .HasColumnType("datetime2");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("DateLastVisit")
+ .HasColumnType("datetime2");
+
+ b.Property("EmployeeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsBanned")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LecturerId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PasswordHash")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StudentId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserName")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserRoles");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Security.Role", "Role")
+ .WithMany("Access")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Security.Role", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseCore.Models.Security.User", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
+ {
+ b.Navigation("Access");
+
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210328165041_AddDescriptionInEnviromentSettings.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210328165041_AddDescriptionInEnviromentSettings.cs
new file mode 100644
index 0000000..0a1be8c
--- /dev/null
+++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210328165041_AddDescriptionInEnviromentSettings.cs
@@ -0,0 +1,23 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace DatabaseCore.Migrations
+{
+ public partial class AddDescriptionInEnviromentSettings : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "Description",
+ table: "EnviromentSettings",
+ type: "nvarchar(max)",
+ nullable: true);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "Description",
+ table: "EnviromentSettings");
+ }
+ }
+}
diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs
index 00acc4a..a6a0f4f 100644
--- a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs
+++ b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs
@@ -54,6 +54,9 @@ namespace DatabaseCore.Migrations
b.Property("Id")
.HasColumnType("uniqueidentifier");
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
b.Property("Key")
.HasColumnType("nvarchar(max)");
diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs
index ecf49c9..0e5ac39 100644
--- a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs
+++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs
@@ -17,5 +17,9 @@ namespace DatabaseCore.Models.Security
[DataMember]
[MapConfiguration("Value")]
public string Value { get; set; }
+
+ [DataMember]
+ [MapConfiguration("Description")]
+ public string Description { get; set; }
}
}
\ No newline at end of file
diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs
index f15accc..6b225f8 100644
--- a/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs
+++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/BusinessLogicCore.cs
@@ -70,11 +70,10 @@ namespace ModuleTools.BusinessLogics
{
if (Security.CheckAccess(new SecurityManagerCheckAccessModel(model, _serviceOperation, type, _entity)))
{
- return false;
+ Errors.Add(("Ошибка безопасности", Security.ErrorMessage));
+ return true;
}
-
- Errors.Add(("Ошибка безопасности", Security.ErrorMessage));
- return true;
+ return false;
}
///
diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs
index 448ab27..3d0a232 100644
--- a/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs
+++ b/DepartmentPortal/Security/SecurityBusinessLogic/BindingModels/EnviromentSettingBindingModels.cs
@@ -21,5 +21,8 @@ namespace SecurityBusinessLogic.BindingModels
[Required(ErrorMessage = "required")]
public string Value { get; set; }
+
+ [Required(ErrorMessage = "required")]
+ public string Description { get; set; }
}
}
\ No newline at end of file
diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs
index 6d5ce41..d375835 100644
--- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs
+++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs
@@ -15,20 +15,20 @@ namespace SecurityBusinessLogic.ViewModels
///
public class AccessViewModel : ElementViewModel
{
- [MapConfiguration("RoleId")]
+ [MapConfiguration("RoleId", AllowCopyWithoutRigth = false)]
public Guid RoleId { get; set; }
[ViewModelOnListProperty("Роль", 100)]
- [MapConfiguration("Role.RoleName", true)]
+ [MapConfiguration("Role.RoleName", true, AllowCopyWithoutRigth = false)]
public string RoleName { get; set; }
- [MapConfiguration("AccessOperation")]
+ [MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)]
public AccessOperation AccessOperation { get; set; }
[ViewModelOnListProperty("Операция")]
public string AccessOperationTitle => AccessOperation.ToString("G");
- [MapConfiguration("AccessType")]
+ [MapConfiguration("AccessType", AllowCopyWithoutRigth = false)]
public AccessType AccessType { get; set; }
[ViewModelOnListProperty("Тип", 150)]
diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs
index b622851..d970518 100644
--- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs
+++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs
@@ -14,13 +14,17 @@ namespace SecurityBusinessLogic.ViewModels
public class EnviromentSettingViewModel : ElementViewModel
{
[ViewModelOnListProperty("Ключ")]
- [MapConfiguration("Key")]
+ [MapConfiguration("Key", AllowCopyWithoutRigth = false)]
public string Key { get; set; }
[ViewModelOnListProperty("Значение")]
- [MapConfiguration("Value")]
+ [MapConfiguration("Value", AllowCopyWithoutRigth = false)]
public string Value { get; set; }
+ [ViewModelOnListProperty("Описание")]
+ [MapConfiguration("Description", AllowCopyWithoutRigth = false)]
+ public string Description { get; set; }
+
public override string ToString() => Key;
}
}
\ No newline at end of file
diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs
index 67df501..bcdaf7c 100644
--- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs
+++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs
@@ -34,19 +34,19 @@ namespace SecurityBusinessLogic.ViewModels
[MapConfiguration("DateLastVisit")]
public DateTime? DateLastVisit { get; set; }
- [MapConfiguration("IsBanned")]
+ [MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)]
public bool IsBanned { get; set; }
[ViewModelOnListProperty("Блокир.", 80)]
public string Banned => IsBanned ? "Да" : "Нет";
- [MapConfiguration("DateBanned")]
+ [MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)]
public DateTime? DateBanned { get; set; }
[ViewModelOnListProperty("Дата Б.", 100)]
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
- [MapConfiguration("CountAttempt")]
+ [MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
public int CountAttempt { get; set; }
public override string ToString() => Login;