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.
/// True if the user is an authenticated admin; otherwise false.
public bool CanManage(ClaimsPrincipal user)
{
if (user.Identity?.IsAuthenticated != true)
{
return false;
}
return user.IsInRole(DashboardRoles.Admin);
}
}