Files
mixtape/zero.Core/Entities/User/User.cs
T

179 lines
3.9 KiB
C#
Raw Normal View History

using System;
2020-03-24 20:30:03 +01:00
using System.Collections.Generic;
2020-07-06 14:35:58 +02:00
using zero.Core.Attributes;
2020-03-24 20:30:03 +01:00
2020-03-24 23:09:29 +01:00
namespace zero.Core.Entities
2020-03-24 20:30:03 +01:00
{
2020-05-15 14:23:47 +02:00
public class User : ZeroEntity, IUser, IZeroDbConventions
2020-03-24 20:30:03 +01:00
{
/// <inheritdoc />
public string AppId { get; set; }
2020-05-20 16:09:56 +02:00
/// <inheritdoc />
public string CurrentAppId { get; set; }
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
public bool IsSuper { get; set; }
/// <inheritdoc/>
public string Email { get; set; }
2020-04-14 20:16:04 +02:00
/// <inheritdoc/>
public bool IsEmailConfirmed { get; set; }
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
public string PasswordHash { get; set; }
/// <inheritdoc/>
public string SecurityStamp { get; set; }
/// <inheritdoc/>
2020-05-14 15:40:41 +02:00
public string AvatarId { get; set; }
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
public string LanguageId { get; set; }
/// <inheritdoc/>
public List<string> Roles { get; set; } = new List<string>();
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
2020-04-14 20:16:04 +02:00
public List<IUserClaim> Claims { get; set; } = new List<IUserClaim>();
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
public string PasswordResetToken { get; set; }
/// <inheritdoc/>
public DateTimeOffset? PasswordResetTokenExpirationDate { get; set; }
2020-04-14 20:16:04 +02:00
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
2020-04-14 20:16:04 +02:00
public int AccessFailedCount { get; set; }
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
2020-04-14 20:16:04 +02:00
public bool LockoutEnabled { get; set; }
/// <inheritdoc/>
public DateTimeOffset? LockoutEnd { get; set; }
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
public bool TwoFactorEnabled { get; set; }
/// <inheritdoc/>
public string TwoFactorAuthenticatorKey { get; set; }
/// <inheritdoc/>
public List<string> TwoFactorRecoveryCodes { get; set; } = new List<string>();
}
2020-07-06 14:35:58 +02:00
[Collection("Users")]
public interface IUser : IZeroEntity, IAppAwareEntity, IZeroDbConventions
2020-03-24 20:30:03 +01:00
{
2020-05-20 16:09:56 +02:00
/// <summary>
/// Currently selected app id for the backoffice
/// </summary>
public string CurrentAppId { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// sudo.
/// The user who created the instance.
/// </summary>
bool IsSuper { get; set; }
/// <summary>
/// E-Mail address which is also used as the username
/// </summary>
string Email { get; set; }
2020-04-14 20:16:04 +02:00
/// <summary>
/// Whether the email address has been confirmed
/// </summary>
public bool IsEmailConfirmed { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// The password hash
/// </summary>
string PasswordHash { get; set; }
/// <summary>
/// The security stamp
/// </summary>
string SecurityStamp { get; set; }
/// <summary>
/// Avatar image
/// </summary>
2020-05-14 15:40:41 +02:00
string AvatarId { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// Backoffice display language
/// </summary>
string LanguageId { get; set; }
/// <summary>
/// The roles (aliases) of the user
2020-03-24 20:30:03 +01:00
/// </summary>
List<string> Roles { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// The user's claims, for use in claims-based authentication.
/// </summary>
2020-04-14 20:16:04 +02:00
List<IUserClaim> Claims { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// A hash which is used to validate a password-change request
/// </summary>
string PasswordResetToken { get; set; }
/// <summary>
/// The date when the current password-reset hash expires
/// </summary>
DateTimeOffset? PasswordResetTokenExpirationDate { get; set; }
2020-04-14 20:16:04 +02:00
2020-03-24 20:30:03 +01:00
/// <summary>
/// Number of times sign in failed.
/// </summary>
2020-04-14 20:16:04 +02:00
int AccessFailedCount { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// Whether the user is locked out.
/// </summary>
2020-04-14 20:16:04 +02:00
bool LockoutEnabled { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// When the user lock out is over.
/// </summary>
2020-04-14 20:16:04 +02:00
DateTimeOffset? LockoutEnd { get; set; }
2020-03-24 20:30:03 +01:00
/// <summary>
/// Whether 2-factor authentication is enabled or not
/// </summary>
bool TwoFactorEnabled { get; set; }
/// <summary>
/// The two-factor authenticator key
/// </summary>
string TwoFactorAuthenticatorKey { get; set; }
/// <summary>
/// The list of two factor authentication recovery codes
/// </summary>
List<string> TwoFactorRecoveryCodes { get; set; }
}
}