using System.Security.Claims; namespace ZB.MOM.WW.MxGateway.Server.Dashboard; public sealed class DashboardApiKeyAuthorization { /// Determines whether the user can manage API keys. /// The authenticated user principal. /// if the user is authenticated and holds the role; otherwise . public bool CanManage(ClaimsPrincipal user) { if (user.Identity?.IsAuthenticated != true) { return false; } return user.IsInRole(DashboardRoles.Admin); } }