46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using ModuleTools.Attributes;
|
|
using ModuleTools.Enums;
|
|
using ModuleTools.ViewModels;
|
|
using System;
|
|
|
|
namespace SecurityBusinessLogic.ViewModels
|
|
{
|
|
/// <summary>
|
|
/// Список достпуов
|
|
/// </summary>
|
|
public class AccessListViewModel : ListViewModel<AccessViewModel> { }
|
|
|
|
/// <summary>
|
|
/// Элемент доступа
|
|
/// </summary>
|
|
public class AccessViewModel : ElementViewModel
|
|
{
|
|
[MapConfiguration("RoleId", AllowCopyWithoutRigth = false)]
|
|
public Guid RoleId { get; set; }
|
|
|
|
[ViewModelOnListProperty("Роль", 100)]
|
|
[MapConfiguration("Role.RoleName", true, AllowCopyWithoutRigth = false)]
|
|
public string RoleName { get; set; }
|
|
|
|
[MapConfiguration("AccessOperation", AllowCopyWithoutRigth = false)]
|
|
public AccessOperation AccessOperation { get; set; }
|
|
|
|
[ViewModelOnListProperty("Операция")]
|
|
public string AccessOperationTitle => AccessOperation.ToString("G");
|
|
|
|
[MapConfiguration("AccessType", AllowCopyWithoutRigth = false)]
|
|
public AccessType AccessType { get; set; }
|
|
|
|
[ViewModelOnListProperty("Тип", 150)]
|
|
public string AccessTypeTitle => AccessType switch
|
|
{
|
|
AccessType.Delete => "Полные права",
|
|
AccessType.Change => "Просмотр, Редактирование",
|
|
AccessType.View => "Просмотр",
|
|
_ => "Неопределено",
|
|
};
|
|
|
|
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
|
|
}
|
|
}
|