diff --git a/Moonlight/Core/CoreFeature.cs b/Moonlight/Core/CoreFeature.cs index f8513fa..df698bf 100644 --- a/Moonlight/Core/CoreFeature.cs +++ b/Moonlight/Core/CoreFeature.cs @@ -114,6 +114,12 @@ public class CoreFeature : MoonlightFeature // Define permissions var permissionService = app.Services.GetRequiredService(); + await permissionService.Register(999, new() + { + Name = "See Admin Page", + Description = "Allows access to the admin page and the connected stats (server and user count)" + }); + await permissionService.Register(1000, new() { Name = "Manage users", diff --git a/Moonlight/Core/UI/Views/Admin/Index.razor b/Moonlight/Core/UI/Views/Admin/Index.razor new file mode 100644 index 0000000..45de84b --- /dev/null +++ b/Moonlight/Core/UI/Views/Admin/Index.razor @@ -0,0 +1,71 @@ +@page "/admin" +@using MoonCore.Abstractions +@using Moonlight.Core.Database.Entities +@using Moonlight.Features.Servers.Entities + +@inject Repository ServerRepository +@inject Repository UserRepository + +@attribute [RequirePermission(999)] + + + + + +@* This is just the start of this admin page, there will still be added more during the developement process *@ + +@code { + private List Servers; + private List Users; + + private async Task Load(LazyLoader arg) + { + await Task.Run(() => + { + arg.SetText("Loading Information..."); + Servers = ServerRepository.Get().ToList(); + Users = UserRepository.Get().ToList(); + }); + } +} \ No newline at end of file