Class User
public class User
- Inheritance
-
objectUser
Constructors
User(Guid, Guid, string, string, string, string?, string?)
public User(Guid id, Guid tenantId, string email, string username, string passwordHash, string? firstName = null, string? lastName = null)
Parameters
idGuidtenantIdGuidemailstringusernamestringpasswordHashstringfirstNamestringlastNamestring
Properties
AccessFailedCount
public int AccessFailedCount { get; }
Property Value
- int
CreatedAt
public DateTime CreatedAt { get; }
Property Value
- DateTime
public string Email { get; }
Property Value
- string
Id
public Guid Id { get; }
Property Value
- Guid
IsActive
public bool IsActive { get; }
Property Value
- bool
LastLoginAt
public DateTime? LastLoginAt { get; }
Property Value
- DateTime?
LastName
public string LastName { get; }
Property Value
- string
LockoutEnd
public DateTime? LockoutEnd { get; }
Property Value
- DateTime?
MustChangePassword
public bool MustChangePassword { get; }
Property Value
- bool
Name
public string Name { get; }
Property Value
- string
PasswordExpiresAt
public DateTime? PasswordExpiresAt { get; }
Property Value
- DateTime?
PasswordHash
public string PasswordHash { get; }
Property Value
- string
RoleAssignments
public ICollection<UserRoleAssignment> RoleAssignments { get; set; }
Property Value
- ICollection<UserRoleAssignment>
Sessions
public ICollection<UserSession> Sessions { get; set; }
Property Value
- ICollection<UserSession>
TenantId
public Guid TenantId { get; }
Property Value
- Guid
UpdatedAt
public DateTime? UpdatedAt { get; }
Property Value
- DateTime?
UserTenantBranches
public ICollection<UserBranch> UserTenantBranches { get; set; }
Property Value
- ICollection<UserBranch>
Username
public string Username { get; }
Property Value
- string
Methods
Activate()
public void Activate()
Deactivate()
public void Deactivate()
IncrementAccessFailedCount()
public void IncrementAccessFailedCount()
IsLockedOut()
public bool IsLockedOut()
Returns
- bool
IsPasswordExpired()
Returns true when the password has an expiry date set and that date is in the past.
public bool IsPasswordExpired()
Returns
- bool
LockUser(int)
Locks the user account for the specified duration. Called automatically after MaxFailedLoginAttempts consecutive failures.
public void LockUser(int minutes)
Parameters
minutesint
ResetAccessFailedCount()
public void ResetAccessFailedCount()
SetMustChangePassword(bool)
public void SetMustChangePassword(bool mustChange)
Parameters
mustChangebool
SetPasswordExpiry(DateTime?)
Sets or clears the password expiry date. Pass null to remove expiration (non-privileged users or after disabling policy).
public void SetPasswordExpiry(DateTime? expiresAt)
Parameters
expiresAtDateTime?
UpdateLastLogin()
public void UpdateLastLogin()
UpdatePassword(string, DateTime?)
public void UpdatePassword(string newPasswordHash, DateTime? passwordExpiresAt = null)
Parameters
newPasswordHashstringpasswordExpiresAtDateTime?
UpdateProfile(string?, string?, string, string)
public void UpdateProfile(string? firstName, string? lastName, string email, string username)
Parameters
firstNamestringlastNamestringemailstringusernamestring