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 --- Migrations/HBContextModelSnapshot.cs | 119 +++++++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 11 deletions(-) (limited to 'Migrations/HBContextModelSnapshot.cs') 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