diff options
| -rw-r--r-- | Jellyfin.Data/Entities/ProviderMapping.cs | 6 | ||||
| -rw-r--r-- | Jellyfin.Data/Entities/User.cs | 20 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/JellyfinDb.cs | 3 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/Migrations/20200531020729_AddUsers.Designer.cs (renamed from Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.Designer.cs) | 99 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/Migrations/20200531020729_AddUsers.cs (renamed from Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.cs) | 104 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs | 96 |
6 files changed, 16 insertions, 312 deletions
diff --git a/Jellyfin.Data/Entities/ProviderMapping.cs b/Jellyfin.Data/Entities/ProviderMapping.cs index 6197bd97b..e479341ad 100644 --- a/Jellyfin.Data/Entities/ProviderMapping.cs +++ b/Jellyfin.Data/Entities/ProviderMapping.cs @@ -43,12 +43,6 @@ namespace Jellyfin.Data.Entities if (string.IsNullOrEmpty(providerdata)) throw new ArgumentNullException(nameof(providerdata)); this.ProviderData = providerdata; - if (_user0 == null) throw new ArgumentNullException(nameof(_user0)); - _user0.ProviderMappings.Add(this); - - if (_group1 == null) throw new ArgumentNullException(nameof(_group1)); - _group1.ProviderMappings.Add(this); - Init(); } diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs index a6221a249..f09b36bde 100644 --- a/Jellyfin.Data/Entities/User.cs +++ b/Jellyfin.Data/Entities/User.cs @@ -47,11 +47,11 @@ namespace Jellyfin.Data.Entities AuthenticationProviderId = authenticationProviderId; PasswordResetProviderId = passwordResetProviderId; - Groups = new HashSet<Group>(); + AccessSchedules = new HashSet<AccessSchedule>(); + // Groups = new HashSet<Group>(); Permissions = new HashSet<Permission>(); - ProviderMappings = new HashSet<ProviderMapping>(); Preferences = new HashSet<Preference>(); - AccessSchedules = new HashSet<AccessSchedule>(); + // ProviderMappings = new HashSet<ProviderMapping>(); // Set default values Id = Guid.NewGuid(); @@ -343,10 +343,17 @@ namespace Jellyfin.Data.Entities *************************************************************************/ /// <summary> + /// Gets or sets the list of access schedules this user has. + /// </summary> + public virtual ICollection<AccessSchedule> AccessSchedules { get; protected set; } + + /* + /// <summary> /// Gets or sets the list of groups this user is a member of. /// </summary> [ForeignKey("Group_Groups_Guid")] public virtual ICollection<Group> Groups { get; protected set; } + */ /// <summary> /// Gets or sets the list of permissions this user has. @@ -354,11 +361,13 @@ namespace Jellyfin.Data.Entities [ForeignKey("Permission_Permissions_Guid")] public virtual ICollection<Permission> Permissions { get; protected set; } + /* /// <summary> /// Gets or sets the list of provider mappings this user has. /// </summary> [ForeignKey("ProviderMapping_ProviderMappings_Id")] public virtual ICollection<ProviderMapping> ProviderMappings { get; protected set; } + */ /// <summary> /// Gets or sets the list of preferences this user has. @@ -367,11 +376,6 @@ namespace Jellyfin.Data.Entities public virtual ICollection<Preference> Preferences { get; protected set; } /// <summary> - /// Gets or sets the list of access schedules this user has. - /// </summary> - public virtual ICollection<AccessSchedule> AccessSchedules { get; protected set; } - - /// <summary> /// Static create function (for use in LINQ queries, etc.) /// </summary> /// <param name="username">The username for the created user.</param> diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs index 89fd371f8..ae783efd8 100644 --- a/Jellyfin.Server.Implementations/JellyfinDb.cs +++ b/Jellyfin.Server.Implementations/JellyfinDb.cs @@ -25,8 +25,6 @@ namespace Jellyfin.Server.Implementations public virtual DbSet<ActivityLog> ActivityLogs { get; set; } - public virtual DbSet<Group> Groups { get; set; } - public virtual DbSet<Permission> Permissions { get; set; } public virtual DbSet<Preference> Preferences { get; set; } @@ -45,6 +43,7 @@ namespace Jellyfin.Server.Implementations public virtual DbSet<Episode> Episodes { get; set; } public virtual DbSet<EpisodeMetadata> EpisodeMetadata { get; set; } public virtual DbSet<Genre> Genres { get; set; } + public virtual DbSet<Group> Groups { get; set; } public virtual DbSet<Library> Libraries { get; set; } public virtual DbSet<LibraryItem> LibraryItems { get; set; } public virtual DbSet<LibraryRoot> LibraryRoot { get; set; } diff --git a/Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20200531020729_AddUsers.Designer.cs index d1d26726e..04fb9132d 100644 --- a/Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.Designer.cs +++ b/Jellyfin.Server.Implementations/Migrations/20200531020729_AddUsers.Designer.cs @@ -1,4 +1,5 @@ #pragma warning disable CS1591 +#pragma warning disable SA1601 // <auto-generated /> using System; @@ -11,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Jellyfin.Server.Implementations.Migrations { [DbContext(typeof(JellyfinDb))] - [Migration("20200529171409_AddUsers")] + [Migration("20200531020729_AddUsers")] partial class AddUsers { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -92,31 +93,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.ToTable("ActivityLogs"); }); - modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<Guid?>("Group_Groups_Guid") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Group_Groups_Guid"); - - b.ToTable("Groups"); - }); - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => { b.Property<int>("Id") @@ -145,9 +121,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<int>("Kind") .HasColumnType("INTEGER"); - b.Property<Guid?>("Permission_GroupPermissions_Id") - .HasColumnType("TEXT"); - b.Property<Guid?>("Permission_Permissions_Guid") .HasColumnType("TEXT"); @@ -160,8 +133,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.HasIndex("Permission_GroupPermissions_Id"); - b.HasIndex("Permission_Permissions_Guid"); b.ToTable("Permissions"); @@ -179,9 +150,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<Guid?>("Preference_Preferences_Guid") .HasColumnType("TEXT"); - b.Property<Guid?>("Preference_Preferences_Id") - .HasColumnType("TEXT"); - b.Property<uint>("RowVersion") .IsConcurrencyToken() .HasColumnType("INTEGER"); @@ -195,46 +163,9 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasIndex("Preference_Preferences_Guid"); - b.HasIndex("Preference_Preferences_Id"); - b.ToTable("Preferences"); }); - modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("ProviderData") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<Guid?>("ProviderMapping_ProviderMappings_Id") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderName") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<string>("ProviderSecrets") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ProviderMapping_ProviderMappings_Id"); - - b.ToTable("ProviderMapping"); - }); - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => { b.Property<Guid>("Id") @@ -355,19 +286,8 @@ namespace Jellyfin.Server.Implementations.Migrations .IsRequired(); }); - modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Groups") - .HasForeignKey("Group_Groups_Guid"); - }); - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => { - b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("Permissions") - .HasForeignKey("Permission_GroupPermissions_Id"); - b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Permissions") .HasForeignKey("Permission_Permissions_Guid"); @@ -378,21 +298,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Preferences") .HasForeignKey("Preference_Preferences_Guid"); - - b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Id"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b => - { - b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("ProviderMappings") - .HasForeignKey("ProviderMapping_ProviderMappings_Id"); - - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ProviderMappings") - .HasForeignKey("ProviderMapping_ProviderMappings_Id"); }); modelBuilder.Entity("Jellyfin.Data.Entities.User", b => diff --git a/Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.cs b/Jellyfin.Server.Implementations/Migrations/20200531020729_AddUsers.cs index 2b84cf7b0..ec6b374ec 100644 --- a/Jellyfin.Server.Implementations/Migrations/20200529171409_AddUsers.cs +++ b/Jellyfin.Server.Implementations/Migrations/20200531020729_AddUsers.cs @@ -98,28 +98,6 @@ namespace Jellyfin.Server.Implementations.Migrations }); migrationBuilder.CreateTable( - name: "Groups", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<Guid>(nullable: false), - Name = table.Column<string>(maxLength: 255, nullable: false), - RowVersion = table.Column<uint>(nullable: false), - Group_Groups_Guid = table.Column<Guid>(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Groups", x => x.Id); - table.ForeignKey( - name: "FK_Groups_Users_Group_Groups_Guid", - column: x => x.Group_Groups_Guid, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( name: "Permissions", schema: "jellyfin", columns: table => new @@ -129,20 +107,12 @@ namespace Jellyfin.Server.Implementations.Migrations Kind = table.Column<int>(nullable: false), Value = table.Column<bool>(nullable: false), RowVersion = table.Column<uint>(nullable: false), - Permission_GroupPermissions_Id = table.Column<Guid>(nullable: true), Permission_Permissions_Guid = table.Column<Guid>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Permissions", x => x.Id); table.ForeignKey( - name: "FK_Permissions_Groups_Permission_GroupPermissions_Id", - column: x => x.Permission_GroupPermissions_Id, - principalSchema: "jellyfin", - principalTable: "Groups", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( name: "FK_Permissions_Users_Permission_Permissions_Guid", column: x => x.Permission_Permissions_Guid, principalSchema: "jellyfin", @@ -161,8 +131,7 @@ namespace Jellyfin.Server.Implementations.Migrations Kind = table.Column<int>(nullable: false), Value = table.Column<string>(maxLength: 65535, nullable: false), RowVersion = table.Column<uint>(nullable: false), - Preference_Preferences_Guid = table.Column<Guid>(nullable: true), - Preference_Preferences_Id = table.Column<Guid>(nullable: true) + Preference_Preferences_Guid = table.Column<Guid>(nullable: true) }, constraints: table => { @@ -174,45 +143,6 @@ namespace Jellyfin.Server.Implementations.Migrations principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Preferences_Groups_Preference_Preferences_Id", - column: x => x.Preference_Preferences_Id, - principalSchema: "jellyfin", - principalTable: "Groups", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "ProviderMapping", - schema: "jellyfin", - columns: table => new - { - Id = table.Column<int>(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ProviderName = table.Column<string>(maxLength: 255, nullable: false), - ProviderSecrets = table.Column<string>(maxLength: 65535, nullable: false), - ProviderData = table.Column<string>(maxLength: 65535, nullable: false), - RowVersion = table.Column<uint>(nullable: false), - ProviderMapping_ProviderMappings_Id = table.Column<Guid>(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ProviderMapping", x => x.Id); - table.ForeignKey( - name: "FK_ProviderMapping_Groups_ProviderMapping_ProviderMappings_Id", - column: x => x.ProviderMapping_ProviderMappings_Id, - principalSchema: "jellyfin", - principalTable: "Groups", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ProviderMapping_Users_ProviderMapping_ProviderMappings_Id", - column: x => x.ProviderMapping_ProviderMappings_Id, - principalSchema: "jellyfin", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( @@ -222,18 +152,6 @@ namespace Jellyfin.Server.Implementations.Migrations column: "UserId"); migrationBuilder.CreateIndex( - name: "IX_Groups_Group_Groups_Guid", - schema: "jellyfin", - table: "Groups", - column: "Group_Groups_Guid"); - - migrationBuilder.CreateIndex( - name: "IX_Permissions_Permission_GroupPermissions_Id", - schema: "jellyfin", - table: "Permissions", - column: "Permission_GroupPermissions_Id"); - - migrationBuilder.CreateIndex( name: "IX_Permissions_Permission_Permissions_Guid", schema: "jellyfin", table: "Permissions", @@ -246,18 +164,6 @@ namespace Jellyfin.Server.Implementations.Migrations column: "Preference_Preferences_Guid"); migrationBuilder.CreateIndex( - name: "IX_Preferences_Preference_Preferences_Id", - schema: "jellyfin", - table: "Preferences", - column: "Preference_Preferences_Id"); - - migrationBuilder.CreateIndex( - name: "IX_ProviderMapping_ProviderMapping_ProviderMappings_Id", - schema: "jellyfin", - table: "ProviderMapping", - column: "ProviderMapping_ProviderMappings_Id"); - - migrationBuilder.CreateIndex( name: "IX_Users_ProfileImageId", schema: "jellyfin", table: "Users", @@ -279,14 +185,6 @@ namespace Jellyfin.Server.Implementations.Migrations schema: "jellyfin"); migrationBuilder.DropTable( - name: "ProviderMapping", - schema: "jellyfin"); - - migrationBuilder.DropTable( - name: "Groups", - schema: "jellyfin"); - - migrationBuilder.DropTable( name: "Users", schema: "jellyfin"); diff --git a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs index 9a2315802..115c98aa3 100644 --- a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs +++ b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs @@ -88,31 +88,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.ToTable("ActivityLogs"); }); - modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => - { - b.Property<Guid>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property<Guid?>("Group_Groups_Guid") - .HasColumnType("TEXT"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Group_Groups_Guid"); - - b.ToTable("Groups"); - }); - modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => { b.Property<int>("Id") @@ -141,9 +116,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<int>("Kind") .HasColumnType("INTEGER"); - b.Property<Guid?>("Permission_GroupPermissions_Id") - .HasColumnType("TEXT"); - b.Property<Guid?>("Permission_Permissions_Guid") .HasColumnType("TEXT"); @@ -156,8 +128,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.HasIndex("Permission_GroupPermissions_Id"); - b.HasIndex("Permission_Permissions_Guid"); b.ToTable("Permissions"); @@ -175,9 +145,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<Guid?>("Preference_Preferences_Guid") .HasColumnType("TEXT"); - b.Property<Guid?>("Preference_Preferences_Id") - .HasColumnType("TEXT"); - b.Property<uint>("RowVersion") .IsConcurrencyToken() .HasColumnType("INTEGER"); @@ -191,46 +158,9 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasIndex("Preference_Preferences_Guid"); - b.HasIndex("Preference_Preferences_Id"); - b.ToTable("Preferences"); }); - modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b => - { - b.Property<int>("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<string>("ProviderData") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<Guid?>("ProviderMapping_ProviderMappings_Id") - .HasColumnType("TEXT"); - - b.Property<string>("ProviderName") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); - - b.Property<string>("ProviderSecrets") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(65535); - - b.Property<uint>("RowVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ProviderMapping_ProviderMappings_Id"); - - b.ToTable("ProviderMapping"); - }); - modelBuilder.Entity("Jellyfin.Data.Entities.User", b => { b.Property<Guid>("Id") @@ -351,19 +281,8 @@ namespace Jellyfin.Server.Implementations.Migrations .IsRequired(); }); - modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => - { - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("Groups") - .HasForeignKey("Group_Groups_Guid"); - }); - modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => { - b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("Permissions") - .HasForeignKey("Permission_GroupPermissions_Id"); - b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Permissions") .HasForeignKey("Permission_Permissions_Guid"); @@ -374,21 +293,6 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Preferences") .HasForeignKey("Preference_Preferences_Guid"); - - b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Id"); - }); - - modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b => - { - b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("ProviderMappings") - .HasForeignKey("ProviderMapping_ProviderMappings_Id"); - - b.HasOne("Jellyfin.Data.Entities.User", null) - .WithMany("ProviderMappings") - .HasForeignKey("ProviderMapping_ProviderMappings_Id"); }); modelBuilder.Entity("Jellyfin.Data.Entities.User", b => |
