Files
Sharepoint-Toolbox/.planning/phases/16-report-consolidation-toggle/16-CONTEXT.md
Dev 8f11699527 docs(16): gather phase context via discuss-phase
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:07:43 +02:00

5.0 KiB

phase, title, status, created
phase title status created
16 Report Consolidation Toggle ready-for-planning 2026-04-09

Phase 16 Context: Report Consolidation Toggle

Decided Areas (from Phase 15 CONTEXT.md — locked)

These are locked — do not re-litigate during planning or execution.

Decision Value
Consolidation scope User access audit report only — site-centric permission report is unchanged
Consolidation key UserLogin + PermissionLevel + AccessType + GrantedThrough (4-field match)
Source model UserAccessEntry (already normalized, one user per row)
Consolidation defaults OFF Toggle must default to unchecked
No API calls Pure data transformation via PermissionConsolidator.Consolidate()
Existing exports unchanged when OFF Output must be identical to pre-v2.3 when toggle is OFF

Discussed Areas

1. Toggle Placement & UX

Decision: New "Export Options" GroupBox in the left panel of both audit tabs, always visible.

  • Add a new GroupBox labeled "Export Options" below the existing "Scan Options" GroupBox
  • Contains a single CheckBox labeled "Merge duplicate permissions"
  • GroupBox is always visible (not hidden when results are empty)
  • The same GroupBox appears in both the User Access Audit tab and the site-centric Permissions tab
  • No pre-export dialog — the toggle is always accessible in the panel
  • Toggle applies to both HTML and CSV exports (user override of REQUIREMENTS.md CSV exclusion)

2. Consolidated HTML Rendering

Decision: Expandable sub-list for merged locations, with inline fallback for single-site rows.

  • When consolidation is ON, the by-user view shows consolidated rows
  • Each consolidated row has a "Sites" column:
    • 1 location: site title displayed inline (no badge/expand)
    • 2+ locations: clickable [N sites] badge that expands an inline sub-list of site URLs/titles below the row
  • Expandable sub-list uses the existing toggleGroup() JS pattern already in the HTML export
  • By-site view is disabled when consolidation is ON — only the by-user view is available (the view toggle is hidden or grayed out)
  • No "Consolidated view" indicator in the report header — report stands on its own

3. Session Persistence Scope

Decision: Session-scoped global setting, UI in both tabs.

  • Toggle state lives as a session-scoped property (ViewModel or shared service) — resets to OFF on app restart
  • The setting is global — one toggle state shared across all export types and tabs
  • UI presence: Export Options GroupBox in both User Access Audit tab and site-centric Permissions tab, reading/writing the same property
  • Site-centric tab: toggle is present but no-op — the checkbox is shown and functional (stores the value) but the site-centric export does not apply consolidation logic yet. This is intentional placeholder wiring for future phases.
  • User Access Audit exports (HTML and CSV) are the only ones that apply the consolidation when the toggle is ON

Deferred Ideas (out of scope for Phase 16)

  • Site-centric consolidation logic (toggle present in UI but no-op for site-centric exports)
  • Group expansion within consolidated rows (Phase 17)
  • Persistent consolidation preference across app restarts (decided: session-only for now)
  • "Consolidated view" report header indicator (decided: not needed)

code_context

Asset Path Reuse
PermissionConsolidator SharepointToolbox/Core/Helpers/PermissionConsolidator.cs Call Consolidate() to transform flat entries into consolidated list
ConsolidatedPermissionEntry SharepointToolbox/Core/Models/ConsolidatedPermissionEntry.cs Output model from consolidator — has Locations list and LocationCount
LocationInfo SharepointToolbox/Core/Models/LocationInfo.cs Location record within consolidated entry
UserAccessEntry SharepointToolbox/Core/Models/UserAccessEntry.cs Input model — flat permission row
UserAccessHtmlExportService SharepointToolbox/Services/Export/UserAccessHtmlExportService.cs Update to accept consolidation flag; render consolidated rows when ON
UserAccessCsvExportService SharepointToolbox/Services/Export/UserAccessCsvExportService.cs Update to apply consolidation when toggle is ON
UserAccessAuditViewModel SharepointToolbox/ViewModels/Tabs/UserAccessAuditViewModel.cs Add MergePermissions property; pass to export services
UserAccessAuditView.xaml SharepointToolbox/Views/Tabs/UserAccessAuditView.xaml Add Export Options GroupBox with checkbox
Scan Options GroupBox pattern SharepointToolbox/Views/Tabs/UserAccessAuditView.xaml (lines 199-210) Follow same GroupBox + CheckBox binding pattern
toggleGroup() JS UserAccessHtmlExportService.cs (inline JS) Reuse for expandable location sub-lists
PermissionConsolidatorTests SharepointToolbox.Tests/Helpers/PermissionConsolidatorTests.cs Reference for test patterns; add integration tests for export flow

Phase: 16-report-consolidation-toggle Context gathered: 2026-04-09 via discuss-phase