Files
mixtape/zero.Backoffice/Models/DisplayModel.cs
T

61 lines
1.6 KiB
C#
Raw Normal View History

2021-11-22 14:29:22 +01:00
namespace zero.Backoffice.Models;
2021-11-19 14:59:24 +01:00
2021-11-26 15:47:11 +01:00
public abstract class DisplayModel<T> : ZeroIdEntity where T : ZeroIdEntity
2021-11-19 14:59:24 +01:00
{
/// <summary>
/// Meta data
/// </summary>
2021-11-26 15:47:11 +01:00
public DisplayModelMeta Meta { get; set; } = new();
2021-11-23 15:43:21 +01:00
/// <summary>
/// Permissions for this entity
/// </summary>
2021-11-26 15:47:11 +01:00
public DisplayModelPermissions Permissions { get; set; } = new();
2021-11-19 14:59:24 +01:00
}
2021-11-26 15:47:11 +01:00
public class DisplayModelMeta
2021-11-23 15:43:21 +01:00
{
/// <summary>
/// Wehther this entity is application aware
/// </summary>
public bool IsAppAware { get; set; }
/// <summary>
/// Whether this entity can be shared across applications (only for IsAppAware=true)
/// </summary>
public bool CanBeShared { get; set; }
public bool IsShared { get; set; }
/// <summary>
/// The change token maps to a database entity which holds ID and collection of the model to edit
/// If these values do not match the entity on save it is rejected
/// // TODO expiration expiry session.Advanced.GetMetadataFor(user)[Raven.Client.Constants.Documents.Metadata.Expires] = DateTime.UtcNow.AddMinutes(60);
/// </summary>
public string Token { get; set; }
}
2021-11-26 15:47:11 +01:00
public class DisplayModelPermissions
2021-11-19 14:59:24 +01:00
{
/// <summary>
/// Whether an entity of this type can be created
/// </summary>
public bool CanCreate { get; set; }
/// <summary>
/// Whether an entity of this type can be created in the shared app space
/// </summary>
public bool CanCreateShared { get; set; }
/// <summary>
/// Whether this entity can be edited or only viewed
/// </summary>
public bool CanEdit { get; set; }
/// <summary>
/// Whether this entity can be deleted
/// </summary>
public bool CanDelete { get; set; }
2021-11-23 15:43:21 +01:00
}