feat(11-02): add optional ReportBranding parameter to all 5 HTML export services

- Added ReportBranding? branding = null to BuildHtml on all 5 services
- Added ReportBranding? branding = null after CancellationToken ct on all WriteAsync overloads
- Injected BrandingHtmlHelper.BuildBrandingHeader(branding) between <body> and <h1> in each
- StorageHtmlExportService both overloads updated (nodes-only and nodes+fileTypeMetrics)
- HtmlExportService both overloads updated (PermissionEntry and SimplifiedPermissionEntry)
- Build passes with 0 warnings — all existing callers compile unchanged via default null
This commit is contained in:
Dev
2026-04-08 14:44:23 +02:00
parent 2e8ceea279
commit 2233fb86a9
5 changed files with 36 additions and 21 deletions

View File

@@ -15,7 +15,7 @@ public class HtmlExportService
/// Builds a self-contained HTML string from the supplied permission entries.
/// Includes inline CSS, inline JS filter, stats cards, type badges, unique/inherited badges, and user pills.
/// </summary>
public string BuildHtml(IReadOnlyList<PermissionEntry> entries)
public string BuildHtml(IReadOnlyList<PermissionEntry> entries, ReportBranding? branding = null)
{
// Compute stats
var totalEntries = entries.Count;
@@ -73,6 +73,7 @@ a:hover { text-decoration: underline; }
// ── BODY ───────────────────────────────────────────────────────────────
sb.AppendLine("<body>");
sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding));
sb.AppendLine("<h1>SharePoint Permissions Report</h1>");
// Stats cards
@@ -148,9 +149,9 @@ a:hover { text-decoration: underline; }
/// <summary>
/// Writes the HTML report to the specified file path using UTF-8 without BOM.
/// </summary>
public async Task WriteAsync(IReadOnlyList<PermissionEntry> entries, string filePath, CancellationToken ct)
public async Task WriteAsync(IReadOnlyList<PermissionEntry> entries, string filePath, CancellationToken ct, ReportBranding? branding = null)
{
var html = BuildHtml(entries);
var html = BuildHtml(entries, branding);
await File.WriteAllTextAsync(filePath, html, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), ct);
}
@@ -168,7 +169,7 @@ a:hover { text-decoration: underline; }
/// Builds a self-contained HTML string from simplified permission entries.
/// Includes risk-level summary cards, color-coded rows, and simplified labels column.
/// </summary>
public string BuildHtml(IReadOnlyList<SimplifiedPermissionEntry> entries)
public string BuildHtml(IReadOnlyList<SimplifiedPermissionEntry> entries, ReportBranding? branding = null)
{
var summaries = PermissionSummaryBuilder.Build(entries);
@@ -228,6 +229,7 @@ a:hover { text-decoration: underline; }
sb.AppendLine("</head>");
sb.AppendLine("<body>");
sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding));
sb.AppendLine("<h1>SharePoint Permissions Report (Simplified)</h1>");
// Stats cards
@@ -317,9 +319,9 @@ a:hover { text-decoration: underline; }
/// <summary>
/// Writes the simplified HTML report to the specified file path.
/// </summary>
public async Task WriteAsync(IReadOnlyList<SimplifiedPermissionEntry> entries, string filePath, CancellationToken ct)
public async Task WriteAsync(IReadOnlyList<SimplifiedPermissionEntry> entries, string filePath, CancellationToken ct, ReportBranding? branding = null)
{
var html = BuildHtml(entries);
var html = BuildHtml(entries, branding);
await File.WriteAllTextAsync(filePath, html, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), ct);
}