2020-10-03 14:12:55 +02:00
|
|
|
using System;
|
2017-09-13 08:47:34 +02:00
|
|
|
using System.Collections.Generic;
|
2020-06-28 10:55:27 +02:00
|
|
|
using Microsoft.AspNetCore.Identity;
|
2021-11-15 10:27:19 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-02-21 07:06:34 +01:00
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
2017-09-13 08:47:34 +02:00
|
|
|
|
2019-08-29 17:24:42 +02:00
|
|
|
namespace BTCPayServer.Data
|
2017-09-13 08:47:34 +02:00
|
|
|
{
|
|
|
|
// Add profile data for application users by adding properties to the ApplicationUser class
|
2023-02-21 07:06:34 +01:00
|
|
|
public class ApplicationUser : IdentityUser, IHasBlob<UserBlob>
|
2017-09-13 08:47:34 +02:00
|
|
|
{
|
2020-12-28 21:57:21 +01:00
|
|
|
public bool RequiresEmailConfirmation { get; set; }
|
2024-01-31 06:45:54 +01:00
|
|
|
public bool RequiresApproval { get; set; }
|
|
|
|
public bool Approved { get; set; }
|
2020-12-28 21:57:21 +01:00
|
|
|
public List<StoredFile> StoredFiles { get; set; }
|
2021-04-28 09:22:09 +02:00
|
|
|
[Obsolete("U2F support has been replace with FIDO2")]
|
2019-05-02 14:01:08 +02:00
|
|
|
public List<U2FDevice> U2FDevices { get; set; }
|
2020-02-24 14:36:15 +01:00
|
|
|
public List<APIKeyData> APIKeys { get; set; }
|
2020-10-03 14:12:55 +02:00
|
|
|
public DateTimeOffset? Created { get; set; }
|
2020-10-20 13:09:09 +02:00
|
|
|
public string DisabledNotifications { get; set; }
|
2024-06-26 10:39:22 +02:00
|
|
|
|
2020-12-28 21:57:21 +01:00
|
|
|
public List<NotificationData> Notifications { get; set; }
|
|
|
|
public List<UserStore> UserStores { get; set; }
|
2021-04-20 07:06:32 +02:00
|
|
|
public List<Fido2Credential> Fido2Credentials { get; set; }
|
2021-12-31 08:59:02 +01:00
|
|
|
|
2023-02-21 07:06:34 +01:00
|
|
|
[Obsolete("Use Blob2 instead")]
|
2021-11-26 15:13:41 +01:00
|
|
|
public byte[] Blob { get; set; }
|
2023-02-21 07:06:34 +01:00
|
|
|
public string Blob2 { get; set; }
|
2021-11-15 10:27:19 +01:00
|
|
|
|
|
|
|
public List<IdentityUserRole<string>> UserRoles { get; set; }
|
|
|
|
|
2023-02-21 07:06:34 +01:00
|
|
|
public static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
|
2021-11-15 10:27:19 +01:00
|
|
|
{
|
|
|
|
builder.Entity<ApplicationUser>()
|
|
|
|
.HasMany<IdentityUserRole<string>>(user => user.UserRoles)
|
|
|
|
.WithOne().HasForeignKey(role => role.UserId);
|
2024-04-15 12:08:25 +02:00
|
|
|
|
|
|
|
builder.Entity<ApplicationUser>()
|
|
|
|
.Property(o => o.Blob2)
|
|
|
|
.HasColumnType("JSONB");
|
2021-11-15 10:27:19 +01:00
|
|
|
}
|
2017-10-27 10:53:04 +02:00
|
|
|
}
|
2023-02-21 07:06:34 +01:00
|
|
|
|
|
|
|
public class UserBlob
|
|
|
|
{
|
|
|
|
public bool ShowInvoiceStatusChangeHint { get; set; }
|
2024-06-26 10:39:22 +02:00
|
|
|
public string ImageUrl { get; set; }
|
|
|
|
public string Name { get; set; }
|
2024-09-12 05:31:57 +02:00
|
|
|
public string InvitationToken { get; set; }
|
2023-02-21 07:06:34 +01:00
|
|
|
}
|
2017-09-13 08:47:34 +02:00
|
|
|
}
|