From c9e6ce0bca495f8d86fd2cfb5bfe2a51049c9400 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Wed, 25 Dec 2019 21:05:57 -0600 Subject: [PATCH] fix authorize issue on penalty info after upgrading .NET Core runtime targets --- Plugins/Web/StatsWeb/Controllers/StatsController.cs | 5 +++++ SharedLibraryCore/Services/ClientService.cs | 2 ++ WebfrontCore/Startup.cs | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Plugins/Web/StatsWeb/Controllers/StatsController.cs b/Plugins/Web/StatsWeb/Controllers/StatsController.cs index 22c44f166..d7c6a7883 100644 --- a/Plugins/Web/StatsWeb/Controllers/StatsController.cs +++ b/Plugins/Web/StatsWeb/Controllers/StatsController.cs @@ -115,6 +115,11 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers .Select(_penalty => new { _penalty.OffenderId, _penalty.PenaltyId, _penalty.When, _penalty.AutomatedOffense }) .FirstOrDefaultAsync(_penalty => _penalty.PenaltyId == penaltyId); + if (penalty == null) + { + return NotFound(); + } + // todo: this can be optimized var iqSnapshotInfo = ctx.Set() .Where(s => s.ClientId == penalty.OffenderId) diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index a7c9ce578..8fb5d7c00 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -50,6 +50,8 @@ namespace SharedLibraryCore.Services NetworkId = entity.NetworkId }; + + entity.CurrentServer.Logger.WriteDebug($"[create] adding {entity} to context"); context.Clients.Add(client); // they're just using a new GUID diff --git a/WebfrontCore/Startup.cs b/WebfrontCore/Startup.cs index 46f681bca..0d7abb765 100644 --- a/WebfrontCore/Startup.cs +++ b/WebfrontCore/Startup.cs @@ -114,13 +114,13 @@ namespace WebfrontCore app.UseStaticFiles(); app.UseAuthentication(); - app.UseAuthorization(); app.UseCors("AllowAll"); // prevents banned/demoted users from keeping their claims app.UseMiddleware(Program.Manager); app.UseRouting(); + app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");