using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations.Schema; namespace HyperBooru; [Index(nameof(Name))] [Index(nameof(Sid))] public class LocalPrincipal : IPrincipal { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int LocalPrincipalId { get; set; } public string Name { get; set; } public SecurityIdentifier Sid { get; set; } public List MemberOf { get; set; } // At this time, DisplayName is bound to Name, as local // users are currently expected to be identified by username // only. This is a quick 'n' dirty hack that works for // displaying the user's name consistently, but may lead to // unexpected behaviour in future when setting the DisplayName // property if that ever becomes possible. [NotMapped] public string DisplayName { get => Name; set => Name = value; } } public class LocalUser : LocalPrincipal, IUser { public string PasswordHash { get; set; } } public class LocalGroup : LocalPrincipal, IGroup {}