2021-03-28 19:15:55 +04:00
|
|
|
|
using ModuleTools.Attributes;
|
|
|
|
|
using ModuleTools.Enums;
|
|
|
|
|
using ModuleTools.ViewModels;
|
2021-03-26 20:09:52 +04:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace SecurityBusinessLogic.ViewModels
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Список достпуов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AccessListViewModel : ListViewModel<AccessViewModel> { }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Элемент доступа
|
|
|
|
|
/// </summary>
|
2021-04-01 21:30:29 +04:00
|
|
|
|
[ViewModelControlElementClass()]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public class AccessViewModel : ElementViewModel
|
|
|
|
|
{
|
2021-03-28 20:56:32 +04:00
|
|
|
|
[MapConfiguration("RoleId", AllowCopyWithoutRigth = false)]
|
2021-04-02 16:06:12 +04:00
|
|
|
|
[ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = true, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public Guid RoleId { get; set; }
|
|
|
|
|
|
2021-04-01 21:30:29 +04:00
|
|
|
|
[ViewModelControlListProperty("Роль", 100)]
|
2021-03-29 23:16:11 +04:00
|
|
|
|
[MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public string RoleName { get; set; }
|
|
|
|
|
|
2021-03-28 20:56:32 +04:00
|
|
|
|
[MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)]
|
2021-04-01 21:30:29 +04:00
|
|
|
|
[ViewModelControlElementProperty("Операция", ControlType.ControlEnum, MustHaveValue = true)]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public AccessOperation AccessOperation { get; set; }
|
|
|
|
|
|
2021-04-01 21:30:29 +04:00
|
|
|
|
[ViewModelControlListProperty("Операция")]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public string AccessOperationTitle => AccessOperation.ToString("G");
|
|
|
|
|
|
2021-03-28 20:56:32 +04:00
|
|
|
|
[MapConfiguration("AccessType", AllowCopyWithoutRigth = false)]
|
2021-04-01 21:30:29 +04:00
|
|
|
|
[ViewModelControlElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public AccessType AccessType { get; set; }
|
|
|
|
|
|
2021-04-01 21:30:29 +04:00
|
|
|
|
[ViewModelControlListProperty("Тип", 150)]
|
2021-03-28 19:58:42 +04:00
|
|
|
|
public string AccessTypeTitle => AccessType switch
|
2021-03-28 00:15:01 +04:00
|
|
|
|
{
|
2021-03-28 19:58:42 +04:00
|
|
|
|
AccessType.Delete => "Полные права",
|
|
|
|
|
AccessType.Change => "Просмотр, Редактирование",
|
|
|
|
|
AccessType.View => "Просмотр",
|
|
|
|
|
_ => "Неопределено",
|
|
|
|
|
};
|
2021-03-26 20:09:52 +04:00
|
|
|
|
|
|
|
|
|
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
|
|
|
|
|
}
|
|
|
|
|
}
|