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>
|
|
|
|
|
public class AccessViewModel : ElementViewModel
|
|
|
|
|
{
|
|
|
|
|
[MapConfiguration("RoleId")]
|
|
|
|
|
public Guid RoleId { get; set; }
|
|
|
|
|
|
2021-03-27 23:50:29 +04:00
|
|
|
|
[ViewModelOnListProperty("Роль", 100)]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
[MapConfiguration("Role.RoleName", true)]
|
|
|
|
|
public string RoleName { get; set; }
|
|
|
|
|
|
|
|
|
|
[MapConfiguration("AccessOperation")]
|
|
|
|
|
public AccessOperation AccessOperation { get; set; }
|
|
|
|
|
|
2021-03-27 23:50:29 +04:00
|
|
|
|
[ViewModelOnListProperty("Операция")]
|
2021-03-26 20:09:52 +04:00
|
|
|
|
public string AccessOperationTitle => AccessOperation.ToString("G");
|
|
|
|
|
|
|
|
|
|
[MapConfiguration("AccessType")]
|
|
|
|
|
public AccessType AccessType { get; set; }
|
|
|
|
|
|
2021-03-27 23:50:29 +04:00
|
|
|
|
[ViewModelOnListProperty("Тип", 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})";
|
|
|
|
|
}
|
|
|
|
|
}
|