From fbaa4e43709a96774ebe42b7ec5908c1c0f310d7 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 20 Sep 2023 12:45:59 +1000 Subject: Added security migration --- Acl.cs | 5 +- Controllers/LoginController.cs | 4 +- HBContext.cs | 2 +- Migrations/20230920014958_Security.Designer.cs | 455 +++++++++++++++++++++++++ Migrations/20230920014958_Security.cs | 194 +++++++++++ Migrations/HBContextModelSnapshot.cs | 119 ++++++- 6 files changed, 764 insertions(+), 15 deletions(-) create mode 100644 Migrations/20230920014958_Security.Designer.cs create mode 100644 Migrations/20230920014958_Security.cs diff --git a/Acl.cs b/Acl.cs index 581a8bc..72d0bf2 100644 --- a/Acl.cs +++ b/Acl.cs @@ -1,4 +1,6 @@ -namespace HyperBooru; +using System.ComponentModel.DataAnnotations.Schema; + +namespace HyperBooru; public enum AclRuleAction { Allow, @@ -6,6 +8,7 @@ public enum AclRuleAction { } public class Acl : HBObject { + [ForeignKey("ObjectId")] public HBObject Subject { get; set; } public List Rules { get; set; } } diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs index aa680a0..bb31fe2 100644 --- a/Controllers/LoginController.cs +++ b/Controllers/LoginController.cs @@ -20,7 +20,7 @@ public class LoginController : Controller { [FromForm] string password, HBContext db) { - var user = db.Users.FirstOrDefault(u => u.Username == username); + var user = db.Users.FirstOrDefault(u => u.Name == username); if(user is null) return StatusCode(403); @@ -29,7 +29,7 @@ public class LoginController : Controller { return StatusCode(403); var claims = new Claim[] { - new Claim(ClaimTypes.Name, user.Username), + new Claim(ClaimTypes.Name, user.Name), new Claim("ObjectId", user.ObjectId.ToString()) }; diff --git a/HBContext.cs b/HBContext.cs index c38a614..4334495 100644 --- a/HBContext.cs +++ b/HBContext.cs @@ -69,7 +69,7 @@ public class HBContext : DbContext { modelBuilder.Entity().HasData(new User[] { new() { ObjectId = (int) HBObjectId.AdminUser, - Username = "admin", + Name = "admin", PasswordHash = UserService.HashPassword("admin") } }); diff --git a/Migrations/20230920014958_Security.Designer.cs b/Migrations/20230920014958_Security.Designer.cs new file mode 100644 index 0000000..7933a93 --- /dev/null +++ b/Migrations/20230920014958_Security.Designer.cs @@ -0,0 +1,455 @@ +// +using System; +using HyperBooru; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace HyperBooru.Migrations +{ + [DbContext(typeof(HBContext))] + [Migration("20230920014958_Security")] + partial class Security + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("HyperBooru.HBObject", b => + { + b.Property("ObjectId") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ObjectId")); + + b.Property("Guid") + .HasColumnType("uuid"); + + b.HasKey("ObjectId"); + + b.HasIndex("Guid"); + + b.ToTable("Objects", (string)null); + + b.UseTptMappingStrategy(); + }); + + modelBuilder.Entity("HyperBooru.OcrData", b => + { + b.Property("OcrDataId") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OcrDataId")); + + b.Property("MediaId") + .HasColumnType("integer"); + + b.Property("SearchableText") + .IsRequired() + .HasColumnType("text"); + + b.Property("Text") + .IsRequired() + .HasColumnType("text"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone"); + + b.HasKey("OcrDataId"); + + b.HasIndex("MediaId") + .IsUnique(); + + b.ToTable("OcrData"); + }); + + modelBuilder.Entity("TagDefinitionTagDefinition", b => + { + b.Property("ImplicitTagsObjectId") + .HasColumnType("integer"); + + b.Property("TagDefinitionObjectId") + .HasColumnType("integer"); + + b.HasKey("ImplicitTagsObjectId", "TagDefinitionObjectId"); + + b.HasIndex("TagDefinitionObjectId"); + + b.ToTable("TagDefinitionTagDefinition"); + }); + + modelBuilder.Entity("HyperBooru.Acl", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("SubjectTempId1") + .HasColumnType("integer"); + + b.ToTable("Acls"); + }); + + modelBuilder.Entity("HyperBooru.AclRule", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("AclObjectId") + .HasColumnType("integer"); + + b.Property("Action") + .HasColumnType("integer"); + + b.Property("Permissions") + .HasColumnType("numeric(20,0)"); + + b.Property("PrincipalObjectId") + .HasColumnType("integer"); + + b.HasIndex("AclObjectId"); + + b.HasIndex("PrincipalObjectId"); + + b.ToTable("AclRules"); + }); + + modelBuilder.Entity("HyperBooru.HBPrincipal", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasIndex("Name"); + + b.ToTable("Principals"); + }); + + modelBuilder.Entity("HyperBooru.Media", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("CurrentUploadedFileId") + .HasColumnType("integer"); + + b.Property("LongDescription") + .HasColumnType("text"); + + b.Property("ShortDescription") + .HasColumnType("text"); + + b.HasIndex("CurrentUploadedFileId") + .IsUnique(); + + b.ToTable("Media", (string)null); + }); + + modelBuilder.Entity("HyperBooru.Tag", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("CreateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("TagDefinitionId") + .HasColumnType("integer"); + + b.Property("TargetObjectId") + .HasColumnType("integer"); + + b.HasIndex("TagDefinitionId"); + + b.HasIndex("TargetObjectId"); + + b.ToTable("Tags", (string)null); + }); + + modelBuilder.Entity("HyperBooru.TagDefinition", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("Alias") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Namespace") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("integer"); + + b.ToTable("TagDefinitions", (string)null); + + b.HasData( + new + { + ObjectId = -1, + Guid = new Guid("ebdad4f8-455a-4351-8017-1d4854d6fa38"), + Name = "nsfw", + Source = 0 + }, + new + { + ObjectId = -2, + Guid = new Guid("ea212801-5bcc-4c0e-814f-fb9d30db58bc"), + Name = "ingest", + Source = 0 + }); + }); + + modelBuilder.Entity("HyperBooru.UploadedFile", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("Checksum") + .IsRequired() + .HasColumnType("text"); + + b.Property("ChecksumVerified") + .HasColumnType("boolean"); + + b.Property("CreateTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Filename") + .HasColumnType("text"); + + b.Property("Height") + .HasColumnType("integer"); + + b.Property("LastAccessTime") + .HasColumnType("timestamp with time zone"); + + b.Property("LastWriteTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Length") + .HasColumnType("bigint"); + + b.Property("MediaObjectId") + .HasColumnType("integer"); + + b.Property("MimeType") + .IsRequired() + .HasColumnType("text"); + + b.Property("UploadTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Width") + .HasColumnType("integer"); + + b.HasIndex("MediaObjectId"); + + b.ToTable("UploadedFiles", (string)null); + }); + + modelBuilder.Entity("HyperBooru.Group", b => + { + b.HasBaseType("HyperBooru.HBPrincipal"); + + b.Property("HBPrincipalObjectId") + .HasColumnType("integer"); + + b.HasIndex("HBPrincipalObjectId"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("HyperBooru.User", b => + { + b.HasBaseType("HyperBooru.HBPrincipal"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.ToTable("Users"); + + b.HasData( + new + { + ObjectId = -3, + Guid = new Guid("bf62bd4c-806e-4d1b-a62d-0efffce8628a"), + Name = "admin", + PasswordHash = "P4geAuE2yX/PDRHuJSq74FF5vO782rWz5c0LAQPR8m45DEYAONhu1wYnAn60PSNyjocqEBdnCeKCJfK3sKyuWw==" + }); + }); + + modelBuilder.Entity("HyperBooru.OcrData", b => + { + b.HasOne("HyperBooru.Media", "Media") + .WithOne("OcrData") + .HasForeignKey("HyperBooru.OcrData", "MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("TagDefinitionTagDefinition", b => + { + b.HasOne("HyperBooru.TagDefinition", null) + .WithMany() + .HasForeignKey("ImplicitTagsObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.TagDefinition", null) + .WithMany() + .HasForeignKey("TagDefinitionObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("HyperBooru.Acl", b => + { + b.HasOne("HyperBooru.HBObject", "Subject") + .WithOne("Acl") + .HasForeignKey("HyperBooru.Acl", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("HyperBooru.AclRule", b => + { + b.HasOne("HyperBooru.Acl", null) + .WithMany("Rules") + .HasForeignKey("AclObjectId"); + + b.HasOne("HyperBooru.HBPrincipal", "Principal") + .WithMany() + .HasForeignKey("PrincipalObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Principal"); + }); + + modelBuilder.Entity("HyperBooru.Media", b => + { + b.HasOne("HyperBooru.UploadedFile", "CurrentUploadedFile") + .WithOne() + .HasForeignKey("HyperBooru.Media", "CurrentUploadedFileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.HBObject", null) + .WithOne() + .HasForeignKey("HyperBooru.Media", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CurrentUploadedFile"); + }); + + modelBuilder.Entity("HyperBooru.Tag", b => + { + b.HasOne("HyperBooru.HBObject", null) + .WithOne() + .HasForeignKey("HyperBooru.Tag", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.TagDefinition", "TagDefinition") + .WithMany() + .HasForeignKey("TagDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.HBObject", "Target") + .WithMany("Tags") + .HasForeignKey("TargetObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TagDefinition"); + + b.Navigation("Target"); + }); + + modelBuilder.Entity("HyperBooru.TagDefinition", b => + { + b.HasOne("HyperBooru.HBObject", null) + .WithOne() + .HasForeignKey("HyperBooru.TagDefinition", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("HyperBooru.UploadedFile", b => + { + b.HasOne("HyperBooru.Media", "Media") + .WithMany("UploadedFiles") + .HasForeignKey("MediaObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.HBObject", null) + .WithOne() + .HasForeignKey("HyperBooru.UploadedFile", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("HyperBooru.Group", b => + { + b.HasOne("HyperBooru.HBPrincipal", null) + .WithMany("MemberOf") + .HasForeignKey("HBPrincipalObjectId"); + }); + + modelBuilder.Entity("HyperBooru.User", b => + { + b.HasOne("HyperBooru.HBPrincipal", null) + .WithOne() + .HasForeignKey("HyperBooru.User", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("HyperBooru.HBObject", b => + { + b.Navigation("Acl"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("HyperBooru.Acl", b => + { + b.Navigation("Rules"); + }); + + modelBuilder.Entity("HyperBooru.HBPrincipal", b => + { + b.Navigation("MemberOf"); + }); + + modelBuilder.Entity("HyperBooru.Media", b => + { + b.Navigation("OcrData"); + + b.Navigation("UploadedFiles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20230920014958_Security.cs b/Migrations/20230920014958_Security.cs new file mode 100644 index 0000000..ed7def8 --- /dev/null +++ b/Migrations/20230920014958_Security.cs @@ -0,0 +1,194 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace HyperBooru.Migrations +{ + /// + public partial class Security : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Users_Objects_ObjectId", + table: "Users"); + + migrationBuilder.DropIndex( + name: "IX_Users_Username", + table: "Users"); + + migrationBuilder.CreateTable( + name: "Acls", + columns: table => new + { + ObjectId = table.Column(type: "integer", nullable: false), + SubjectTempId1 = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Acls", x => x.ObjectId); + table.ForeignKey( + name: "FK_Acls_Objects_ObjectId", + column: x => x.ObjectId, + principalTable: "Objects", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Principals", + columns: table => new + { + ObjectId = table.Column(type: "integer", nullable: false), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Principals", x => x.ObjectId); + }); + + migrationBuilder.CreateTable( + name: "AclRules", + columns: table => new + { + ObjectId = table.Column(type: "integer", nullable: false), + PrincipalObjectId = table.Column(type: "integer", nullable: false), + Action = table.Column(type: "integer", nullable: false), + Permissions = table.Column(type: "numeric(20,0)", nullable: false), + AclObjectId = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AclRules", x => x.ObjectId); + table.ForeignKey( + name: "FK_AclRules_Acls_AclObjectId", + column: x => x.AclObjectId, + principalTable: "Acls", + principalColumn: "ObjectId"); + table.ForeignKey( + name: "FK_AclRules_Principals_PrincipalObjectId", + column: x => x.PrincipalObjectId, + principalTable: "Principals", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Groups", + columns: table => new + { + ObjectId = table.Column(type: "integer", nullable: false), + HBPrincipalObjectId = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Groups", x => x.ObjectId); + table.ForeignKey( + name: "FK_Groups_Principals_HBPrincipalObjectId", + column: x => x.HBPrincipalObjectId, + principalTable: "Principals", + principalColumn: "ObjectId"); + }); + + migrationBuilder.UpdateData( + table: "Objects", + keyColumn: "ObjectId", + keyValue: -3, + column: "Guid", + value: new Guid("bf62bd4c-806e-4d1b-a62d-0efffce8628a")); + + migrationBuilder.InsertData( + table: "Principals", + columns: new[] { "ObjectId", "Name" }, + values: new object[] { -3, "admin" }); + + migrationBuilder.CreateIndex( + name: "IX_AclRules_AclObjectId", + table: "AclRules", + column: "AclObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_AclRules_PrincipalObjectId", + table: "AclRules", + column: "PrincipalObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_Groups_HBPrincipalObjectId", + table: "Groups", + column: "HBPrincipalObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_Principals_Name", + table: "Principals", + column: "Name"); + + migrationBuilder.AddForeignKey( + name: "FK_Users_Principals_ObjectId", + table: "Users", + column: "ObjectId", + principalTable: "Principals", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.DropColumn( + name: "Username", + table: "Users"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Users_Principals_ObjectId", + table: "Users"); + + migrationBuilder.DropTable( + name: "AclRules"); + + migrationBuilder.DropTable( + name: "Groups"); + + migrationBuilder.DropTable( + name: "Acls"); + + migrationBuilder.DropTable( + name: "Principals"); + + migrationBuilder.AddColumn( + name: "Username", + table: "Users", + type: "text", + nullable: false, + defaultValue: ""); + + migrationBuilder.UpdateData( + table: "Objects", + keyColumn: "ObjectId", + keyValue: -3, + column: "Guid", + value: new Guid("4fa948f4-7c45-4f81-bb6b-e417491e6c96")); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "ObjectId", + keyValue: -3, + column: "Username", + value: "admin"); + + migrationBuilder.CreateIndex( + name: "IX_Users_Username", + table: "Users", + column: "Username"); + + migrationBuilder.AddForeignKey( + name: "FK_Users_Objects_ObjectId", + table: "Users", + column: "ObjectId", + principalTable: "Objects", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Migrations/HBContextModelSnapshot.cs b/Migrations/HBContextModelSnapshot.cs index 5dc4d8d..da4c444 100644 --- a/Migrations/HBContextModelSnapshot.cs +++ b/Migrations/HBContextModelSnapshot.cs @@ -87,6 +87,52 @@ namespace HyperBooru.Migrations b.ToTable("TagDefinitionTagDefinition"); }); + modelBuilder.Entity("HyperBooru.Acl", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("SubjectTempId1") + .HasColumnType("integer"); + + b.ToTable("Acls"); + }); + + modelBuilder.Entity("HyperBooru.AclRule", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("AclObjectId") + .HasColumnType("integer"); + + b.Property("Action") + .HasColumnType("integer"); + + b.Property("Permissions") + .HasColumnType("numeric(20,0)"); + + b.Property("PrincipalObjectId") + .HasColumnType("integer"); + + b.HasIndex("AclObjectId"); + + b.HasIndex("PrincipalObjectId"); + + b.ToTable("AclRules"); + }); + + modelBuilder.Entity("HyperBooru.HBPrincipal", b => + { + b.HasBaseType("HyperBooru.HBObject"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasIndex("Name"); + + b.ToTable("Principals"); + }); + modelBuilder.Entity("HyperBooru.Media", b => { b.HasBaseType("HyperBooru.HBObject"); @@ -209,29 +255,35 @@ namespace HyperBooru.Migrations b.ToTable("UploadedFiles", (string)null); }); + modelBuilder.Entity("HyperBooru.Group", b => + { + b.HasBaseType("HyperBooru.HBPrincipal"); + + b.Property("HBPrincipalObjectId") + .HasColumnType("integer"); + + b.HasIndex("HBPrincipalObjectId"); + + b.ToTable("Groups"); + }); + modelBuilder.Entity("HyperBooru.User", b => { - b.HasBaseType("HyperBooru.HBObject"); + b.HasBaseType("HyperBooru.HBPrincipal"); b.Property("PasswordHash") .IsRequired() .HasColumnType("text"); - b.Property("Username") - .IsRequired() - .HasColumnType("text"); - - b.HasIndex("Username"); - b.ToTable("Users"); b.HasData( new { ObjectId = -3, - Guid = new Guid("4fa948f4-7c45-4f81-bb6b-e417491e6c96"), - PasswordHash = "P4geAuE2yX/PDRHuJSq74FF5vO782rWz5c0LAQPR8m45DEYAONhu1wYnAn60PSNyjocqEBdnCeKCJfK3sKyuWw==", - Username = "admin" + Guid = new Guid("bf62bd4c-806e-4d1b-a62d-0efffce8628a"), + Name = "admin", + PasswordHash = "P4geAuE2yX/PDRHuJSq74FF5vO782rWz5c0LAQPR8m45DEYAONhu1wYnAn60PSNyjocqEBdnCeKCJfK3sKyuWw==" }); }); @@ -261,6 +313,32 @@ namespace HyperBooru.Migrations .IsRequired(); }); + modelBuilder.Entity("HyperBooru.Acl", b => + { + b.HasOne("HyperBooru.HBObject", "Subject") + .WithOne("Acl") + .HasForeignKey("HyperBooru.Acl", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subject"); + }); + + modelBuilder.Entity("HyperBooru.AclRule", b => + { + b.HasOne("HyperBooru.Acl", null) + .WithMany("Rules") + .HasForeignKey("AclObjectId"); + + b.HasOne("HyperBooru.HBPrincipal", "Principal") + .WithMany() + .HasForeignKey("PrincipalObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Principal"); + }); + modelBuilder.Entity("HyperBooru.Media", b => { b.HasOne("HyperBooru.UploadedFile", "CurrentUploadedFile") @@ -329,9 +407,16 @@ namespace HyperBooru.Migrations b.Navigation("Media"); }); + modelBuilder.Entity("HyperBooru.Group", b => + { + b.HasOne("HyperBooru.HBPrincipal", null) + .WithMany("MemberOf") + .HasForeignKey("HBPrincipalObjectId"); + }); + modelBuilder.Entity("HyperBooru.User", b => { - b.HasOne("HyperBooru.HBObject", null) + b.HasOne("HyperBooru.HBPrincipal", null) .WithOne() .HasForeignKey("HyperBooru.User", "ObjectId") .OnDelete(DeleteBehavior.Cascade) @@ -340,9 +425,21 @@ namespace HyperBooru.Migrations modelBuilder.Entity("HyperBooru.HBObject", b => { + b.Navigation("Acl"); + b.Navigation("Tags"); }); + modelBuilder.Entity("HyperBooru.Acl", b => + { + b.Navigation("Rules"); + }); + + modelBuilder.Entity("HyperBooru.HBPrincipal", b => + { + b.Navigation("MemberOf"); + }); + modelBuilder.Entity("HyperBooru.Media", b => { b.Navigation("OcrData"); -- cgit v1.3