2025-02-10 02:40:27 +01:00
|
|
|
using System.Text;
|
2024-12-22 02:15:34 +01:00
|
|
|
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
|
|
|
{
|
2024-12-22 02:15:34 +01:00
|
|
|
public AuthorityUser(string userName) : this()
|
|
|
|
{
|
|
|
|
UserName = userName;
|
|
|
|
}
|
2025-01-27 01:21:09 +01:00
|
|
|
|
|
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
|
|
|
2024-12-22 02:15:34 +01:00
|
|
|
public bool Enabled { get; set; }
|
|
|
|
|
2024-12-23 00:59:13 +01:00
|
|
|
public bool Confirmed { get; set; }
|
|
|
|
|
2024-12-22 02:15:34 +01:00
|
|
|
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;
|
2024-12-22 02:15:34 +01:00
|
|
|
|
|
|
|
public string? PasswordHash { get; set; }
|
|
|
|
|
2025-01-27 01:21:09 +01:00
|
|
|
public DateTime CreatedDate { get; set; } = DateTime.Now;
|
2024-12-22 02:15:34 +01:00
|
|
|
|
|
|
|
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
|
|
|
}
|