рефакторинг
This commit is contained in:
parent
9d68f31846
commit
ecee1a9eeb
@ -15,18 +15,18 @@ namespace DatabaseCore.Models.Security
|
||||
[EntityDependency("Role", "RoleId", "Доступные дейсвтиия создаются под конкретную роль")]
|
||||
public class Access : BaseEntity, IEntitySecurityExtenstion<Access>
|
||||
{
|
||||
[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; }
|
||||
|
||||
|
@ -13,13 +13,13 @@ namespace DatabaseCore.Models.Security
|
||||
public class EnviromentSetting : IdEntity, IEntitySecurityExtenstion<EnviromentSetting>
|
||||
{
|
||||
[DataMember]
|
||||
[MapConfiguration("Key")]
|
||||
[Required]
|
||||
[MapConfiguration("Key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[DataMember]
|
||||
[MapConfiguration("Value")]
|
||||
[Required]
|
||||
[MapConfiguration("Value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[DataMember]
|
||||
|
@ -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<Role>
|
||||
{
|
||||
[DataMember]
|
||||
[Required]
|
||||
[MapConfiguration("RoleName")]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
|
@ -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<User>
|
||||
{
|
||||
[DataMember]
|
||||
[Required]
|
||||
[MapConfiguration("Login")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[DataMember]
|
||||
[Required]
|
||||
[MapConfiguration("Password")]
|
||||
public string PasswordHash { get; set; }
|
||||
|
||||
|
@ -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)]
|
||||
|
@ -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("Роль")]
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user