58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using ModelTools.Attributes;
|
|
using ModelTools.Enums;
|
|
using ModelTools.ViewModels;
|
|
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; }
|
|
|
|
[ViewModelOnListProperty("Роль", 100)]
|
|
[MapConfiguration("Role.RoleName", true)]
|
|
public string RoleName { get; set; }
|
|
|
|
[MapConfiguration("AccessOperation")]
|
|
public AccessOperation AccessOperation { get; set; }
|
|
|
|
[ViewModelOnListProperty("Операция")]
|
|
public string AccessOperationTitle => AccessOperation.ToString("G");
|
|
|
|
[MapConfiguration("AccessType")]
|
|
public AccessType AccessType { get; set; }
|
|
|
|
[ViewModelOnListProperty("Тип", 150)]
|
|
public string AccessTypeTitle
|
|
{
|
|
get
|
|
{
|
|
switch (AccessType)
|
|
{
|
|
case AccessType.Delete:
|
|
return "Полные права";
|
|
case AccessType.Change:
|
|
return "Просмотр, Редактирование";
|
|
case AccessType.FullView:
|
|
return "Просмотр";
|
|
case AccessType.SimpleView:
|
|
return "Частичный просмотр";
|
|
default:
|
|
return "Неопределено";
|
|
}
|
|
}
|
|
}
|
|
|
|
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
|
|
}
|
|
}
|