identityscope 0.28.3 → 0.28.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +914 -917
  3. package/SECURITY.md +56 -56
  4. package/dist/node/cli.js +26 -26
  5. package/dist/node/monthly.js +17 -17
  6. package/package.json +2 -2
  7. package/reports/access-profile-members.yaml +29 -29
  8. package/reports/access-profile-membership-counts.yaml +17 -17
  9. package/reports/access-profiles-without-owner.yaml +16 -16
  10. package/reports/access-request-audit-trail.yaml +36 -36
  11. package/reports/accounts-by-source.yaml +19 -19
  12. package/reports/active-identities-without-manager.yaml +22 -22
  13. package/reports/aggregation-failures.yaml +29 -29
  14. package/reports/aggregation-history.yaml +27 -27
  15. package/reports/all-sources.yaml +16 -16
  16. package/reports/application-accounts.yaml +32 -32
  17. package/reports/application-entitlements.yaml +31 -31
  18. package/reports/campaign-progress.yaml +23 -23
  19. package/reports/certification-decisions.yaml +31 -31
  20. package/reports/direct-reports-per-manager.yaml +20 -20
  21. package/reports/disabled-accounts-of-active-people.yaml +33 -33
  22. package/reports/duplicate-emails.yaml +16 -16
  23. package/reports/entitlement-holders.yaml +35 -35
  24. package/reports/entitlements-held-by-inactive-identities.yaml +31 -31
  25. package/reports/entitlements-without-owner.yaml +28 -28
  26. package/reports/identities-by-lifecycle-state.yaml +15 -15
  27. package/reports/identities-missing-key-attributes.yaml +27 -27
  28. package/reports/identities-with-processing-errors.yaml +19 -19
  29. package/reports/identity-attribute-mappings.yaml +27 -27
  30. package/reports/machine-accounts.yaml +28 -28
  31. package/reports/managers-and-direct-reports.yaml +23 -23
  32. package/reports/most-access.yaml +18 -18
  33. package/reports/new-identities.yaml +24 -24
  34. package/reports/old-passwords.yaml +35 -35
  35. package/reports/pending-reviews-by-reviewer.yaml +20 -20
  36. package/reports/person-access.yaml +31 -31
  37. package/reports/privileged-access.yaml +29 -29
  38. package/reports/provisioning-error-causes.yaml +27 -27
  39. package/reports/provisioning-errors.yaml +32 -32
  40. package/reports/provisioning-failures.yaml +28 -28
  41. package/reports/recent-access-requests.yaml +22 -22
  42. package/reports/recent-activity.yaml +32 -32
  43. package/reports/recent-leavers.yaml +34 -34
  44. package/reports/role-members.yaml +29 -29
  45. package/reports/role-membership-counts.yaml +18 -18
  46. package/reports/roles-without-owner.yaml +17 -17
  47. package/reports/sources-needing-attention.yaml +23 -23
  48. package/reports/stuck-access-requests.yaml +29 -29
  49. package/reports/team-access.yaml +30 -30
  50. package/reports/terminated-users-with-active-accounts.yaml +46 -46
  51. package/reports/uncorrelated-accounts.yaml +38 -38
  52. package/ui/js/00-setup.js +6 -6
  53. package/ui/js/01-small-helpers.js +143 -143
  54. package/ui/js/02-connection.js +150 -150
  55. package/ui/js/03-health-check.js +17 -17
  56. package/ui/js/04-library.js +135 -135
  57. package/ui/js/05-pickers.js +163 -163
  58. package/ui/js/06-report-view.js +157 -157
  59. package/ui/js/07-fields.js +85 -85
  60. package/ui/js/08-designer.js +360 -360
  61. package/ui/js/09-yaml.js +22 -22
  62. package/ui/js/10-instant-check.js +171 -171
  63. package/ui/js/11-lookup.js +161 -161
  64. package/ui/js/12-tenant.js +115 -115
  65. package/ui/js/13-source-configuration-and-diagnostics.js +64 -64
  66. package/ui/js/14-certifications.js +68 -68
  67. package/ui/js/15-monthly-report.js +24 -24
  68. package/ui/js/16-ownership.js +39 -39
  69. package/ui/js/17-compare-tenants.js +102 -102
  70. package/ui/js/18-audit.js +181 -181
  71. package/ui/js/19-insights.js +108 -108
  72. package/ui/js/20-role-mining.js +35 -35
  73. package/ui/js/21-share-reports.js +45 -45
  74. package/ui/js/22-partner-overview-all-customer-tenants.js +228 -228
  75. package/ui/js/23-in-app-guidance.js +217 -217
  76. package/ui/js/24-role-tools.js +220 -220
  77. package/ui/js/25-schedules.js +264 -264
  78. package/ui/js/26-start.js +7 -7
  79. package/ui/js/27-warnings.js +224 -224
  80. package/ui/js/28-audit-readiness.js +99 -99
  81. package/ui/js/29-lifecycle.js +182 -182
  82. package/ui/js/30-labs.js +265 -265
  83. package/ui/js/31-build.js +203 -203
  84. package/ui/js/32-lab-examples.js +148 -148
  85. package/ui/js/33-finder.js +89 -89
  86. package/ui/js/34-governance.js +129 -129
  87. package/ui/js/35-watch.js +266 -266
  88. package/ui/js/36-model.js +247 -247
  89. package/ui/js/37-logs-and-watch.js +224 -224
  90. package/ui/shell.html +112 -112
  91. package/ui/style.css +350 -350
