615b487a77
Adds missing <summary>/<param> XML docs across 99 server, worker, and test files so CommentChecker reports zero issues (TreatWarningsAsErrors needs the analyzer clean). Bundles in WIP dashboard work: NavSection extraction, MainLayout/site.css/js styling alignment, and DashboardOptions/Auth tweaks.
22 lines
988 B
C#
22 lines
988 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
|
|
namespace ZB.MOM.WW.MxGateway.Server.Dashboard;
|
|
|
|
/// <summary>
|
|
/// Requirement satisfied when the user has any one of the listed roles, or
|
|
/// when an environment-level bypass (auth disabled / loopback) is in effect.
|
|
/// </summary>
|
|
public sealed class DashboardAuthorizationRequirement(IReadOnlyList<string> requiredRoles) : IAuthorizationRequirement
|
|
{
|
|
/// <summary>Gets the list of roles required to satisfy this requirement.</summary>
|
|
public IReadOnlyList<string> RequiredRoles { get; } = requiredRoles;
|
|
|
|
/// <summary>Gets a requirement satisfied by any dashboard role (admin or viewer).</summary>
|
|
public static DashboardAuthorizationRequirement AnyDashboardRole { get; } =
|
|
new([DashboardRoles.Admin, DashboardRoles.Viewer]);
|
|
|
|
/// <summary>Gets a requirement satisfied only by the admin role.</summary>
|
|
public static DashboardAuthorizationRequirement AdminOnly { get; } =
|
|
new([DashboardRoles.Admin]);
|
|
}
|