Pfade für Libraries hinterlegt

This commit is contained in:
BuildTools 2024-05-26 15:17:25 +02:00
parent 205fb71316
commit 269536e597
10 changed files with 649 additions and 20 deletions

View File

@ -15,18 +15,28 @@
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
</NavLink>
</div>
<AuthorizeView Roles="Administrator">
<div class="nav-item px-3">
<NavLink class="nav-link" href="">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Sessions
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Bibliotheken
</NavLink>
</div>
@* <div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="weather">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
</NavLink>
</div>
</div> *@
</AuthorizeView>
<AuthorizeView>
<Authorized>
<div class="nav-item px-3">
@ -39,7 +49,7 @@
<AntiforgeryToken />
<input type="hidden" name="ReturnUrl" value="@currentUrl" />
<button type="submit" class="nav-link">
<span class="bi bi-arrow-bar-left-nav-menu" aria-hidden="true"></span> Logout
<span class="bi bi-arrow-bar-left-nav-menu" aria-hidden="true"></span> Abmelden
</button>
</form>
</div>
@ -47,7 +57,7 @@
<NotAuthorized>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Account/Register">
<span class="bi bi-person-nav-menu" aria-hidden="true"></span> Register
<span class="bi bi-person-nav-menu" aria-hidden="true"></span> Registrieren
</NavLink>
</div>
<div class="nav-item px-3">

View File

@ -18,6 +18,9 @@
Not authorized user
</NotAuthorized>
</AuthorizeView>
<AuthorizeView Roles="Administrator">
Youre admin!
</AuthorizeView>
</p>

View File

@ -7,6 +7,7 @@ namespace songrequests_blazor.Data
public int Id { get; set; }
public string Name { get; set; } = null!;
public List<Song>? Songs { get; set; }
public List<string>? ScanPaths { get; set; }
public LibraryType Type { get; set; }
[Column("Sessions_ID")]

View File

@ -0,0 +1,555 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using songrequests_blazor.Data;
#nullable disable
namespace songrequests_blazor.Migrations
{
[DbContext(typeof(LocalDbContext))]
[Migration("20240526131642_AddLibraryPaths")]
partial class AddLibraryPaths
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.5");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
b.HasData(
new
{
Id = "fc985a25-19ce-48ed-8443-c845f550960a",
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(13)
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
b.UseTphMappingStrategy();
b.HasData(
new
{
Id = "5c2511d0-6a08-4950-babd-d107996749ba",
AccessFailedCount = 0,
ConcurrencyStamp = "359200b3-8f0c-4984-9cb3-f5c6a9957d17",
Email = "admin@admin.com",
EmailConfirmed = false,
LockoutEnabled = false,
NormalizedEmail = "ADMIN@ADMIN.COM",
NormalizedUserName = "ADMIN@ADMIN.COM",
PasswordHash = "AQAAAAIAAYagAAAAEObqrKlqsiNSIYErkAsuP7gY+2YW6//ZJ+/txgRXK8rj/8I1eizYiKoWPHANqBNHgA==",
PhoneNumberConfirmed = false,
SecurityStamp = "eac1c0ae-b1db-4b57-84db-4cbc0f7d0688",
TwoFactorEnabled = false,
UserName = "admin@admin.com"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
b.HasData(
new
{
UserId = "5c2511d0-6a08-4950-babd-d107996749ba",
RoleId = "fc985a25-19ce-48ed-8443-c845f550960a"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
{
b.Property<string>("UserVotesId")
.HasColumnType("TEXT");
b.Property<int>("VotedSongsId")
.HasColumnType("INTEGER");
b.HasKey("UserVotesId", "VotedSongsId");
b.HasIndex("VotedSongsId");
b.ToTable("QueuedSongs_UserVotes");
});
modelBuilder.Entity("Sessions_Libraries", b =>
{
b.Property<int>("EnabledLibrariesId")
.HasColumnType("INTEGER");
b.Property<int>("UsedInSessionsId")
.HasColumnType("INTEGER");
b.HasKey("EnabledLibrariesId", "UsedInSessionsId");
b.HasIndex("UsedInSessionsId");
b.ToTable("Sessions_Libraries");
});
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ScanPaths")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Libraries");
});
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("Added")
.HasColumnType("TEXT");
b.Property<string>("AddedBy_User_ID")
.HasColumnType("TEXT");
b.Property<DateTime?>("Played")
.HasColumnType("TEXT");
b.Property<int>("Position")
.HasColumnType("INTEGER");
b.Property<int>("Session_ID")
.HasColumnType("INTEGER");
b.Property<int>("Song_ID")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("AddedBy_User_ID");
b.HasIndex("Session_ID");
b.HasIndex("Song_ID");
b.ToTable("QueuedSongs");
});
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Active")
.HasColumnType("INTEGER");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
b.Property<string>("SessionCode")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Sessions");
});
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Album")
.HasColumnType("TEXT");
b.Property<string>("Artist")
.HasColumnType("TEXT");
b.Property<string>("Genre")
.HasColumnType("TEXT");
b.Property<TimeSpan>("Length")
.HasColumnType("TEXT");
b.Property<int>("Library_ID")
.HasColumnType("INTEGER");
b.Property<int>("RequestCount")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Uri")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Library_ID");
b.ToTable("Songs");
});
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.HasDiscriminator().HasValue("User");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
{
b.HasOne("songrequests_blazor.Data.User", null)
.WithMany()
.HasForeignKey("UserVotesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
.WithMany()
.HasForeignKey("VotedSongsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sessions_Libraries", b =>
{
b.HasOne("songrequests_blazor.Data.Library", null)
.WithMany()
.HasForeignKey("EnabledLibrariesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("songrequests_blazor.Data.Session", null)
.WithMany()
.HasForeignKey("UsedInSessionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
{
b.HasOne("songrequests_blazor.Data.User", "AdddedBy")
.WithMany("AddedSongs")
.HasForeignKey("AddedBy_User_ID")
.HasConstraintName("FK_user_addedsongs");
b.HasOne("songrequests_blazor.Data.Session", "Session")
.WithMany("QueuedSongs")
.HasForeignKey("Session_ID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_Session_QueuedSongs");
b.HasOne("songrequests_blazor.Data.Song", "Song")
.WithMany("Queued")
.HasForeignKey("Song_ID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_queuedsongs_song");
b.Navigation("AdddedBy");
b.Navigation("Session");
b.Navigation("Song");
});
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
{
b.HasOne("songrequests_blazor.Data.Library", "Library")
.WithMany("Songs")
.HasForeignKey("Library_ID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_library_songs");
b.Navigation("Library");
});
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
{
b.Navigation("Songs");
});
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
{
b.Navigation("QueuedSongs");
});
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
{
b.Navigation("Queued");
});
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
{
b.Navigation("AddedSongs");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace songrequests_blazor.Migrations
{
/// <inheritdoc />
public partial class AddLibraryPaths : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Active",
table: "Sessions",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "ScanPaths",
table: "Libraries",
type: "TEXT",
nullable: true);
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "5c2511d0-6a08-4950-babd-d107996749ba",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "359200b3-8f0c-4984-9cb3-f5c6a9957d17", "AQAAAAIAAYagAAAAEObqrKlqsiNSIYErkAsuP7gY+2YW6//ZJ+/txgRXK8rj/8I1eizYiKoWPHANqBNHgA==", "eac1c0ae-b1db-4b57-84db-4cbc0f7d0688" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Active",
table: "Sessions");
migrationBuilder.DropColumn(
name: "ScanPaths",
table: "Libraries");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "5c2511d0-6a08-4950-babd-d107996749ba",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "828466b4-e932-48c2-9ac5-2d5a16bbbade", "AQAAAAIAAYagAAAAEAHO/Ra7WSxWtOXx++pYevyMsD+Wt/8tsCfJtQ59NaWFxF7BztGzvgNrnblXuYOkww==", "23975ce5-b515-4a6a-a6b7-2a5e6d8c943e" });
}
}
}

