WIP: AdminClubService DI fix and RLS-related changes
This commit is contained in:
@@ -44,6 +44,14 @@ public class TenantValidationMiddleware
|
||||
|
||||
if (string.IsNullOrEmpty(clubsClaim))
|
||||
{
|
||||
// NEW: Skip check if user is a global admin
|
||||
var realmAccess = context.User.FindFirst("realm_access")?.Value;
|
||||
if (!string.IsNullOrEmpty(realmAccess) && realmAccess.Contains("\"admin\"", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
await _next(context);
|
||||
return;
|
||||
}
|
||||
|
||||
context.Response.StatusCode = StatusCodes.Status403Forbidden;
|
||||
await context.Response.WriteAsJsonAsync(new { error = "User does not have clubs claim" });
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user