Delete blogspot articles

This commit is contained in:
Paul Schneider 2025-09-14 23:52:21 +01:00
commit 4e92afb496
2 changed files with 10 additions and 49 deletions

View file

@ -69,14 +69,15 @@ public class PermissionHandler : IAuthorizationHandler
else
if (resource is DefaultHttpContext httpContext)
{
if (httpContext.Request.Path.StartsWithSegments("/blogpost/Delete", StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(
"/Blogspot/Delete",
StringComparison.OrdinalIgnoreCase))
{
string postId = (string)httpContext.GetRouteValue("id");
string postId = (string) httpContext.GetRouteValue("id");
if (long.TryParse(postId, out long id))
{
BlogPost b = applicationDbContext.BlogSpot.FirstOrDefault(b => b.Id == id && b.AuthorId == user.GetUserId());
return b != null;
BlogPost b = applicationDbContext.BlogSpot.FirstOrDefault(b => b.Id == id && b.AuthorId == user.GetUserId());
return b != null;
}
}
}