View File

@ -151,15 +151,15 @@ namespace songrequests_blazor.Migrations
{
Id = "5c2511d0-6a08-4950-babd-d107996749ba",
AccessFailedCount = 0,
ConcurrencyStamp = "828466b4-e932-48c2-9ac5-2d5a16bbbade",
ConcurrencyStamp = "359200b3-8f0c-4984-9cb3-f5c6a9957d17",
Email = "admin@admin.com",
EmailConfirmed = false,
LockoutEnabled = false,
NormalizedEmail = "ADMIN@ADMIN.COM",
NormalizedUserName = "ADMIN@ADMIN.COM",
PasswordHash = "AQAAAAIAAYagAAAAEAHO/Ra7WSxWtOXx++pYevyMsD+Wt/8tsCfJtQ59NaWFxF7BztGzvgNrnblXuYOkww==",
PasswordHash = "AQAAAAIAAYagAAAAEObqrKlqsiNSIYErkAsuP7gY+2YW6//ZJ+/txgRXK8rj/8I1eizYiKoWPHANqBNHgA==",
PhoneNumberConfirmed = false,
SecurityStamp = "23975ce5-b515-4a6a-a6b7-2a5e6d8c943e",
SecurityStamp = "eac1c0ae-b1db-4b57-84db-4cbc0f7d0688",
TwoFactorEnabled = false,
UserName = "admin@admin.com"
});
@ -291,6 +291,9 @@ namespace songrequests_blazor.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ScanPaths")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
@ -340,6 +343,9 @@ namespace songrequests_blazor.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Active")
.HasColumnType("INTEGER");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");

View File

@ -34,15 +34,16 @@ builder.Services.AddAuthentication(options =>
})
.AddIdentityCookies();
builder.Services.AddIdentityCore<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = false)
builder.Services.AddIdentityCore<IdentityUser>(options => {
options.SignIn.RequireConfirmedAccount = false;
options.SignIn.RequireConfirmedEmail = false;
})
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<LocalDbContext>()
.AddSignInManager()
.AddDefaultTokenProviders();
// Email
//builder.Services.AddSingleton<IEmailSender<IdentityUser>, IdentityNoOpEmailSender>();
//builder.Services.Configure<Mailserver>(builder.Configuration);
builder.Services.AddTransient<IEmailSender<IdentityUser>, EmailSender>();
var googleAuth = builder.Configuration.GetSection("Authentication:Google");

Binary file not shown.

Binary file not shown.