namespace OliverBooth.Common.Data.Web.Users; /// /// Represents a user which can log in to the blog. /// public interface IUser { /// /// Gets the URL of the user's avatar. /// /// The URL of the user's avatar. Uri AvatarUrl { get; } /// /// Gets the email address of the user. /// /// The email address of the user. string EmailAddress { get; } /// /// Gets the display name of the author. /// /// The display name of the author. string DisplayName { get; } /// /// Gets the unique identifier of the user. /// /// The unique identifier of the user. Guid Id { get; } /// /// Gets the date and time the user registered. /// /// The registration date and time. DateTimeOffset Registered { get; } /// /// Gets the permissions this user is granted. /// /// A read-only view of the permissions this user is granted. IReadOnlyList Permissions { get; } /// /// Gets the user's TOTP token. /// /// The TOTP token. string? Totp { get; } /// /// Gets the URL of the user's avatar. /// /// The size of the avatar. /// The URL of the user's avatar. Uri GetAvatarUrl(int size = 28); /// /// Determines whether the user has the specified permission. /// /// The permission to test. /// /// if the user has the specified permission; otherwise, . /// bool HasPermission(Permission permission); /// /// Determines whether the user has the specified permission. /// /// The permission to test. /// /// if the user has the specified permission; otherwise, . /// bool HasPermission(string permission); /// /// Returns a value indicating whether the specified password is valid for the user. /// /// The password to test. /// /// if the specified password is valid for the user; otherwise, /// . /// bool TestCredentials(string password); /// /// Tests the specified TOTP with the user's current TOTP. /// /// The TOTP to test. /// /// if the specified time-based one-time password matches that of the user; otherwise, /// . /// /// is . bool TestTotp(string value); }