docs(02-07): complete Permissions integration plan — Phase 2 done

- Created 02-07-SUMMARY.md: PermissionsView XAML wired into MainWindow, all Phase 2 DI registered, human-verified
- Updated STATE.md: Phase 2 complete, 16/22 plans done, new decisions recorded
- Updated ROADMAP.md: Phase 2 all 7 plans checked, status Complete 2026-04-02

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dev
2026-04-02 14:21:18 +02:00
parent afe69bd37f
commit 6e9a0033f2
3 changed files with 170 additions and 25 deletions

View File

@@ -0,0 +1,141 @@
---
phase: 02-permissions
plan: "07"
subsystem: ui
tags: [wpf, xaml, di, permissions, datagrid, usercontent]
# Dependency graph
requires:
- phase: 02-permissions
provides: PermissionsViewModel, PermissionsService, SitePickerDialog, CsvExportService, HtmlExportService (plans 02-01 through 02-06)
- phase: 01-foundation
provides: IServiceProvider DI container, MainWindow tab structure, FeatureViewModelBase, dialog factory pattern
provides:
- PermissionsView.xaml — full Permissions tab UI with scan config panel, DataGrid, status bar
- PermissionsView.xaml.cs — code-behind wiring ViewModel and SitePickerDialog factory via IServiceProvider
- DI registrations for all Phase 2 services in App.xaml.cs
- MainWindow wired to resolve PermissionsView from DI (replacing FeatureTabBase stub)
- Human-verified: application shows functional Permissions tab, all 7 checklist items passed
affects: [03-storage, 04-templates, 05-reporting]
# Tech tracking
tech-stack:
added: []
patterns:
- "UserControl code-behind receives IServiceProvider constructor; sets DataContext via GetRequiredService<TViewModel>()"
- "Dialog factory via Func<TenantProfile, SitePickerDialog> registered in DI — avoids Window coupling in ViewModel"
- "MainWindow.xaml uses x:Name on TabItem; MainWindow.xaml.cs sets .Content from DI-resolved UserControl"
key-files:
created:
- SharepointToolbox/Views/Tabs/PermissionsView.xaml
- SharepointToolbox/Views/Tabs/PermissionsView.xaml.cs
modified:
- SharepointToolbox/App.xaml.cs
- SharepointToolbox/MainWindow.xaml
- SharepointToolbox/MainWindow.xaml.cs
- SharepointToolbox/ViewModels/Tabs/PermissionsViewModel.cs
key-decisions:
- "PermissionsView code-behind wires dialog factory: Func<TenantProfile, SitePickerDialog> resolved from DI, not new() — keeps ViewModel testable"
- "MainWindow.xaml sets x:Name on Permissions TabItem; MainWindow.xaml.cs sets Content at runtime — same pattern as SettingsView"
- "ISessionManager -> SessionManager registered in this plan (was missing from earlier plans)"
patterns-established:
- "Phase 2 DI registration block: IPermissionsService, ISiteListService, CsvExportService, HtmlExportService, PermissionsViewModel, PermissionsView, SitePickerDialog, Func<TenantProfile,SitePickerDialog>"
- "CurrentProfile public accessor + SitesSelectedLabel computed property + IsMaxDepth toggle added to PermissionsViewModel for View bindings"
requirements-completed: [PERM-01, PERM-02, PERM-03, PERM-04, PERM-05, PERM-06, PERM-07]
# Metrics
duration: ~30min (including human visual verification)
completed: 2026-04-02
---
# Phase 2 Plan 07: Permissions Integration Summary
**PermissionsView XAML wired into MainWindow replacing FeatureTabBase stub, all Phase 2 services registered in DI, and human-verified functional end-to-end in running application**
## Performance
- **Duration:** ~30 min (including human visual verification)
- **Started:** 2026-04-02T12:08:05Z
- **Completed:** 2026-04-02T14:13:45Z (Task 1 commit) + human approval
- **Tasks:** 2 (1 auto + 1 human-verify checkpoint)
- **Files modified:** 6
## Accomplishments
- Created PermissionsView.xaml with left scan-config panel (GroupBox, checkboxes, URL input, View Sites button, Generate/Cancel/Export buttons) and right results DataGrid (8 columns, virtualized, IsReadOnly)
- Wired PermissionsView.xaml.cs code-behind via IServiceProvider: DataContext set from DI, SitePickerDialog factory resolves `Func<TenantProfile, SitePickerDialog>` from container
- Registered all Phase 2 services in App.xaml.cs: IPermissionsService, ISiteListService, CsvExportService, HtmlExportService, PermissionsViewModel, PermissionsView, SitePickerDialog, and typed factory delegate; also fixed missing ISessionManager registration
- Updated MainWindow.xaml/cs: replaced FeatureTabBase stub with x:Name'd TabItem, Content resolved from DI at runtime
- Human visual verification passed all 7 checklist items: tab visible, scan options present, export buttons disabled with no results, French locale translates, Cancel button disabled when idle
## Task Commits
Each task was committed atomically:
1. **Task 1: Create PermissionsView XAML + code-behind and register DI** - `afe69bd` (feat)
2. **Task 2: Checkpoint — Visual verification** — Human approved (no code commit; human verified running app)
**Plan metadata:** _(this commit — docs)_
## Files Created/Modified
- `SharepointToolbox/Views/Tabs/PermissionsView.xaml` - Full Permissions tab UI: scan config panel, DataGrid results, StatusBar
- `SharepointToolbox/Views/Tabs/PermissionsView.xaml.cs` - Code-behind: DI wiring, ViewModel DataContext, SitePickerDialog factory
- `SharepointToolbox/App.xaml.cs` - Phase 2 DI registrations: all services, ViewModels, Views, typed factory
- `SharepointToolbox/MainWindow.xaml` - Permissions TabItem replaced FeatureTabBase stub with x:Name for runtime wiring
- `SharepointToolbox/MainWindow.xaml.cs` - Sets PermissionsTabItem.Content from DI-resolved PermissionsView
- `SharepointToolbox/ViewModels/Tabs/PermissionsViewModel.cs` - Added CurrentProfile accessor, SitesSelectedLabel, IsMaxDepth properties needed by View bindings
## Decisions Made
- Dialog factory registered as `Func<TenantProfile, SitePickerDialog>` in DI — code-behind resolves and invokes it, keeping ViewModel free of Window references and fully testable
- `ISessionManager -> SessionManager` was missing from App.xaml.cs DI (auto-detected as Rule 3 blocker during Task 1); added in this plan's commit
- Same MainWindow pattern as SettingsView: x:Name on TabItem, Content set in .xaml.cs constructor via GetRequiredService — consistent with Phase 1 established pattern
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Added missing ISessionManager DI registration**
- **Found during:** Task 1 (DI registration step)
- **Issue:** PermissionsViewModel depends on ISessionManager injected via constructor; registration was absent from App.xaml.cs, causing runtime DI resolution failure
- **Fix:** Added `services.AddSingleton<ISessionManager, SessionManager>()` inside ConfigureServices alongside Phase 2 registrations
- **Files modified:** SharepointToolbox/App.xaml.cs
- **Verification:** Build succeeded (0 errors), application started and Permissions tab resolved correctly
- **Committed in:** afe69bd (Task 1 commit)
**2. [Rule 2 - Missing Critical] Added View-required properties to PermissionsViewModel**
- **Found during:** Task 1 (XAML binding review)
- **Issue:** XAML bindings required `CurrentProfile`, `SitesSelectedLabel`, and `IsMaxDepth` properties not yet on PermissionsViewModel
- **Fix:** Added `CurrentProfile` public get accessor, `SitesSelectedLabel` computed [ObservableProperty]-backed string, and `IsMaxDepth` toggle that sets FolderDepth to 999 when true
- **Files modified:** SharepointToolbox/ViewModels/Tabs/PermissionsViewModel.cs
- **Verification:** Build 0 errors; bindings resolved at runtime (human-verified tab rendered correctly)
- **Committed in:** afe69bd (Task 1 commit)
---
**Total deviations:** 2 auto-fixed (1 blocking, 1 missing critical)
**Impact on plan:** Both fixes necessary for DI resolution and XAML binding correctness. No scope creep.
## Issues Encountered
None beyond the two auto-fixed deviations above. Build produced 0 errors, 0 warnings. Test suite: 60 passed, 3 skipped (live/interactive MSAL flows).
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Phase 2 (Permissions) is now fully integrated end-to-end: services, ViewModel, View, DI, and human-verified
- All 7 PERM requirements (PERM-01 through PERM-07) are complete
- Phase 3 (Storage) can begin — pattern established: UserControl + IServiceProvider + DI registration block
- Blocker noted in STATE.md: Duplicate detection at scale (Phase 3 research needed before planning Graph API hash enumeration approach)
---
*Phase: 02-permissions*
*Completed: 2026-04-02*