DotBased/DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs

60 lines
1.5 KiB
C#
Raw Normal View History

2025-02-10 02:40:27 +01:00
using System.Text;
using DotBased.AspNet.Authority.Attributes;
2024-12-21 15:30:17 +01:00
namespace DotBased.AspNet.Authority.Models.Authority;
2025-01-27 01:21:09 +01:00
public class AuthorityUser()
2024-12-21 15:30:17 +01:00
{
public AuthorityUser(string userName) : this()
{
UserName = userName;
}
2025-01-27 01:21:09 +01:00
public Guid Id { get; set; } = Guid.NewGuid();
public bool Enabled { get; set; }
2024-12-23 00:59:13 +01:00
public bool Confirmed { get; set; }
public bool Locked { get; set; }
public DateTime LockedDate { get; set; }
2025-02-10 02:40:27 +01:00
public string UserName { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? PasswordHash { get; set; }
2025-01-27 01:21:09 +01:00
public DateTime CreatedDate { get; set; } = DateTime.Now;
public bool TwoFactorEnabled { get; set; }
public long Version { get; set; }
public long SecurityVersion { get; set; }
[Protect]
public string? EmailAddress { get; set; }
public bool EmailConfirmed { get; set; }
[Protect]
public string? PhoneNumber { get; set; }
public bool PhoneNumberConfirmed { get; set; }
2025-02-02 23:33:00 +01:00
public ICollection<AuthorityAttribute> Attributes { get; set; } = [];
2025-02-10 02:40:27 +01:00
public override string ToString()
{
var strBuilder = new StringBuilder();
strBuilder.Append(!string.IsNullOrWhiteSpace(Name) ? Name : UserName);
if (string.IsNullOrWhiteSpace(EmailAddress)) return strBuilder.ToString();
strBuilder.Append(strBuilder.Length == 0 ? EmailAddress : $" ({EmailAddress})");
return strBuilder.ToString();
}
2024-12-21 15:30:17 +01:00
}