using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
///
/// Describes a User in Oqtane.
///
public class User : ModelBase, IDeletable
{
///
/// ID of this User.
///
public int UserId { get; set; }
///
/// Username used for login.
///
public string Username { get; set; }
///
/// Name shown in menus / dialogs etc.
///
public string DisplayName { get; set; }
///
/// User E-Mail address.
///
public string Email { get; set; }
///
/// Reference to a containing the users photo.
///
public int? PhotoFileId { get; set; }
///
/// Timestamp of last login.
///
public DateTime? LastLoginOn { get; set; }
///
/// Tracking information of IP used when the user last worked on this site.
///
public string LastIPAddress { get; set; }
///
/// Indicates if the user requires 2 factor authentication to sign in
///
public bool TwoFactorRequired { get; set; }
///
/// Stores the 2 factor verification code
///
public string TwoFactorCode { get; set; }
///
/// The expiry date/time for the 2 factor verification code
///
public DateTime? TwoFactorExpiry { get; set; }
///
/// Reference to the this user belongs to.
///
[NotMapped]
public int SiteId { get; set; }
///
/// Role names this user has.
/// TODO: todoc - is this comma separated?
///
[NotMapped]
public string Roles { get; set; }
#region Extended IAuditable Properties, may be moved to an Interface some day so not documented yet
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
///
/// The users password. Note that this is not plaintext, so you can probably never really work with this.
///
[NotMapped]
public string Password { get; set; }
///
/// Information if this user is authenticated. Anonymous users are not authenticated.
///
[NotMapped]
public bool IsAuthenticated { get; set; }
///
/// The path name of the user's personal folder
///
[NotMapped]
public string FolderPath
{
get => "Users\\" + UserId.ToString() + "\\";
}
}
}