From c5ff0b57a12b605a5ae5ae8a92ce7a4e8eaec77a Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Fri, 29 Sep 2023 16:20:23 +1000 Subject: Separated HBPrincipal into IPrincipal and LocalPrincipal --- HBContext.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'HBContext.cs') diff --git a/HBContext.cs b/HBContext.cs index 2d44bc5..705efe4 100644 --- a/HBContext.cs +++ b/HBContext.cs @@ -1,18 +1,17 @@ using Microsoft.EntityFrameworkCore; using HyperBooru.Services; +using HyperBooru.PrincipalProviders; namespace HyperBooru; enum HBObjectId { NsfwTag = -1, IngestTag = -2, - AdminUser = -3 } public static class HBObjectGuid { public static readonly Guid NsfwTag = new("EBDAD4F8-455A-4351-8017-1D4854D6FA38"); public static readonly Guid IngestTag = new("EA212801-5BCC-4C0E-814F-FB9D30DB58BC"); - public static readonly Guid AdminUser = new("0623F137-F9D7-456C-A79F-C866B556FBF6"); } public class HBContext : DbContext { @@ -50,7 +49,7 @@ public class HBContext : DbContext { modelBuilder.Entity().ToTable("Tags"); modelBuilder.Entity().ToTable("Media"); modelBuilder.Entity().ToTable("UploadedFiles"); - modelBuilder.Entity().ToTable("SecurityPrincipals"); + modelBuilder.Entity().ToTable("SecurityPrincipals"); // Seed internal tag definitions // These should NEVER change @@ -72,11 +71,9 @@ public class HBContext : DbContext { // Seed initial admin user modelBuilder.Entity().HasData(new LocalUser[] { new() { - ObjectId = (int) HBObjectId.AdminUser, - Guid = HBObjectGuid.AdminUser, Name = "admin", Sid = new SecurityIdentifier("S-1-5-18"), - PasswordHash = UserService.HashPassword("admin") + PasswordHash = LocalPrincipalProvider.HashPassword("admin") } }); -- cgit v1.3