diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs index 0c8b8f7..a767817 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs @@ -15,18 +15,18 @@ namespace DatabaseCore.Models.Security [EntityDependency("Role", "RoleId", "Доступные дейсвтиия создаются под конкретную роль")] public class Access : BaseEntity, IEntitySecurityExtenstion { - [Required] [DataMember] + [Required] [MapConfiguration("RoleId")] public Guid RoleId { get; set; } - [Required] [DataMember] + [Required] [MapConfiguration("AccessOperation")] public AccessOperation AccessOperation { get; set; } - [Required] [DataMember] + [Required] [MapConfiguration("AccessType")] public AccessType AccessType { get; set; } diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs index 90e7563..3f77425 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs @@ -13,13 +13,13 @@ namespace DatabaseCore.Models.Security public class EnviromentSetting : IdEntity, IEntitySecurityExtenstion { [DataMember] - [MapConfiguration("Key")] [Required] + [MapConfiguration("Key")] public string Key { get; set; } [DataMember] - [MapConfiguration("Value")] [Required] + [MapConfiguration("Value")] public string Value { get; set; } [DataMember] diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs index 78f525d..46b54db 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs @@ -1,6 +1,7 @@ using ModuleTools.Attributes; using ModuleTools.Interfaces; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; @@ -14,6 +15,7 @@ namespace DatabaseCore.Models.Security public class Role : BaseEntity, IEntitySecurityExtenstion { [DataMember] + [Required] [MapConfiguration("RoleName")] public string RoleName { get; set; } diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs index 3c85335..3c53870 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs @@ -2,6 +2,7 @@ using ModuleTools.Interfaces; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; @@ -15,10 +16,12 @@ namespace DatabaseCore.Models.Security public class User : BaseEntity, IEntitySecurityExtenstion { [DataMember] + [Required] [MapConfiguration("Login")] public string UserName { get; set; } [DataMember] + [Required] [MapConfiguration("Password")] public string PasswordHash { get; set; } diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs index 105e6b9..084367b 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs @@ -16,23 +16,23 @@ namespace SecurityBusinessLogic.ViewModels [ViewModelControlElementClass()] public class AccessViewModel : ElementViewModel { - [MapConfiguration("RoleId", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = true, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")] + [MapConfiguration("RoleId", AllowCopyWithoutRigth = false)] public Guid RoleId { get; set; } [ViewModelControlListProperty("Роль", ColumnWidth = 100)] [MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)] public string RoleName { get; set; } - [MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Операция", ControlType.ControlEnum, MustHaveValue = true)] + [MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)] public AccessOperation AccessOperation { get; set; } [ViewModelControlListProperty("Операция")] public string AccessOperationTitle => AccessOperation.ToString("G"); - [MapConfiguration("AccessType", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)] + [MapConfiguration("AccessType", AllowCopyWithoutRigth = false)] public AccessType AccessType { get; set; } [ViewModelControlListProperty("Тип", ColumnWidth = 150)] diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs index 013b22e..c7fbd51 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs @@ -16,16 +16,16 @@ namespace SecurityBusinessLogic.ViewModels [ViewModelControlElementClass()] public class UserRoleViewModel : ElementViewModel { - [MapConfiguration("UserId", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] + [MapConfiguration("UserId", AllowCopyWithoutRigth = false)] public Guid UserId { get; set; } [ViewModelControlListProperty("Пользователь")] [MapConfiguration("User.UserName", IsDifficle = true, AllowCopyWithoutRigth = false)] public string UserName { get; set; } - [MapConfiguration("RoleId", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")] + [MapConfiguration("RoleId", AllowCopyWithoutRigth = false)] public Guid RoleId { get; set; } [ViewModelControlListProperty("Роль")] diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs index 11694ee..2080b6f 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs @@ -26,30 +26,30 @@ namespace SecurityBusinessLogic.ViewModels [MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)] public string Password { get; set; } - [MapConfiguration("Avatar")] [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] + [MapConfiguration("Avatar")] public byte[] Avatar { get; set; } [ViewModelControlListProperty("Посл. визит", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")] [MapConfiguration("DateLastVisit")] public DateTime? DateLastVisit { get; set; } - [MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Заблокирован", ControlType.ControlBool, MustHaveValue = true)] + [MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)] public bool IsBanned { get; set; } [ViewModelControlListProperty("Блокир.", ColumnWidth = 80)] public string Banned => IsBanned ? "Да" : "Нет"; - [MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Дата блокировки", ControlType.ControlDateTime, ReadOnly = true)] + [MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)] public DateTime? DateBanned { get; set; } [ViewModelControlListProperty("Дата Б.", ColumnWidth = 100)] public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty; - [MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)] [ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt, ReadOnly = true)] + [MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)] public int CountAttempt { get; set; } public override string ToString() => Login;