@@ -1,161 +1,161 @@
1
- // ---------- lookup ----------
2
- state.lk = { tab: 'person', q: '', matches: null, person: null, sources: null, source: null, filter: '' };
3
- function renderLookup() {
4
- var L = state.lk;
5
- var outer = $('lookup');
6
- outer.textContent = '';
7
- var w = el('div', { className: 'wrap', style: 'max-width:1240px' });
8
- outer.appendChild(w);
9
- w.appendChild(el('div', { className: 'rhead', style: 'margin-bottom:4px' }, el('span', { className: 'cat-ico', style: 'color:#2457d6;background:#eaf0fd' }, icon('search')),
10
- el('div', {}, el('h2', { text: 'Lookup' }), el('p', { className: 'desc', text: 'Everything about one person or one source on one page. Read-only.' }))));
11
- var tabs = el('div', { className: 'tabs' });
12
- [['person', 'Person', 'people'], ['source', 'Source', 'db'], ['ownership', 'Ownership', 'layers']].forEach(function (t) {
13
- tabs.appendChild(el('button', { className: 'tab' + (L.tab === t[0] ? ' active' : ''), onclick: function () { L.tab = t[0]; renderLookup(); } }, icon(t[2]), t[1]));
14
- });
15
- w.appendChild(tabs);
16
- if (L.tab === 'person') renderPerson(w); else if (L.tab === 'ownership') renderOwnership(w); else renderSourceLookup(w);
17
- }
18
- var searchTimer;
19
- function renderPerson(w) {
20
- var L = state.lk;
21
- var input = el('input', { className: 'input', value: L.q, placeholder: 'Name, username or email (at least 2 characters)', style: 'font-size:15px;padding:11px 12px 11px 36px' });
22
- var list = el('div');
23
- input.addEventListener('input', function () {
24
- L.q = input.value;
25
- clearTimeout(searchTimer);
26
- searchTimer = setTimeout(function () {
27
- if (L.q.trim().length < 2) { L.matches = null; drawMatches(); return; }
28
- list.textContent = ''; list.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Searching...'));
29
- var asked = L.q;
30
- api('/api/people?q=' + encodeURIComponent(asked)).then(function (r) { if (asked === L.q) { L.matches = r.people; drawMatches(); } }).catch(function (e) { list.textContent = ''; list.appendChild(el('div', { className: 'error', text: errorText(e) })); });
31
- }, 300);
32
- });
33
- function drawMatches() {
34
- list.textContent = '';
35
- if (!L.matches) return;
36
- if (!L.matches.length) { list.appendChild(el('div', { className: 'muted', style: 'padding:10px', text: 'Nobody found.' })); return; }
37
- list.appendChild(el('div', { className: 'matches' }, L.matches.map(function (m) {
38
- return el('button', { className: 'match' + (L.person && L.person.id === m.id ? ' sel' : ''), onclick: function () { openPerson(m.id); } },
39
- el('b', { text: m.name }), el('span', { className: 'muted', text: [m.username, m.email, m.department, m.lifecycleState].filter(Boolean).join(' · ') }));
40
- })));
41
- }
42
- w.appendChild(el('section', { className: 'card' }, el('div', { className: 'searchbox' }, icon('search'), input), list));
43
- drawMatches();
44
- setTimeout(function () { input.focus(); input.setSelectionRange(input.value.length, input.value.length); }, 0);
45
- if (L.loading) w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Reading accounts, access and recent activity...'));
46
- else if (L.personError) w.appendChild(el('div', { className: 'error', text: L.personError }));
47
- else if (L.person) w.appendChild(personView(L.person));
48
- }
49
- function openPerson(id) {
50
- var L = state.lk;
51
- L.loading = true; L.personError = null; renderLookup();
52
- api('/api/people/' + id).then(function (p) { L.person = p; L.loading = false; L.matches = null; renderLookup(); }).catch(function (e) { L.loading = false; L.personError = errorText(e); renderLookup(); });
53
- }
54
- function section(title, count, body) {
55
- return el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', {}, title, count !== null && count !== undefined ? el('span', { className: 'pill off', text: String(count) }) : null)), body);
56
- }
57
- function simpleTable(headers, rows, label) {
58
- if (!rows.length) return el('div', { className: 'muted', text: 'None.' });
59
- // Focusable so a long table can be scrolled with the keyboard.
60
- return el('div', { className: 'table-wrap', style: 'max-height:46vh', tabindex: '0', role: 'region', 'aria-label': label || 'Table: ' + headers.filter(Boolean).join(', ') }, el('table', {},
61
- el('thead', {}, el('tr', {}, headers.map(function (h) { return el('th', { text: h, style: 'cursor:default' }); }))),
62
- el('tbody', {}, rows.map(function (r) { return el('tr', {}, r.map(function (v) {
63
- if (v && v.nodeType) return el('td', {}, v);
64
- return el('td', { className: v === null || v === undefined || v === '' ? 'empty-cell' : '', text: v === null || v === undefined || v === '' ? '—' : String(v) });
65
- })); }))));
66
- }
67
- function yesNo(v, badWhenYes) { return el('span', { className: v ? (badWhenYes ? 'chg lose' : 'yes') : 'no', text: v ? 'Yes' : 'No' }); }
68
- function personView(p) {
69
- var box = el('div');
70
- var lcBad = p.inactive || /inactive|terminat|disabled|leaver/i.test(p.lifecycleState || '');
71
- box.appendChild(el('section', { className: 'card' },
72
- el('div', { className: 'bar', style: 'align-items:flex-start' }, el('div', { className: 'avatar', text: (p.name || '?').split(/\s+/).map(function (x) { return x.charAt(0); }).slice(0, 2).join('').toUpperCase() }),
73
- el('div', { style: 'flex:1' }, el('h2', { style: 'margin:0;font-size:20px', text: p.name }),
74
- el('div', { className: 'kv', style: 'margin-top:4px' }, el('span', { text: p.username || '' }), el('span', { text: p.email || 'no email' }), el('span', { text: 'Manager: ' + (p.manager || 'none') }), el('span', { text: 'Profile: ' + (p.identityProfile || '?') }))),
75
- el('span', { className: 'pill ' + (lcBad ? 'off' : 'on'), text: p.lifecycleState || 'no lifecycle state' }), openInIsc('/ui/a/admin/identities/' + encodeURIComponent(p.id) + '/details/attributes', true)),
76
- el('div', { className: 'flags' }, p.flags.map(function (f) { return el('div', { className: 'flag ' + f.level, text: f.text }); }))));
77
- p.notes.forEach(function (n) { box.appendChild(el('div', { className: 'note', text: n })); });
78
- var byType = {}, srcs = {}, priv = 0, direct = 0;
79
- p.access.forEach(function (a) { byType[a.type] = (byType[a.type] || 0) + 1; if (a.source) srcs[a.source] = 1; if (a.privileged) priv++; if (a.type === 'ENTITLEMENT' && a.direct) direct++; });
80
- box.appendChild(el('div', { className: 'bigstats' },
81
- el('div', { className: 'bigstat' }, el('b', { text: String(p.accounts.length) }), el('span', { text: 'accounts' })),
82
- el('div', { className: 'bigstat' }, el('b', { text: String(byType.ROLE || 0) }), el('span', { text: 'roles' })),
83
- el('div', { className: 'bigstat' }, el('b', { text: String(byType.ACCESS_PROFILE || 0) }), el('span', { text: 'access profiles' })),
84
- el('div', { className: 'bigstat' }, el('b', { text: String(byType.ENTITLEMENT || 0) }), el('span', { text: 'entitlements (' + direct + ' assigned directly)' })),
85
- el('div', { className: 'bigstat' + (priv ? ' lose' : '') }, el('b', { text: String(priv) }), el('span', { text: 'privileged access items' })),
86
- el('div', { className: 'bigstat' }, el('b', { text: String(Object.keys(srcs).length) }), el('span', { text: 'sources with access' }))));
87
- box.appendChild(section('Accounts', p.accounts.length, simpleTable(['Source', 'Account', 'Disabled', 'Locked', 'Privileged', 'Password set'],
88
- p.accounts.map(function (a) { return [a.source, a.name, yesNo(a.disabled, true), yesNo(a.locked, true), yesNo(a.privileged), (a.passwordLastSet || '').slice(0, 10)]; }))));
89
- box.appendChild(section('Recent provisioning (30 days)', p.activities.length, simpleTable(['Time', 'Action', 'Sources', 'Status', 'Errors'],
90
- p.activities.map(function (a) { return [when(a.created), a.action, a.sources, a.status, a.errors.join('; ')]; }))));
91
- box.appendChild(section('Access', p.access.length, simpleTable(['Type', 'Access', 'Source', 'Privileged', 'Assigned directly'],
92
- p.access.map(function (a) { return [a.type, a.name, a.source, yesNo(a.privileged), a.type === 'ENTITLEMENT' ? (a.direct ? 'Yes' : 'Through a role or access profile') : 'Yes']; }))));
93
- box.appendChild(timelineSection(p));
94
- box.appendChild(section('Access requests', p.requests.length, simpleTable(['Submitted', 'Access', 'Type', 'State'], p.requests.map(function (r) { return [when(r.created), r.name, r.type, r.state]; }))));
95
- box.appendChild(section('Audit events about this person (30 days)', p.events.length, simpleTable(['Time', 'Event', 'Status', 'By'], p.events.map(function (e) { return [when(e.created), e.name, e.status, e.actor]; }))));
96
- box.appendChild(section('Identity attributes', p.attributes.length, simpleTable(['Attribute', 'Value'], p.attributes.map(function (a) { return [a.name, a.value]; }))));
97
- return box;
98
- }
99
- function renderSourceLookup(w) {
100
- var L = state.lk;
101
- if (L.source || L.sourceLoading || L.sourceError) {
102
- w.appendChild(el('button', { className: 'btn ghost', style: 'margin-bottom:10px', onclick: function () { L.source = null; L.sourceError = null; renderLookup(); } }, '← All sources'));
103
- if (L.sourceLoading) w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Reading counts, aggregations and errors for this source...'));
104
- else if (L.sourceError) w.appendChild(el('div', { className: 'error', text: L.sourceError }));
105
- else w.appendChild(sourceView(L.source));
106
- return;
107
- }
108
- if (!L.sources) {
109
- w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Reading sources and their recent aggregations...'));
110
- api('/api/sources').then(function (r) { L.sources = r; renderLookup(); }).catch(function (e) { L.sources = { sources: [], notes: [errorText(e)] }; renderLookup(); });
111
- return;
112
- }
113
- var f = el('input', { className: 'input', placeholder: 'Filter sources...', value: L.filter, style: 'max-width:320px' });
114
- var tableBox = el('div');
115
- function draw() {
116
- var q = L.filter.toLowerCase();
117
- var list = L.sources.sources.filter(function (s) { return !q || (s.name + ' ' + (s.type || '') + ' ' + (s.owner || '')).toLowerCase().indexOf(q) >= 0; });
118
- tableBox.textContent = '';
119
- tableBox.appendChild(simpleTable(['Source', 'Connection', 'Last aggregation', 'Last success', 'Owner', 'Type'], list.map(function (s) {
120
- var agg = s.lastAggregation ? el('span', {}, el('span', { className: 'chg ' + (s.lastAggregation.status === 'PASSED' ? 'gain' : 'lose'), text: s.lastAggregation.status === 'PASSED' ? 'Passed' : 'Failed' }), ' ' + ago(s.lastAggregation.created)) : el('span', { className: 'muted', text: 'none in 7 days' });
121
- return [el('button', { className: 'btn link', style: 'padding:0', text: s.name, onclick: function () { openSource(s.id); } }), el('span', { className: 'chg ' + (s.healthy ? 'gain' : 'lose'), text: s.healthy ? 'OK' : (s.status || '').replace('SOURCE_STATE_', '').replace(/_/g, ' ').toLowerCase() }), agg, s.lastSuccess ? ago(s.lastSuccess) : null, s.owner || null, s.type || null];
122
- })));
123
- }
124
- f.addEventListener('input', function () { L.filter = f.value; draw(); });
125
- var bad = L.sources.sources.filter(function (s) { return !s.healthy; }).length;
126
- w.appendChild(el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Sources' }), el('span', { className: 'muted small', text: L.sources.sources.length + ' sources, ' + bad + ' with a connection problem' }), f), tableBox));
127
- L.sources.notes.forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
128
- draw();
129
- }
130
- function openSource(id) {
131
- var L = state.lk;
132
- L.sourceLoading = true; L.sourceError = null; renderLookup();
133
- api('/api/sources/' + id).then(function (d) { L.source = d; L.sourceLoading = false; renderLookup(); }).catch(function (e) { L.sourceLoading = false; L.sourceError = errorText(e); renderLookup(); });
134
- }
135
- function sourceView(d) {
136
- var s = d.source, box = el('div');
137
- box.appendChild(el('section', { className: 'card' },
138
- el('div', { className: 'bar' }, el('h2', { style: 'margin:0;font-size:20px;flex:1', text: s.name }), el('span', { className: 'pill ' + (s.healthy ? 'on' : 'off'), text: s.healthy ? 'Connection OK' : (s.status || '').replace('SOURCE_STATE_', '').replace(/_/g, ' ').toLowerCase() }), openInIsc('/ui/a/admin/connections/sources/' + encodeURIComponent(s.id) + '/menu/base_configuration')),
139
- el('div', { className: 'kv', style: 'margin-top:6px' }, el('span', { text: s.type || '' }), el('span', { text: 'Owner: ' + (s.owner || 'none') }), el('span', { text: s.authoritative ? 'Authoritative' : 'Not authoritative' }), s.description ? el('span', { text: s.description }) : null)));
140
- var cnt = d.counts;
141
- var stat = function (v, label, cls) { return el('div', { className: 'bigstat' + (cls ? ' ' + cls : '') }, el('b', { text: v === null ? '—' : fmtNum(v) }), el('span', { text: label })); };
142
- box.appendChild(el('div', { className: 'bigstats' }, stat(cnt.accounts, 'accounts'), stat(cnt.uncorrelated, 'not linked to a person', cnt.uncorrelated ? 'lose' : ''), stat(cnt.entitlements, 'entitlements'), stat(cnt.entitlementsWithoutOwner, 'entitlements without owner', cnt.entitlementsWithoutOwner ? 'lose' : ''),
143
- el('div', { className: 'bigstat' }, el('b', { text: s.lastSuccess ? ago(s.lastSuccess) : 'none' }), el('span', { text: 'last successful aggregation (30 days)' }))));
144
- var open = function (id, params) { return el('button', { className: 'btn sm', onclick: function () {
145
- var rep = state.reports.filter(function (x) { return x.definition.id === id; })[0];
146
- showPage('reports'); select(rep); Object.keys(params).forEach(function (k) { state.paramValues[k] = params[k]; }); renderMain();
147
- } }, icon('file'), 'Open report'); };
148
- box.appendChild(el('div', { className: 'bar', style: 'margin-bottom:16px' }, el('span', { className: 'muted', text: 'Reports for this source:' }),
149
- el('span', {}, 'Unlinked accounts ', open('uncorrelated-accounts', { sources: [s.id] })), el('span', {}, 'Everyone with an account ', open('application-accounts', { sources: [s.id] })), el('span', {}, 'Entitlements without owner ', open('entitlements-without-owner', { sources: [s.id] }))));
150
- d.notes.forEach(function (n) { box.appendChild(el('div', { className: 'note', text: n })); });
151
- if (d.usedBy) box.appendChild(section('Used by', null, el('div', {},
152
- d.usedBy.identityProfiles.length ? simpleTable(['Identity profile', 'How it uses this source'], d.usedBy.identityProfiles.map(function (x) { return [x.name, x.how]; })) : el('div', { className: 'muted', text: 'No identity profile reads this source.' }),
153
- el('div', { className: 'kv', style: 'margin-top:10px' }, el('span', {}, el('b', { text: d.usedBy.accessProfiles === null ? '\u2014' : fmtNum(d.usedBy.accessProfiles) }), ' access profiles on this source'), el('span', {}, el('b', { text: fmtNum(d.usedBy.mappedAttributes) }), ' identity attribute mappings read it')))));
154
- box.appendChild(diagnosticsCard(s));
155
- box.appendChild(sourceConfigCard(s.id));
156
- box.appendChild(section('Provisioning errors by cause (7 days)', d.causes.length, simpleTable(['Cause', 'Errors'], d.causes.map(function (c) { return [c.cause, c.count]; }))));
157
- box.appendChild(section('Aggregations (30 days)', d.aggregations.length, simpleTable(['Time', 'Event', 'Status', 'Errors'], d.aggregations.map(function (a) { return [when(a.created), a.name, el('span', { className: 'chg ' + (a.status === 'PASSED' ? 'gain' : 'lose'), text: a.status || '?' }), a.errors]; }))));
158
- box.appendChild(section('Latest provisioning errors (7 days)', d.errors.length, simpleTable(['Time', 'Action', 'For', 'Error'], d.errors.map(function (e) { return [when(e.created), e.action, e.person, e.error]; }))));
159
- return box;
160
- }
161
-
1
+ // ---------- lookup ----------
2
+ state.lk = { tab: 'person', q: '', matches: null, person: null, sources: null, source: null, filter: '' };
3
+ function renderLookup() {
4
+ var L = state.lk;
5
+ var outer = $('lookup');
6
+ outer.textContent = '';
7
+ var w = el('div', { className: 'wrap', style: 'max-width:1240px' });
8
+ outer.appendChild(w);
9
+ w.appendChild(el('div', { className: 'rhead', style: 'margin-bottom:4px' }, el('span', { className: 'cat-ico', style: 'color:#2457d6;background:#eaf0fd' }, icon('search')),
10
+ el('div', {}, el('h2', { text: 'Lookup' }), el('p', { className: 'desc', text: 'Everything about one person or one source on one page. Read-only.' }))));
11
+ var tabs = el('div', { className: 'tabs' });
12
+ [['person', 'Person', 'people'], ['source', 'Source', 'db'], ['ownership', 'Ownership', 'layers']].forEach(function (t) {
13
+ tabs.appendChild(el('button', { className: 'tab' + (L.tab === t[0] ? ' active' : ''), onclick: function () { L.tab = t[0]; renderLookup(); } }, icon(t[2]), t[1]));
14
+ });
15
+ w.appendChild(tabs);
16
+ if (L.tab === 'person') renderPerson(w); else if (L.tab === 'ownership') renderOwnership(w); else renderSourceLookup(w);
17
+ }
18
+ var searchTimer;
19
+ function renderPerson(w) {
20
+ var L = state.lk;
21
+ var input = el('input', { className: 'input', value: L.q, placeholder: 'Name, username or email (at least 2 characters)', style: 'font-size:15px;padding:11px 12px 11px 36px' });
22
+ var list = el('div');
23
+ input.addEventListener('input', function () {
24
+ L.q = input.value;
25
+ clearTimeout(searchTimer);
26
+ searchTimer = setTimeout(function () {
27
+ if (L.q.trim().length < 2) { L.matches = null; drawMatches(); return; }
28
+ list.textContent = ''; list.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Searching...'));
29
+ var asked = L.q;
30
+ api('/api/people?q=' + encodeURIComponent(asked)).then(function (r) { if (asked === L.q) { L.matches = r.people; drawMatches(); } }).catch(function (e) { list.textContent = ''; list.appendChild(el('div', { className: 'error', text: errorText(e) })); });
31
+ }, 300);
32
+ });
33
+ function drawMatches() {
34
+ list.textContent = '';
35
+ if (!L.matches) return;
36
+ if (!L.matches.length) { list.appendChild(el('div', { className: 'muted', style: 'padding:10px', text: 'Nobody found.' })); return; }
37
+ list.appendChild(el('div', { className: 'matches' }, L.matches.map(function (m) {
38
+ return el('button', { className: 'match' + (L.person && L.person.id === m.id ? ' sel' : ''), onclick: function () { openPerson(m.id); } },
39
+ el('b', { text: m.name }), el('span', { className: 'muted', text: [m.username, m.email, m.department, m.lifecycleState].filter(Boolean).join(' · ') }));
40
+ })));
41
+ }
42
+ w.appendChild(el('section', { className: 'card' }, el('div', { className: 'searchbox' }, icon('search'), input), list));
43
+ drawMatches();
44
+ setTimeout(function () { input.focus(); input.setSelectionRange(input.value.length, input.value.length); }, 0);
45
+ if (L.loading) w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Reading accounts, access and recent activity...'));
46
+ else if (L.personError) w.appendChild(el('div', { className: 'error', text: L.personError }));
47
+ else if (L.person) w.appendChild(personView(L.person));
48
+ }
49
+ function openPerson(id) {
50
+ var L = state.lk;
51
+ L.loading = true; L.personError = null; renderLookup();
52
+ api('/api/people/' + id).then(function (p) { L.person = p; L.loading = false; L.matches = null; renderLookup(); }).catch(function (e) { L.loading = false; L.personError = errorText(e); renderLookup(); });
53
+ }
54
+ function section(title, count, body) {
55
+ return el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', {}, title, count !== null && count !== undefined ? el('span', { className: 'pill off', text: String(count) }) : null)), body);
56
+ }
57
+ function simpleTable(headers, rows, label) {
58
+ if (!rows.length) return el('div', { className: 'muted', text: 'None.' });
59
+ // Focusable so a long table can be scrolled with the keyboard.
60
+ return el('div', { className: 'table-wrap', style: 'max-height:46vh', tabindex: '0', role: 'region', 'aria-label': label || 'Table: ' + headers.filter(Boolean).join(', ') }, el('table', {},
61
+ el('thead', {}, el('tr', {}, headers.map(function (h) { return el('th', { text: h, style: 'cursor:default' }); }))),
62
+ el('tbody', {}, rows.map(function (r) { return el('tr', {}, r.map(function (v) {
63
+ if (v && v.nodeType) return el('td', {}, v);
64
+ return el('td', { className: v === null || v === undefined || v === '' ? 'empty-cell' : '', text: v === null || v === undefined || v === '' ? '—' : String(v) });
65
+ })); }))));
66
+ }
67
+ function yesNo(v, badWhenYes) { return el('span', { className: v ? (badWhenYes ? 'chg lose' : 'yes') : 'no', text: v ? 'Yes' : 'No' }); }
68
+ function personView(p) {
69
+ var box = el('div');
70
+ var lcBad = p.inactive || /inactive|terminat|disabled|leaver/i.test(p.lifecycleState || '');
71
+ box.appendChild(el('section', { className: 'card' },
72
+ el('div', { className: 'bar', style: 'align-items:flex-start' }, el('div', { className: 'avatar', text: (p.name || '?').split(/\s+/).map(function (x) { return x.charAt(0); }).slice(0, 2).join('').toUpperCase() }),
73
+ el('div', { style: 'flex:1' }, el('h2', { style: 'margin:0;font-size:20px', text: p.name }),
74
+ el('div', { className: 'kv', style: 'margin-top:4px' }, el('span', { text: p.username || '' }), el('span', { text: p.email || 'no email' }), el('span', { text: 'Manager: ' + (p.manager || 'none') }), el('span', { text: 'Profile: ' + (p.identityProfile || '?') }))),
75
+ el('span', { className: 'pill ' + (lcBad ? 'off' : 'on'), text: p.lifecycleState || 'no lifecycle state' }), openInIsc('/ui/a/admin/identities/' + encodeURIComponent(p.id) + '/details/attributes', true)),
76
+ el('div', { className: 'flags' }, p.flags.map(function (f) { return el('div', { className: 'flag ' + f.level, text: f.text }); }))));
77
+ p.notes.forEach(function (n) { box.appendChild(el('div', { className: 'note', text: n })); });
78
+ var byType = {}, srcs = {}, priv = 0, direct = 0;
79
+ p.access.forEach(function (a) { byType[a.type] = (byType[a.type] || 0) + 1; if (a.source) srcs[a.source] = 1; if (a.privileged) priv++; if (a.type === 'ENTITLEMENT' && a.direct) direct++; });
80
+ box.appendChild(el('div', { className: 'bigstats' },
81
+ el('div', { className: 'bigstat' }, el('b', { text: String(p.accounts.length) }), el('span', { text: 'accounts' })),
82
+ el('div', { className: 'bigstat' }, el('b', { text: String(byType.ROLE || 0) }), el('span', { text: 'roles' })),
83
+ el('div', { className: 'bigstat' }, el('b', { text: String(byType.ACCESS_PROFILE || 0) }), el('span', { text: 'access profiles' })),
84
+ el('div', { className: 'bigstat' }, el('b', { text: String(byType.ENTITLEMENT || 0) }), el('span', { text: 'entitlements (' + direct + ' assigned directly)' })),
85
+ el('div', { className: 'bigstat' + (priv ? ' lose' : '') }, el('b', { text: String(priv) }), el('span', { text: 'privileged access items' })),
86
+ el('div', { className: 'bigstat' }, el('b', { text: String(Object.keys(srcs).length) }), el('span', { text: 'sources with access' }))));
87
+ box.appendChild(section('Accounts', p.accounts.length, simpleTable(['Source', 'Account', 'Disabled', 'Locked', 'Privileged', 'Password set'],
88
+ p.accounts.map(function (a) { return [a.source, a.name, yesNo(a.disabled, true), yesNo(a.locked, true), yesNo(a.privileged), (a.passwordLastSet || '').slice(0, 10)]; }))));
89
+ box.appendChild(section('Recent provisioning (30 days)', p.activities.length, simpleTable(['Time', 'Action', 'Sources', 'Status', 'Errors'],
90
+ p.activities.map(function (a) { return [when(a.created), a.action, a.sources, a.status, a.errors.join('; ')]; }))));
91
+ box.appendChild(section('Access', p.access.length, simpleTable(['Type', 'Access', 'Source', 'Privileged', 'Assigned directly'],
92
+ p.access.map(function (a) { return [a.type, a.name, a.source, yesNo(a.privileged), a.type === 'ENTITLEMENT' ? (a.direct ? 'Yes' : 'Through a role or access profile') : 'Yes']; }))));
93
+ box.appendChild(timelineSection(p));
94
+ box.appendChild(section('Access requests', p.requests.length, simpleTable(['Submitted', 'Access', 'Type', 'State'], p.requests.map(function (r) { return [when(r.created), r.name, r.type, r.state]; }))));
95
+ box.appendChild(section('Audit events about this person (30 days)', p.events.length, simpleTable(['Time', 'Event', 'Status', 'By'], p.events.map(function (e) { return [when(e.created), e.name, e.status, e.actor]; }))));
96
+ box.appendChild(section('Identity attributes', p.attributes.length, simpleTable(['Attribute', 'Value'], p.attributes.map(function (a) { return [a.name, a.value]; }))));
97
+ return box;
98
+ }
99
+ function renderSourceLookup(w) {
100
+ var L = state.lk;
101
+ if (L.source || L.sourceLoading || L.sourceError) {
102
+ w.appendChild(el('button', { className: 'btn ghost', style: 'margin-bottom:10px', onclick: function () { L.source = null; L.sourceError = null; renderLookup(); } }, '← All sources'));
103
+ if (L.sourceLoading) w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Reading counts, aggregations and errors for this source...'));
104
+ else if (L.sourceError) w.appendChild(el('div', { className: 'error', text: L.sourceError }));
105
+ else w.appendChild(sourceView(L.source));
106
+ return;
107
+ }
108
+ if (!L.sources) {
109
+ w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Reading sources and their recent aggregations...'));
110
+ api('/api/sources').then(function (r) { L.sources = r; renderLookup(); }).catch(function (e) { L.sources = { sources: [], notes: [errorText(e)] }; renderLookup(); });
111
+ return;
112
+ }
113
+ var f = el('input', { className: 'input', placeholder: 'Filter sources...', value: L.filter, style: 'max-width:320px' });
114
+ var tableBox = el('div');
115
+ function draw() {
116
+ var q = L.filter.toLowerCase();
117
+ var list = L.sources.sources.filter(function (s) { return !q || (s.name + ' ' + (s.type || '') + ' ' + (s.owner || '')).toLowerCase().indexOf(q) >= 0; });
118
+ tableBox.textContent = '';
119
+ tableBox.appendChild(simpleTable(['Source', 'Connection', 'Last aggregation', 'Last success', 'Owner', 'Type'], list.map(function (s) {
120
+ var agg = s.lastAggregation ? el('span', {}, el('span', { className: 'chg ' + (s.lastAggregation.status === 'PASSED' ? 'gain' : 'lose'), text: s.lastAggregation.status === 'PASSED' ? 'Passed' : 'Failed' }), ' ' + ago(s.lastAggregation.created)) : el('span', { className: 'muted', text: 'none in 7 days' });
121
+ return [el('button', { className: 'btn link', style: 'padding:0', text: s.name, onclick: function () { openSource(s.id); } }), el('span', { className: 'chg ' + (s.healthy ? 'gain' : 'lose'), text: s.healthy ? 'OK' : (s.status || '').replace('SOURCE_STATE_', '').replace(/_/g, ' ').toLowerCase() }), agg, s.lastSuccess ? ago(s.lastSuccess) : null, s.owner || null, s.type || null];
122
+ })));
123
+ }
124
+ f.addEventListener('input', function () { L.filter = f.value; draw(); });
125
+ var bad = L.sources.sources.filter(function (s) { return !s.healthy; }).length;
126
+ w.appendChild(el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Sources' }), el('span', { className: 'muted small', text: L.sources.sources.length + ' sources, ' + bad + ' with a connection problem' }), f), tableBox));
127
+ L.sources.notes.forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
128
+ draw();
129
+ }
130
+ function openSource(id) {
131
+ var L = state.lk;
132
+ L.sourceLoading = true; L.sourceError = null; renderLookup();
133
+ api('/api/sources/' + id).then(function (d) { L.source = d; L.sourceLoading = false; renderLookup(); }).catch(function (e) { L.sourceLoading = false; L.sourceError = errorText(e); renderLookup(); });
134
+ }
135
+ function sourceView(d) {
136
+ var s = d.source, box = el('div');
137
+ box.appendChild(el('section', { className: 'card' },
138
+ el('div', { className: 'bar' }, el('h2', { style: 'margin:0;font-size:20px;flex:1', text: s.name }), el('span', { className: 'pill ' + (s.healthy ? 'on' : 'off'), text: s.healthy ? 'Connection OK' : (s.status || '').replace('SOURCE_STATE_', '').replace(/_/g, ' ').toLowerCase() }), openInIsc('/ui/a/admin/connections/sources/' + encodeURIComponent(s.id) + '/menu/base_configuration')),
139
+ el('div', { className: 'kv', style: 'margin-top:6px' }, el('span', { text: s.type || '' }), el('span', { text: 'Owner: ' + (s.owner || 'none') }), el('span', { text: s.authoritative ? 'Authoritative' : 'Not authoritative' }), s.description ? el('span', { text: s.description }) : null)));
140
+ var cnt = d.counts;
141
+ var stat = function (v, label, cls) { return el('div', { className: 'bigstat' + (cls ? ' ' + cls : '') }, el('b', { text: v === null ? '—' : fmtNum(v) }), el('span', { text: label })); };
142
+ box.appendChild(el('div', { className: 'bigstats' }, stat(cnt.accounts, 'accounts'), stat(cnt.uncorrelated, 'not linked to a person', cnt.uncorrelated ? 'lose' : ''), stat(cnt.entitlements, 'entitlements'), stat(cnt.entitlementsWithoutOwner, 'entitlements without owner', cnt.entitlementsWithoutOwner ? 'lose' : ''),
143
+ el('div', { className: 'bigstat' }, el('b', { text: s.lastSuccess ? ago(s.lastSuccess) : 'none' }), el('span', { text: 'last successful aggregation (30 days)' }))));
144
+ var open = function (id, params) { return el('button', { className: 'btn sm', onclick: function () {
145
+ var rep = state.reports.filter(function (x) { return x.definition.id === id; })[0];
146
+ showPage('reports'); select(rep); Object.keys(params).forEach(function (k) { state.paramValues[k] = params[k]; }); renderMain();
147
+ } }, icon('file'), 'Open report'); };
148
+ box.appendChild(el('div', { className: 'bar', style: 'margin-bottom:16px' }, el('span', { className: 'muted', text: 'Reports for this source:' }),
149
+ el('span', {}, 'Unlinked accounts ', open('uncorrelated-accounts', { sources: [s.id] })), el('span', {}, 'Everyone with an account ', open('application-accounts', { sources: [s.id] })), el('span', {}, 'Entitlements without owner ', open('entitlements-without-owner', { sources: [s.id] }))));
150
+ d.notes.forEach(function (n) { box.appendChild(el('div', { className: 'note', text: n })); });
151
+ if (d.usedBy) box.appendChild(section('Used by', null, el('div', {},
152
+ d.usedBy.identityProfiles.length ? simpleTable(['Identity profile', 'How it uses this source'], d.usedBy.identityProfiles.map(function (x) { return [x.name, x.how]; })) : el('div', { className: 'muted', text: 'No identity profile reads this source.' }),
153
+ el('div', { className: 'kv', style: 'margin-top:10px' }, el('span', {}, el('b', { text: d.usedBy.accessProfiles === null ? '\u2014' : fmtNum(d.usedBy.accessProfiles) }), ' access profiles on this source'), el('span', {}, el('b', { text: fmtNum(d.usedBy.mappedAttributes) }), ' identity attribute mappings read it')))));
154
+ box.appendChild(diagnosticsCard(s));
155
+ box.appendChild(sourceConfigCard(s.id));
156
+ box.appendChild(section('Provisioning errors by cause (7 days)', d.causes.length, simpleTable(['Cause', 'Errors'], d.causes.map(function (c) { return [c.cause, c.count]; }))));
157
+ box.appendChild(section('Aggregations (30 days)', d.aggregations.length, simpleTable(['Time', 'Event', 'Status', 'Errors'], d.aggregations.map(function (a) { return [when(a.created), a.name, el('span', { className: 'chg ' + (a.status === 'PASSED' ? 'gain' : 'lose'), text: a.status || '?' }), a.errors]; }))));
158
+ box.appendChild(section('Latest provisioning errors (7 days)', d.errors.length, simpleTable(['Time', 'Action', 'For', 'Error'], d.errors.map(function (e) { return [when(e.created), e.action, e.person, e.error]; }))));
159
+ return box;
160
+ }
161
+