fca978de07
Sweep of 203 source files resolving CommentChecker findings: add <summary>/<param>/<returns>/<inheritdoc> where missing, and remove resolved task/issue tracking markers (Tests-NNN, Worker-NNN, Server-NNN, Task N) from code comments. Comment/doc-only — no logic changes. Server+Tests build clean under TreatWarningsAsErrors.
20 lines
658 B
C#
20 lines
658 B
C#
using System.Security.Claims;
|
|
|
|
namespace ZB.MOM.WW.MxGateway.Server.Dashboard;
|
|
|
|
public sealed class DashboardApiKeyAuthorization
|
|
{
|
|
/// <summary>Determines whether the user can manage API keys.</summary>
|
|
/// <param name="user">The authenticated user principal.</param>
|
|
/// <returns><see langword="true"/> if the user is authenticated and holds the <see cref="DashboardRoles.Admin"/> role; otherwise <see langword="false"/>.</returns>
|
|
public bool CanManage(ClaimsPrincipal user)
|
|
{
|
|
if (user.Identity?.IsAuthenticated != true)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return user.IsInRole(DashboardRoles.Admin);
|
|
}
|
|
}
|