Starting an M365 scan wrote the sidebar state back into the active profile via _save_settings(), replacing its user_ids with the sidebar selection (minus Google-only users and anything hidden by the role filter). With no profile active it overwrote profiles[0]. Profiles are loaders, so scan start no longer writes them; profile_id is audit-only. The profile editor built its account list from S._allUsers only, so manually added accounts, users not yet loaded, and users gone from the directory were not rendered and got dropped on the next save. They now render as checked "Manual" / "Not loaded" rows, and user_ids "all" is kept when saved before users load. Applying a profile cleared the pending user IDs before the un-awaited Google merge had added google:<email> users, leaving them unticked. Pending IDs are now kept until all are matched or the user list is final, and _mergeGoogleUsers() re-applies them. A saved google:<email> also matches an M365 user merged to platform 'both'. Adds regression tests for scan start leaving profiles untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
// state.js — shared mutable state for GDPRScanner
|
|
// Imported by every module that needs cross-module state.
|
|
// Use S.varName everywhere instead of bare varName.
|
|
|
|
export const S = {
|
|
// Scan results
|
|
flaggedData: [],
|
|
filteredData: [],
|
|
totalCPR: 0,
|
|
isListView: false,
|
|
// SSE connection
|
|
es: null,
|
|
_userStartedScan: false,
|
|
// Scan running flags + progress
|
|
_m365ScanRunning: false,
|
|
_googleScanRunning: false,
|
|
_fileScanRunning: false,
|
|
_srcPct: { m365: 0, google: 0, file: 0 },
|
|
_progressCurrentUser: '',
|
|
// Users
|
|
_allUsers: [],
|
|
_googleUsersMerged: false, // true once _mergeGoogleUsers() has added Google users
|
|
// Auth
|
|
_currentAppMode: null,
|
|
// Profiles
|
|
_profiles: [],
|
|
_activeProfileId: null,
|
|
_pendingProfileSources: [],
|
|
_pendingGoogleSources: null,
|
|
// Sources
|
|
_fileSources: [],
|
|
// History browser
|
|
_historyRefScanId: null, // null = live/SSE, number = viewing a past session
|
|
// Bulk disposition
|
|
_selectMode: false,
|
|
_selectedIds: new Set(),
|
|
};
|