using System.Security.Claims; namespace PlotLine.Services; // Shared with the existing AdminOnly policy; a role/name alone never grants access. public static class AdministratorAccess { public static bool IsAllowed(ClaimsPrincipal? user, IConfiguration configuration) { if (user?.Identity?.IsAuthenticated != true) return false; var email = user.FindFirstValue(ClaimTypes.Email); return !string.IsNullOrWhiteSpace(email) && (configuration.GetSection("Admin:AllowedEmails").Get() ?? []) .Any(allowed => string.Equals(allowed, email, StringComparison.OrdinalIgnoreCase)); } }