Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Security/Roles.cs
T
Joseph Doherty 9cff87fe85 docs(comments): strip internal task/milestone/bundle bookkeeping from code comments
Remove project bookkeeping citations from shipped code comments across the
solution: hyphenated task IDs (WP-14, StoreAndForward-025), milestone/task/
issue refs (M3, Task 4, Audit Log #23, #21), Bundle X task-bundle labels,
and C/D/K/S/T phase labels.

Comment text only — no code logic, string/log literals, or XML-doc structure
changed. Genuine descriptions are preserved (only the citation is stripped),
and technical lookalikes are retained (UTF-8, SHA-256, T00:00:00, M365,
UTC-5, pre-C4/pre-C5 schema versions). Flagged by the new CommentChecker
TaskReferenceInComment / TrackingReferenceInComment checks plus targeted
grep passes; full solution builds clean, append-only guard tests pass.
2026-07-07 11:03:26 -04:00

62 lines
3.1 KiB
C#

namespace ZB.MOM.WW.ScadaBridge.Security;
/// <summary>
/// Single source of truth for role-name string literals used across the
/// Security module and downstream authorization checks.
/// </summary>
/// <remarks>
/// <para>
/// Role names appear in three independent contexts: <see cref="RoleMapper"/>
/// (LDAP-group → role resolution), <see cref="AuthorizationPolicies"/>
/// (policy <c>RequireClaim</c> values + the audit role arrays), and at LDAP
/// mapping rows configured by an operator. Holding the literals here means a
/// rename either succeeds everywhere or fails to compile, eliminating the
/// "string drift" class.
/// </para>
/// <para>
/// Canonicalization (auth normalization): role VALUES were
/// standardized onto the canonical six (<c>Viewer/Operator/Engineer/Designer/
/// Deployer/Administrator</c>; only four are used by ScadaBridge). The legacy
/// ScadaBridge role names were renamed/collapsed as follows:
/// <list type="bullet">
/// <item><description><c>Admin</c> → <c>Administrator</c></description></item>
/// <item><description><c>Design</c> → <c>Designer</c></description></item>
/// <item><description><c>Deployment</c> → <c>Deployer</c></description></item>
/// <item><description><c>Audit</c> → <c>Administrator</c> (COLLAPSE — accepted
/// separation-of-duties loss; a former audit-only user gains the full admin
/// surface)</description></item>
/// <item><description><c>AuditReadOnly</c> → <c>Viewer</c> (COLLAPSE — keeps
/// audit-read + nav, loses bulk export, which it never had)</description></item>
/// </list>
/// <c>Engineer</c> exists in the canonical vocabulary but is unused by
/// ScadaBridge, so it is intentionally not declared here. <c>Operator</c> is
/// now declared for the two-person Secured Writes feature.
/// </para>
/// <para>
/// Secured Writes: <c>Operator</c> initiates a secured write and
/// <c>Verifier</c> approves it — two distinct global roles so a single principal
/// cannot both initiate and approve (separation of duties). Both are coarse
/// global roles, matching the existing role model; site scoping (if any) is
/// layered on at the LDAP-mapping level like the other roles.
/// </para>
/// </remarks>
public static class Roles
{
public const string Administrator = "Administrator";
public const string Designer = "Designer";
public const string Deployer = "Deployer";
public const string Viewer = "Viewer";
/// <summary>Initiates a two-person Secured Write. Canonical
/// vocabulary role; pairs with <see cref="Verifier"/> who approves.</summary>
public const string Operator = "Operator";
/// <summary>Approves a two-person Secured Write. Held by a
/// principal distinct from the initiating <see cref="Operator"/>.</summary>
public const string Verifier = "Verifier";
/// <summary>All declared ScadaBridge roles — the single source of truth for "all
/// permissions" (e.g. the dev auto-login principal). Stays in sync if a role is added.</summary>
public static readonly string[] All = [Administrator, Designer, Deployer, Viewer, Operator, Verifier];
}