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,129 +1,129 @@
1
- // ---------- 0.22.0: access request audit trail, approver chain, accounts expiring, revokes not done, person timeline ----------
2
- function gvState() {
3
- if (!state.gv) state.gv = { trail: { days: 30, item: '', person: '' }, chain: {}, expiry: { days: 30, attribute: 'accountExpires', sourceIds: [] }, revokes: { days: 90 } };
4
- return state.gv;
5
- }
6
- function gvRunBar(w, H, path, label, desc, extras, body, rerender) {
7
- w.appendChild(el('div', { className: 'bar', style: 'margin-bottom:14px' }, el('span', { className: 'muted', style: 'flex:1;min-width:260px', text: desc }), extras || null,
8
- el('button', { className: 'btn primary', disabled: !!H.busy, onclick: function () { runJobInto(H, '/api/warnings/' + path + '/run', body ? body() : {}, rerender); } }, icon('play'), H.data ? 'Read again' : label)));
9
- if (H.busy) { w.appendChild(busyBox(H.busy)); return false; }
10
- if (H.error) { w.appendChild(el('div', { className: 'error', text: H.error })); return false; }
11
- if (!H.data) return false;
12
- (H.data.notes || []).forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
13
- return true;
14
- }
15
- function gvText(H, key, label, placeholder) {
16
- var i = el('input', { className: 'input', value: H[key] || '', placeholder: placeholder, style: 'max-width:200px', 'aria-label': label });
17
- i.addEventListener('input', function () { H[key] = i.value; });
18
- return el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: label }), i);
19
- }
20
- function gvTime(s) { return s ? String(s).slice(0, 16).replace('T', ' ') : ''; }
21
- var GV_DECISION = { APPROVED: 'win', REJECTED: 'lose', PENDING: 'off', EXPIRED: 'lose', CANCELLED: 'off' };
22
- var GV_OUTCOME = { completed: ['completed', 'win'], rejected: ['rejected', 'lose'], cancelled: ['cancelled', 'off'], failed: ['failed', 'lose'], open: ['in progress', 'off'] };
23
-
24
- // Audit > Request trail
25
- function renderRequestTrail(w) {
26
- var H = gvState().trail;
27
- var extras = el('div', { className: 'bar' },
28
- el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Submitted in the last' }), numSelect(H, 'days', [[7, '7 days'], [30, '30 days'], [90, '90 days'], [180, '180 days'], [365, '365 days']], 'Period')),
29
- gvText(H, 'item', 'Access item contains', 'e.g. VPN'), gvText(H, 'person', 'Person contains', 'requester or recipient'));
30
- if (!gvRunBar(w, H, 'request-trail', 'Build the trail', 'Every access request with each approval step: who decided, the decision, their comment and when, and how provisioning ended. One row per step in the download, ready for auditors.', extras,
31
- function () { return { days: H.days, item: H.item || undefined, person: H.person || undefined }; }, renderAudit)) return;
32
- var d = H.data, T = d.totals;
33
- w.appendChild(el('div', { className: 'bigstats' }, stat(T.requests, 'requests'), stat(T.completed, 'completed'), stat(T.rejected, 'rejected', 'lose'), stat(T.failed, 'failed', 'lose'), stat(T.open, 'in progress'), stat(T.withoutApproval, 'without an approval step'),
34
- stat(T.decisions ? Math.round(T.decisionsWithComment * 100 / T.decisions) : 0, '% of decisions with a comment')));
35
- if (!d.requests.length) return;
36
- if ((d.approvers || []).length) w.appendChild(section('How fast approvers decide', d.approvers.length, simpleTable(['Approver', 'Decisions', 'Usual time', 'Slowest', 'Waiting now', 'Oldest waiting'], d.approvers.slice(0, 200).map(function (a) {
37
- return [a.approver, fmtNum(a.decided), hrs(a.medianHours), hrs(a.slowestHours), a.waiting ? pill(String(a.waiting), 'lose') : '0', a.oldestWaitingDays === null ? '—' : a.oldestWaitingDays + ' days'];
38
- }), 'How fast approvers decide')));
39
- var rows = d.requests.map(function (r) {
40
- var o = GV_OUTCOME[r.outcome] || [r.outcome, 'off'];
41
- var steps = r.steps.length ? el('div', {}, r.steps.map(function (s) {
42
- return el('div', { style: 'margin:2px 0' }, el('b', { text: s.step + '. ' }), s.approver || '?', s.originalApprover ? el('span', { className: 'muted', text: ' (was ' + s.originalApprover + ')' }) : null, ' ',
43
- pill(s.decision.toLowerCase(), GV_DECISION[s.decision] || 'off'), s.decided ? el('span', { className: 'muted small', text: ' ' + gvTime(s.decided) }) : null,
44
- s.comment ? el('div', { className: 'small', style: 'margin-left:16px;font-style:italic', text: '“' + s.comment + '”' }) : null);
45
- })) : el('span', { className: 'muted', text: 'No approval step' });
46
- return { r: r, cells: [gvTime(r.submitted), r.requestedFor, r.requestedBy, el('span', {}, r.access, r.accessType ? el('span', { className: 'muted small', text: ' ' + r.accessType.toLowerCase().replace('_', ' ') }) : null, r.requestType === 'REVOKE_ACCESS' ? el('span', {}, ' ', pill('revoke', 'lose')) : null),
47
- r.requesterComment ? el('span', { className: 'small', style: 'font-style:italic', text: '“' + r.requesterComment + '”' }) : '', steps, el('span', {}, pill(o[0], o[1]), r.errors.length ? el('div', { className: 'small', style: 'color:var(--bad)', text: r.errors.join('; ') }) : null)] };
48
- });
49
- w.appendChild(section('Requests', d.requests.length + (d.more || 0), filteredTable(H, rows, ['Submitted', 'Requested for', 'Requested by', 'Access', 'Requester comment', 'Approvals', 'Outcome'], function (x) { return x.cells; }, 'Access request audit trail')));
50
- }
51
-
52
- // Audit > Approver chain
53
- function renderApproverChain(w) {
54
- var H = gvState().chain;
55
- if (!gvRunBar(w, H, 'approver-chain', 'Read approval settings', 'Who approves a request, in what order, and who approves a revoke, for every access profile, role and requestable entitlement. Flags requestable access that needs no approval or whose approver cannot be reached.', null, null, renderAudit)) return;
56
- var d = H.data, T = d.totals;
57
- w.appendChild(el('div', { className: 'bigstats' }, stat(T.accessProfiles, 'access profiles'), stat(T.roles, 'roles'), stat(T.entitlements, 'requestable entitlements'), stat(T.noApproval, 'requestable without approval', 'lose'), stat(T.flagged, 'with a problem', 'lose')));
58
- var list = function (xs) { return xs.length ? el('div', {}, xs.map(function (x) { return el('div', { text: x }); })) : el('span', { className: 'muted', text: 'none' }); };
59
- var H2 = H.view || (H.view = { only: 'requestable' });
60
- var only = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Show' }, [['requestable', 'Requestable only'], ['problems', 'Only with problems'], ['all', 'Everything']].map(function (o) { return el('option', { value: o[0], text: o[1] }); }));
61
- only.value = H2.only;
62
- only.addEventListener('change', function () { H2.only = only.value; renderAudit(); });
63
- var rows = d.rows.filter(function (r) { return H2.only === 'all' || (H2.only === 'problems' ? r.flags.length : r.requestable); });
64
- w.appendChild(section('Approval settings', rows.length, filteredTable(H, rows, ['Type', 'Name', 'Source', 'Owner', 'Request approvals', 'Revoke approvals', 'Comment required', 'Problems'], function (r) {
65
- return [r.type, r.name, r.source, r.owner, list(r.request), list(r.revoke), r.commentsRequired ? 'Yes' : 'No', r.flags.length ? el('div', {}, r.flags.map(function (f) { return el('div', { className: 'small', style: 'color:var(--bad)', text: f }); })) : ''];
66
- }, 'Approver chain', only)));
67
- }
68
-
69
- // Warnings > Accounts expiring
70
- function wnExpiry(w, _H, desc) {
71
- var H = gvState().expiry;
72
- if (!H.sources) {
73
- H.sources = 'loading';
74
- api('/api/sources').then(function (r) { H.sources = (r.sources || []).slice().sort(function (a, b) { return String(a.name).localeCompare(String(b.name)); }); }, function () { H.sources = []; }).then(function () { if (state.page === 'warnings') renderWarnings(); });
75
- }
76
- var pick = el('select', { className: 'input', multiple: true, size: 4, style: 'min-width:220px', 'aria-label': 'Sources to check' }, (Array.isArray(H.sources) ? H.sources : []).map(function (s) {
77
- return el('option', { value: s.id, text: s.name, selected: H.sourceIds.indexOf(s.id) >= 0 });
78
- }));
79
- if (!H.sourceIds.length && Array.isArray(H.sources)) {
80
- var ad = H.sources.filter(function (s) { return /active directory|\bad\b/i.test(s.name + ' ' + (s.type || '')); })[0];
81
- if (ad) { H.sourceIds = [ad.id]; Array.prototype.forEach.call(pick.options, function (o) { o.selected = o.value === ad.id; }); }
82
- }
83
- pick.addEventListener('change', function () { H.sourceIds = Array.prototype.filter.call(pick.options, function (o) { return o.selected; }).map(function (o) { return o.value; }); });
84
- var extras = el('div', { className: 'bar' },
85
- el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Sources (Ctrl+click for more)' }), pick),
86
- attrInput(H, 'attribute', 'Expiry attribute', 'accountExpires'),
87
- el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Expiring within' }), numSelect(H, 'days', [[7, '7 days'], [14, '14 days'], [30, '30 days'], [60, '60 days'], [90, '90 days']], 'Expiring within')));
88
- if (!gvRunBar(w, H, 'account-expiry', 'Find expiring accounts', desc, extras, function () { return { days: H.days, attribute: H.attribute || 'accountExpires', sourceIds: H.sourceIds }; }, renderWarnings)) return;
89
- var d = H.data, T = d.totals;
90
- w.appendChild(el('div', { className: 'bigstats' }, stat(T.accounts, 'accounts read'), stat(T.withDate, 'with an expiry date'), stat(T.never, 'set to never expire'), stat(T.missing, 'without a value'), stat(T.expiring, 'expire in the next ' + d.days + ' days', 'lose'), stat(T.expiredEnabled, 'expired but still enabled', 'lose'), stat(T.unreadable, 'values not readable as a date')));
91
- if (!d.rows.length) { w.appendChild(el('p', { className: 'muted', text: 'No account expires in this period.' })); return; }
92
- w.appendChild(section('Accounts', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Account', 'Person', 'Source', 'Expires', 'When', 'Account'], function (r) {
93
- return [r.account, r.person || el('span', { className: 'muted', text: 'not linked to a person' }), r.source, r.expires, pill(daysText(r.daysLeft), r.daysLeft <= 7 ? 'lose' : 'off'), r.disabled ? 'disabled' : 'enabled'];
94
- }, 'Accounts expiring')));
95
- }
96
-
97
- // Warnings > Revokes not done
98
- function wnRevokes(w, _H, desc) {
99
- var H = gvState().revokes;
100
- var extras = el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Campaigns created in the last' }), numSelect(H, 'days', [[30, '30 days'], [90, '90 days'], [180, '180 days'], [365, '365 days']], 'Campaign period'));
101
- if (!gvRunBar(w, H, 'revokes', 'Check revokes', desc, extras, function () { return { days: H.days }; }, renderWarnings)) return;
102
- var d = H.data, T = d.totals;
103
- w.appendChild(el('div', { className: 'bigstats' }, stat(d.campaigns, 'campaigns checked'), stat(T.revokes, 'revoke decisions'), stat(T.removed, 'removed'), stat(T.stillHeld, 'signed off but still held', 'lose'), stat(T.notSignedOff, 'waiting for sign-off')));
104
- if (!d.rows.length) { w.appendChild(el('p', { className: 'muted', text: 'Every revoked item has been removed.' })); return; }
105
- w.appendChild(section('Revoked but still there', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Person', 'Access', 'Type', 'Campaign', 'Reviewer', 'Signed off', 'Status'], function (r) {
106
- return [r.person, r.access, r.accessType, r.campaign, r.reviewer, r.signedOff ? r.signedOff.slice(0, 10) + (r.daysSinceSignOff !== null ? ' (' + r.daysSinceSignOff + ' days ago)' : '') : '—',
107
- el('span', {}, pill(r.status, r.status === 'still held' ? 'lose' : 'off'), r.alsoFromRole ? el('div', { className: 'small muted', text: 'May also come from a role or access profile' }) : null)];
108
- }, 'Revoked but still held')));
109
- }
110
-
111
- // Person lookup > Timeline
112
- function timelineSection(p) {
113
- var items = p.timeline || [];
114
- var L = state.tl || (state.tl = { kind: '' });
115
- var kinds = ['Identity', 'Lifecycle', 'Audit event', 'Account change', 'Access request'];
116
- var sel = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Show in timeline' }, [el('option', { value: '', text: 'Everything' })].concat(kinds.map(function (k) { return el('option', { value: k, text: k }); })));
117
- sel.value = L.kind;
118
- var box = el('div');
119
- var draw = function () {
120
- box.textContent = '';
121
- var list = items.filter(function (x) { return !L.kind || x.kind === L.kind; });
122
- box.appendChild(simpleTable(['When', 'Kind', 'What', 'Detail', 'Status'], list.slice(0, 500).map(function (x) {
123
- return [gvTime(x.when), x.kind, x.what, x.detail, x.status ? pill(String(x.status).toLowerCase(), x.failed ? 'lose' : 'off') : ''];
124
- }), 'Timeline'));
125
- };
126
- sel.addEventListener('change', function () { L.kind = sel.value; draw(); });
127
- draw();
128
- return section('Timeline (30 days, newest first)', items.length, el('div', {}, el('div', { className: 'bar', style: 'margin-bottom:8px' }, sel, el('span', { className: 'muted small', text: 'Lifecycle changes, audit events, account changes and access requests in one list.' })), box));
129
- }
1
+ // ---------- 0.22.0: access request audit trail, approver chain, accounts expiring, revokes not done, person timeline ----------
2
+ function gvState() {
3
+ if (!state.gv) state.gv = { trail: { days: 30, item: '', person: '' }, chain: {}, expiry: { days: 30, attribute: 'accountExpires', sourceIds: [] }, revokes: { days: 90 } };
4
+ return state.gv;
5
+ }
6
+ function gvRunBar(w, H, path, label, desc, extras, body, rerender) {
7
+ w.appendChild(el('div', { className: 'bar', style: 'margin-bottom:14px' }, el('span', { className: 'muted', style: 'flex:1;min-width:260px', text: desc }), extras || null,
8
+ el('button', { className: 'btn primary', disabled: !!H.busy, onclick: function () { runJobInto(H, '/api/warnings/' + path + '/run', body ? body() : {}, rerender); } }, icon('play'), H.data ? 'Read again' : label)));
9
+ if (H.busy) { w.appendChild(busyBox(H.busy)); return false; }
10
+ if (H.error) { w.appendChild(el('div', { className: 'error', text: H.error })); return false; }
11
+ if (!H.data) return false;
12
+ (H.data.notes || []).forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
13
+ return true;
14
+ }
15
+ function gvText(H, key, label, placeholder) {
16
+ var i = el('input', { className: 'input', value: H[key] || '', placeholder: placeholder, style: 'max-width:200px', 'aria-label': label });
17
+ i.addEventListener('input', function () { H[key] = i.value; });
18
+ return el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: label }), i);
19
+ }
20
+ function gvTime(s) { return s ? String(s).slice(0, 16).replace('T', ' ') : ''; }
21
+ var GV_DECISION = { APPROVED: 'win', REJECTED: 'lose', PENDING: 'off', EXPIRED: 'lose', CANCELLED: 'off' };
22
+ var GV_OUTCOME = { completed: ['completed', 'win'], rejected: ['rejected', 'lose'], cancelled: ['cancelled', 'off'], failed: ['failed', 'lose'], open: ['in progress', 'off'] };
23
+
24
+ // Audit > Request trail
25
+ function renderRequestTrail(w) {
26
+ var H = gvState().trail;
27
+ var extras = el('div', { className: 'bar' },
28
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Submitted in the last' }), numSelect(H, 'days', [[7, '7 days'], [30, '30 days'], [90, '90 days'], [180, '180 days'], [365, '365 days']], 'Period')),
29
+ gvText(H, 'item', 'Access item contains', 'e.g. VPN'), gvText(H, 'person', 'Person contains', 'requester or recipient'));
30
+ if (!gvRunBar(w, H, 'request-trail', 'Build the trail', 'Every access request with each approval step: who decided, the decision, their comment and when, and how provisioning ended. One row per step in the download, ready for auditors.', extras,
31
+ function () { return { days: H.days, item: H.item || undefined, person: H.person || undefined }; }, renderAudit)) return;
32
+ var d = H.data, T = d.totals;
33
+ w.appendChild(el('div', { className: 'bigstats' }, stat(T.requests, 'requests'), stat(T.completed, 'completed'), stat(T.rejected, 'rejected', 'lose'), stat(T.failed, 'failed', 'lose'), stat(T.open, 'in progress'), stat(T.withoutApproval, 'without an approval step'),
34
+ stat(T.decisions ? Math.round(T.decisionsWithComment * 100 / T.decisions) : 0, '% of decisions with a comment')));
35
+ if (!d.requests.length) return;
36
+ if ((d.approvers || []).length) w.appendChild(section('How fast approvers decide', d.approvers.length, simpleTable(['Approver', 'Decisions', 'Usual time', 'Slowest', 'Waiting now', 'Oldest waiting'], d.approvers.slice(0, 200).map(function (a) {
37
+ return [a.approver, fmtNum(a.decided), hrs(a.medianHours), hrs(a.slowestHours), a.waiting ? pill(String(a.waiting), 'lose') : '0', a.oldestWaitingDays === null ? '—' : a.oldestWaitingDays + ' days'];
38
+ }), 'How fast approvers decide')));
39
+ var rows = d.requests.map(function (r) {
40
+ var o = GV_OUTCOME[r.outcome] || [r.outcome, 'off'];
41
+ var steps = r.steps.length ? el('div', {}, r.steps.map(function (s) {
42
+ return el('div', { style: 'margin:2px 0' }, el('b', { text: s.step + '. ' }), s.approver || '?', s.originalApprover ? el('span', { className: 'muted', text: ' (was ' + s.originalApprover + ')' }) : null, ' ',
43
+ pill(s.decision.toLowerCase(), GV_DECISION[s.decision] || 'off'), s.decided ? el('span', { className: 'muted small', text: ' ' + gvTime(s.decided) }) : null,
44
+ s.comment ? el('div', { className: 'small', style: 'margin-left:16px;font-style:italic', text: '“' + s.comment + '”' }) : null);
45
+ })) : el('span', { className: 'muted', text: 'No approval step' });
46
+ return { r: r, cells: [gvTime(r.submitted), r.requestedFor, r.requestedBy, el('span', {}, r.access, r.accessType ? el('span', { className: 'muted small', text: ' ' + r.accessType.toLowerCase().replace('_', ' ') }) : null, r.requestType === 'REVOKE_ACCESS' ? el('span', {}, ' ', pill('revoke', 'lose')) : null),
47
+ r.requesterComment ? el('span', { className: 'small', style: 'font-style:italic', text: '“' + r.requesterComment + '”' }) : '', steps, el('span', {}, pill(o[0], o[1]), r.errors.length ? el('div', { className: 'small', style: 'color:var(--bad)', text: r.errors.join('; ') }) : null)] };
48
+ });
49
+ w.appendChild(section('Requests', d.requests.length + (d.more || 0), filteredTable(H, rows, ['Submitted', 'Requested for', 'Requested by', 'Access', 'Requester comment', 'Approvals', 'Outcome'], function (x) { return x.cells; }, 'Access request audit trail')));
50
+ }
51
+
52
+ // Audit > Approver chain
53
+ function renderApproverChain(w) {
54
+ var H = gvState().chain;
55
+ if (!gvRunBar(w, H, 'approver-chain', 'Read approval settings', 'Who approves a request, in what order, and who approves a revoke, for every access profile, role and requestable entitlement. Flags requestable access that needs no approval or whose approver cannot be reached.', null, null, renderAudit)) return;
56
+ var d = H.data, T = d.totals;
57
+ w.appendChild(el('div', { className: 'bigstats' }, stat(T.accessProfiles, 'access profiles'), stat(T.roles, 'roles'), stat(T.entitlements, 'requestable entitlements'), stat(T.noApproval, 'requestable without approval', 'lose'), stat(T.flagged, 'with a problem', 'lose')));
58
+ var list = function (xs) { return xs.length ? el('div', {}, xs.map(function (x) { return el('div', { text: x }); })) : el('span', { className: 'muted', text: 'none' }); };
59
+ var H2 = H.view || (H.view = { only: 'requestable' });
60
+ var only = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Show' }, [['requestable', 'Requestable only'], ['problems', 'Only with problems'], ['all', 'Everything']].map(function (o) { return el('option', { value: o[0], text: o[1] }); }));
61
+ only.value = H2.only;
62
+ only.addEventListener('change', function () { H2.only = only.value; renderAudit(); });
63
+ var rows = d.rows.filter(function (r) { return H2.only === 'all' || (H2.only === 'problems' ? r.flags.length : r.requestable); });
64
+ w.appendChild(section('Approval settings', rows.length, filteredTable(H, rows, ['Type', 'Name', 'Source', 'Owner', 'Request approvals', 'Revoke approvals', 'Comment required', 'Problems'], function (r) {
65
+ return [r.type, r.name, r.source, r.owner, list(r.request), list(r.revoke), r.commentsRequired ? 'Yes' : 'No', r.flags.length ? el('div', {}, r.flags.map(function (f) { return el('div', { className: 'small', style: 'color:var(--bad)', text: f }); })) : ''];
66
+ }, 'Approver chain', only)));
67
+ }
68
+
69
+ // Warnings > Accounts expiring
70
+ function wnExpiry(w, _H, desc) {
71
+ var H = gvState().expiry;
72
+ if (!H.sources) {
73
+ H.sources = 'loading';
74
+ api('/api/sources').then(function (r) { H.sources = (r.sources || []).slice().sort(function (a, b) { return String(a.name).localeCompare(String(b.name)); }); }, function () { H.sources = []; }).then(function () { if (state.page === 'warnings') renderWarnings(); });
75
+ }
76
+ var pick = el('select', { className: 'input', multiple: true, size: 4, style: 'min-width:220px', 'aria-label': 'Sources to check' }, (Array.isArray(H.sources) ? H.sources : []).map(function (s) {
77
+ return el('option', { value: s.id, text: s.name, selected: H.sourceIds.indexOf(s.id) >= 0 });
78
+ }));
79
+ if (!H.sourceIds.length && Array.isArray(H.sources)) {
80
+ var ad = H.sources.filter(function (s) { return /active directory|\bad\b/i.test(s.name + ' ' + (s.type || '')); })[0];
81
+ if (ad) { H.sourceIds = [ad.id]; Array.prototype.forEach.call(pick.options, function (o) { o.selected = o.value === ad.id; }); }
82
+ }
83
+ pick.addEventListener('change', function () { H.sourceIds = Array.prototype.filter.call(pick.options, function (o) { return o.selected; }).map(function (o) { return o.value; }); });
84
+ var extras = el('div', { className: 'bar' },
85
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Sources (Ctrl+click for more)' }), pick),
86
+ attrInput(H, 'attribute', 'Expiry attribute', 'accountExpires'),
87
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Expiring within' }), numSelect(H, 'days', [[7, '7 days'], [14, '14 days'], [30, '30 days'], [60, '60 days'], [90, '90 days']], 'Expiring within')));
88
+ if (!gvRunBar(w, H, 'account-expiry', 'Find expiring accounts', desc, extras, function () { return { days: H.days, attribute: H.attribute || 'accountExpires', sourceIds: H.sourceIds }; }, renderWarnings)) return;
89
+ var d = H.data, T = d.totals;
90
+ w.appendChild(el('div', { className: 'bigstats' }, stat(T.accounts, 'accounts read'), stat(T.withDate, 'with an expiry date'), stat(T.never, 'set to never expire'), stat(T.missing, 'without a value'), stat(T.expiring, 'expire in the next ' + d.days + ' days', 'lose'), stat(T.expiredEnabled, 'expired but still enabled', 'lose'), stat(T.unreadable, 'values not readable as a date')));
91
+ if (!d.rows.length) { w.appendChild(el('p', { className: 'muted', text: 'No account expires in this period.' })); return; }
92
+ w.appendChild(section('Accounts', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Account', 'Person', 'Source', 'Expires', 'When', 'Account'], function (r) {
93
+ return [r.account, r.person || el('span', { className: 'muted', text: 'not linked to a person' }), r.source, r.expires, pill(daysText(r.daysLeft), r.daysLeft <= 7 ? 'lose' : 'off'), r.disabled ? 'disabled' : 'enabled'];
94
+ }, 'Accounts expiring')));
95
+ }
96
+
97
+ // Warnings > Revokes not done
98
+ function wnRevokes(w, _H, desc) {
99
+ var H = gvState().revokes;
100
+ var extras = el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Campaigns created in the last' }), numSelect(H, 'days', [[30, '30 days'], [90, '90 days'], [180, '180 days'], [365, '365 days']], 'Campaign period'));
101
+ if (!gvRunBar(w, H, 'revokes', 'Check revokes', desc, extras, function () { return { days: H.days }; }, renderWarnings)) return;
102
+ var d = H.data, T = d.totals;
103
+ w.appendChild(el('div', { className: 'bigstats' }, stat(d.campaigns, 'campaigns checked'), stat(T.revokes, 'revoke decisions'), stat(T.removed, 'removed'), stat(T.stillHeld, 'signed off but still held', 'lose'), stat(T.notSignedOff, 'waiting for sign-off')));
104
+ if (!d.rows.length) { w.appendChild(el('p', { className: 'muted', text: 'Every revoked item has been removed.' })); return; }
105
+ w.appendChild(section('Revoked but still there', d.rows.length + (d.more || 0), filteredTable(H, d.rows, ['Person', 'Access', 'Type', 'Campaign', 'Reviewer', 'Signed off', 'Status'], function (r) {
106
+ return [r.person, r.access, r.accessType, r.campaign, r.reviewer, r.signedOff ? r.signedOff.slice(0, 10) + (r.daysSinceSignOff !== null ? ' (' + r.daysSinceSignOff + ' days ago)' : '') : '—',
107
+ el('span', {}, pill(r.status, r.status === 'still held' ? 'lose' : 'off'), r.alsoFromRole ? el('div', { className: 'small muted', text: 'May also come from a role or access profile' }) : null)];
108
+ }, 'Revoked but still held')));
109
+ }
110
+
111
+ // Person lookup > Timeline
112
+ function timelineSection(p) {
113
+ var items = p.timeline || [];
114
+ var L = state.tl || (state.tl = { kind: '' });
115
+ var kinds = ['Identity', 'Lifecycle', 'Audit event', 'Account change', 'Access request'];
116
+ var sel = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Show in timeline' }, [el('option', { value: '', text: 'Everything' })].concat(kinds.map(function (k) { return el('option', { value: k, text: k }); })));
117
+ sel.value = L.kind;
118
+ var box = el('div');
119
+ var draw = function () {
120
+ box.textContent = '';
121
+ var list = items.filter(function (x) { return !L.kind || x.kind === L.kind; });
122
+ box.appendChild(simpleTable(['When', 'Kind', 'What', 'Detail', 'Status'], list.slice(0, 500).map(function (x) {
123
+ return [gvTime(x.when), x.kind, x.what, x.detail, x.status ? pill(String(x.status).toLowerCase(), x.failed ? 'lose' : 'off') : ''];
124
+ }), 'Timeline'));
125
+ };
126
+ sel.addEventListener('change', function () { L.kind = sel.value; draw(); });
127
+ draw();
128
+ return section('Timeline (30 days, newest first)', items.length, el('div', {}, el('div', { className: 'bar', style: 'margin-bottom:8px' }, sel, el('span', { className: 'muted small', text: 'Lifecycle changes, audit events, account changes and access requests in one list.' })), box));
129
+ }