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.
- package/LICENSE +21 -21
- package/README.md +914 -917
- package/SECURITY.md +56 -56
- package/dist/node/cli.js +26 -26
- package/dist/node/monthly.js +17 -17
- package/package.json +2 -2
- package/reports/access-profile-members.yaml +29 -29
- package/reports/access-profile-membership-counts.yaml +17 -17
- package/reports/access-profiles-without-owner.yaml +16 -16
- package/reports/access-request-audit-trail.yaml +36 -36
- package/reports/accounts-by-source.yaml +19 -19
- package/reports/active-identities-without-manager.yaml +22 -22
- package/reports/aggregation-failures.yaml +29 -29
- package/reports/aggregation-history.yaml +27 -27
- package/reports/all-sources.yaml +16 -16
- package/reports/application-accounts.yaml +32 -32
- package/reports/application-entitlements.yaml +31 -31
- package/reports/campaign-progress.yaml +23 -23
- package/reports/certification-decisions.yaml +31 -31
- package/reports/direct-reports-per-manager.yaml +20 -20
- package/reports/disabled-accounts-of-active-people.yaml +33 -33
- package/reports/duplicate-emails.yaml +16 -16
- package/reports/entitlement-holders.yaml +35 -35
- package/reports/entitlements-held-by-inactive-identities.yaml +31 -31
- package/reports/entitlements-without-owner.yaml +28 -28
- package/reports/identities-by-lifecycle-state.yaml +15 -15
- package/reports/identities-missing-key-attributes.yaml +27 -27
- package/reports/identities-with-processing-errors.yaml +19 -19
- package/reports/identity-attribute-mappings.yaml +27 -27
- package/reports/machine-accounts.yaml +28 -28
- package/reports/managers-and-direct-reports.yaml +23 -23
- package/reports/most-access.yaml +18 -18
- package/reports/new-identities.yaml +24 -24
- package/reports/old-passwords.yaml +35 -35
- package/reports/pending-reviews-by-reviewer.yaml +20 -20
- package/reports/person-access.yaml +31 -31
- package/reports/privileged-access.yaml +29 -29
- package/reports/provisioning-error-causes.yaml +27 -27
- package/reports/provisioning-errors.yaml +32 -32
- package/reports/provisioning-failures.yaml +28 -28
- package/reports/recent-access-requests.yaml +22 -22
- package/reports/recent-activity.yaml +32 -32
- package/reports/recent-leavers.yaml +34 -34
- package/reports/role-members.yaml +29 -29
- package/reports/role-membership-counts.yaml +18 -18
- package/reports/roles-without-owner.yaml +17 -17
- package/reports/sources-needing-attention.yaml +23 -23
- package/reports/stuck-access-requests.yaml +29 -29
- package/reports/team-access.yaml +30 -30
- package/reports/terminated-users-with-active-accounts.yaml +46 -46
- package/reports/uncorrelated-accounts.yaml +38 -38
- package/ui/js/00-setup.js +6 -6
- package/ui/js/01-small-helpers.js +143 -143
- package/ui/js/02-connection.js +150 -150
- package/ui/js/03-health-check.js +17 -17
- package/ui/js/04-library.js +135 -135
- package/ui/js/05-pickers.js +163 -163
- package/ui/js/06-report-view.js +157 -157
- package/ui/js/07-fields.js +85 -85
- package/ui/js/08-designer.js +360 -360
- package/ui/js/09-yaml.js +22 -22
- package/ui/js/10-instant-check.js +171 -171
- package/ui/js/11-lookup.js +161 -161
- package/ui/js/12-tenant.js +115 -115
- package/ui/js/13-source-configuration-and-diagnostics.js +64 -64
- package/ui/js/14-certifications.js +68 -68
- package/ui/js/15-monthly-report.js +24 -24
- package/ui/js/16-ownership.js +39 -39
- package/ui/js/17-compare-tenants.js +102 -102
- package/ui/js/18-audit.js +181 -181
- package/ui/js/19-insights.js +108 -108
- package/ui/js/20-role-mining.js +35 -35
- package/ui/js/21-share-reports.js +45 -45
- package/ui/js/22-partner-overview-all-customer-tenants.js +228 -228
- package/ui/js/23-in-app-guidance.js +217 -217
- package/ui/js/24-role-tools.js +220 -220
- package/ui/js/25-schedules.js +264 -264
- package/ui/js/26-start.js +7 -7
- package/ui/js/27-warnings.js +224 -224
- package/ui/js/28-audit-readiness.js +99 -99
- package/ui/js/29-lifecycle.js +182 -182
- package/ui/js/30-labs.js +265 -265
- package/ui/js/31-build.js +203 -203
- package/ui/js/32-lab-examples.js +148 -148
- package/ui/js/33-finder.js +89 -89
- package/ui/js/34-governance.js +129 -129
- package/ui/js/35-watch.js +266 -266
- package/ui/js/36-model.js +247 -247
- package/ui/js/37-logs-and-watch.js +224 -224
- package/ui/shell.html +112 -112
- package/ui/style.css +350 -350
package/ui/js/06-report-view.js
CHANGED
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
// ---------- report view ----------
|
|
2
|
-
function renderMain() {
|
|
3
|
-
var m = $('main');
|
|
4
|
-
var keep = m.scrollTop;
|
|
5
|
-
m.textContent = '';
|
|
6
|
-
var c = state.current;
|
|
7
|
-
if (!c) { renderHome(); return; }
|
|
8
|
-
var d = c.def;
|
|
9
|
-
var w = el('div', { className: 'wrap' });
|
|
10
|
-
m.appendChild(w);
|
|
11
|
-
var cat = c.custom ? 'My reports' : (d.category || 'Other');
|
|
12
|
-
w.appendChild(el('div', { className: 'crumbs' }, el('button', { text: 'All reports', onclick: goHome }), '/', el('span', { text: cat })));
|
|
13
|
-
w.appendChild(el('div', { className: 'rhead' }, catIcon(cat), el('div', { style: 'flex:1' },
|
|
14
|
-
el('h2', { text: d.name || 'New report' }),
|
|
15
|
-
d.description ? el('p', { className: 'desc', text: d.description }) : null,
|
|
16
|
-
(d.tags && d.tags.length) ? el('div', { style: 'margin-top:8px' }, d.tags.map(function (t) { return el('span', { className: 'tag', text: t }); })) : null)));
|
|
17
|
-
var tabs = el('div', { className: 'tabs' });
|
|
18
|
-
[['run', 'Run', 'play'], ['design', c.custom ? 'Design' : 'Customize', 'sliders'], ['yaml', 'YAML', 'code']].forEach(function (t) {
|
|
19
|
-
tabs.appendChild(el('button', { className: 'tab' + (state.tab === t[0] ? ' active' : ''), onclick: function () { state.tab = t[0]; renderMain(); } }, icon(t[2]), t[1]));
|
|
20
|
-
});
|
|
21
|
-
w.appendChild(tabs);
|
|
22
|
-
if (state.tab === 'run') renderRun(w);
|
|
23
|
-
else if (state.tab === 'design') renderDesign(w);
|
|
24
|
-
else renderYaml(w);
|
|
25
|
-
m.scrollTop = keep;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function renderRun(w) {
|
|
29
|
-
var c = state.current, d = c.def;
|
|
30
|
-
var card = el('section', { className: 'card' });
|
|
31
|
-
var grid = paramsGrid(d.params, state.paramValues, null, d);
|
|
32
|
-
if (grid) card.appendChild(el('div', { className: 'card-h' }, el('h3', {}, icon('sliders'), 'Options')));
|
|
33
|
-
if (grid) card.appendChild(grid);
|
|
34
|
-
var groupSel = el('select', { className: 'input' }, el('option', { value: '', text: 'Every row' }), fieldChoices(d, true).map(function (g) {
|
|
35
|
-
return el('optgroup', { label: g.label }, g.fields.map(function (o) { return el('option', { value: o.value, text: 'Count by ' + o.label }); }));
|
|
36
|
-
}));
|
|
37
|
-
groupSel.value = state.groupBy || '';
|
|
38
|
-
groupSel.addEventListener('change', function () { state.groupBy = groupSel.value; });
|
|
39
|
-
card.appendChild(el('div', { className: 'runbar', style: grid ? '' : 'margin-top:0;padding-top:0;border-top:none' },
|
|
40
|
-
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Show' }), groupSel),
|
|
41
|
-
el('button', { className: 'btn', title: 'Reads only the first 500 records, to check the report quickly', onclick: function () { run(500); } }, icon('eye'), 'Preview'),
|
|
42
|
-
el('button', { className: 'btn primary', onclick: function () { run(); } }, icon('play'), 'Run report'),
|
|
43
|
-
el('span', { className: 'spacer' }),
|
|
44
|
-
c.isNew ? null : el('button', { className: 'btn ghost', title: 'Send it by email or Teams on a schedule', onclick: function () {
|
|
45
|
-
state.editing = { isNew: true, report: d.id, params: clone(state.paramValues || {}) };
|
|
46
|
-
showPage('schedules');
|
|
47
|
-
} }, icon('clock'), 'Schedule this report')));
|
|
48
|
-
w.appendChild(card);
|
|
49
|
-
var out = el('div', { id: 'run-out' });
|
|
50
|
-
w.appendChild(out);
|
|
51
|
-
renderResult();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function paramsForRun() {
|
|
55
|
-
var out = {};
|
|
56
|
-
Object.keys(state.paramValues || {}).forEach(function (k) {
|
|
57
|
-
var v = state.paramValues[k];
|
|
58
|
-
if (v === '' || v === null || v === undefined || (Array.isArray(v) && !v.length)) return;
|
|
59
|
-
out[k] = v;
|
|
60
|
-
});
|
|
61
|
-
return out;
|
|
62
|
-
}
|
|
63
|
-
function run(preview) {
|
|
64
|
-
var c = state.current;
|
|
65
|
-
var params = paramsForRun();
|
|
66
|
-
Object.keys(params).forEach(function (k) { if (!c.def.params || !c.def.params[k]) delete params[k]; });
|
|
67
|
-
var body = { definition: c.def, params: params, preview: preview, groupBy: state.groupBy && state.tab === 'run' ? [state.groupBy] : [] };
|
|
68
|
-
state.result = null;
|
|
69
|
-
state.runError = null;
|
|
70
|
-
state.progress = 'Starting...';
|
|
71
|
-
state.running = true;
|
|
72
|
-
state.sortCol = null;
|
|
73
|
-
state.quick = '';
|
|
74
|
-
renderResult();
|
|
75
|
-
api('/api/run', 'POST', body).then(function (r) {
|
|
76
|
-
state.job = r.job;
|
|
77
|
-
poll(r.job);
|
|
78
|
-
}).catch(function (e) { state.running = false; state.runError = errorText(e); renderResult(); });
|
|
79
|
-
}
|
|
80
|
-
function poll(job) {
|
|
81
|
-
state.activeJob = job;
|
|
82
|
-
api('/api/jobs/' + job).then(function (s) {
|
|
83
|
-
if (state.job !== job) return;
|
|
84
|
-
if (s.state === 'running') {
|
|
85
|
-
state.progress = s.progress + ' · ' + s.seconds + 's';
|
|
86
|
-
renderResult();
|
|
87
|
-
setTimeout(function () { poll(job); }, 700);
|
|
88
|
-
} else {
|
|
89
|
-
state.running = false;
|
|
90
|
-
if (s.state === 'error') state.runError = s.error;
|
|
91
|
-
else state.result = s.result;
|
|
92
|
-
renderResult();
|
|
93
|
-
}
|
|
94
|
-
}).catch(function (e) { state.running = false; state.runError = errorText(e); renderResult(); });
|
|
95
|
-
}
|
|
96
|
-
function cellText(v) { return v === null || v === undefined ? '' : typeof v === 'boolean' ? (v ? 'Yes' : 'No') : typeof v === 'number' ? fmtNum(v) : String(v); }
|
|
97
|
-
function renderResult() {
|
|
98
|
-
var out = $('run-out');
|
|
99
|
-
if (!out) return;
|
|
100
|
-
out.textContent = '';
|
|
101
|
-
if (state.running) {
|
|
102
|
-
out.appendChild(el('section', { className: 'card' }, el('div', { className: 'progress', style: 'margin:0' }, el('span', { className: 'spinner' }), el('span', { text: state.progress, style: 'flex:1' }), stopButton())));
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (state.runError) { out.appendChild(el('div', { className: 'error', text: state.runError })); return; }
|
|
106
|
-
var r = state.result;
|
|
107
|
-
if (!r) {
|
|
108
|
-
out.appendChild(el('div', { className: 'empty' }, el('b', { text: 'Ready when you are' }), 'Press Preview for a quick look at the first 500 records, or Run report for the full result.'));
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
var dl = function (f, label, primary) {
|
|
112
|
-
return el('a', { className: 'btn sm' + (primary ? ' primary' : ''), href: '/api/jobs/' + state.job + '/download?format=' + f + '&k=' + encodeURIComponent(KEY), download: '' }, icon('download'), label);
|
|
113
|
-
};
|
|
114
|
-
var quick = el('input', { className: 'input', placeholder: 'Filter these rows...', value: state.quick || '', style: 'width:230px;padding:6px 10px' });
|
|
115
|
-
var card = el('section', { className: 'card', style: 'padding:16px' });
|
|
116
|
-
card.appendChild(el('div', { className: 'stats' },
|
|
117
|
-
el('div', { className: 'stat' }, el('b', { text: fmtNum(r.total) }), el('span', { text: r.total === 1 ? 'row' : 'rows' })),
|
|
118
|
-
el('div', { className: 'stat' }, el('b', { text: (r.durationMs / 1000).toFixed(1) + 's' }), el('span', { text: 'to run' })),
|
|
119
|
-
el('span', { className: 'spacer', style: 'flex:1' }),
|
|
120
|
-
r.total ? quick : null,
|
|
121
|
-
dl('xlsx', 'Excel', true), dl('csv', 'CSV'), dl('html', 'HTML')));
|
|
122
|
-
r.warnings.forEach(function (x) { card.appendChild(el('div', { className: 'note', text: x })); });
|
|
123
|
-
if (r.total > r.shown) card.appendChild(el('div', { className: 'note', text: 'Showing the first ' + fmtNum(r.shown) + ' rows here. Downloads contain all ' + fmtNum(r.total) + '.' }));
|
|
124
|
-
out.appendChild(card);
|
|
125
|
-
if (!r.total) { card.appendChild(el('div', { className: 'empty' }, el('b', { text: 'No rows' }), 'Nothing in the tenant matches this report. That can be good news.')); return; }
|
|
126
|
-
var tableBox = el('div', { className: 'table-wrap' });
|
|
127
|
-
card.appendChild(tableBox);
|
|
128
|
-
function drawTable() {
|
|
129
|
-
var q = (state.quick || '').toLowerCase();
|
|
130
|
-
var rows = r.rows.filter(function (row) { return !q || row.some(function (v) { return cellText(v).toLowerCase().indexOf(q) >= 0; }); });
|
|
131
|
-
if (state.sortCol !== null && state.sortCol !== undefined) {
|
|
132
|
-
var i = state.sortCol, dir = state.sortDir;
|
|
133
|
-
rows = rows.slice().sort(function (a, b) {
|
|
134
|
-
var x = a[i], y = b[i];
|
|
135
|
-
if (x === null || x === '') return 1; if (y === null || y === '') return -1;
|
|
136
|
-
if (typeof x === 'number' && typeof y === 'number') return (x - y) * dir;
|
|
137
|
-
return String(x).localeCompare(String(y), 'en', { numeric: true, sensitivity: 'base' }) * dir;
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
tableBox.textContent = '';
|
|
141
|
-
tableBox.appendChild(el('table', {},
|
|
142
|
-
el('thead', {}, el('tr', {}, r.columns.map(function (col, i) {
|
|
143
|
-
return el('th', { title: 'Sort', onclick: function () { state.sortDir = state.sortCol === i ? -state.sortDir : 1; state.sortCol = i; drawTable(); } },
|
|
144
|
-
col.label, state.sortCol === i ? el('span', { className: 'arrow', text: state.sortDir > 0 ? '▲' : '▼' }) : null);
|
|
145
|
-
}))),
|
|
146
|
-
el('tbody', {}, rows.map(function (row) {
|
|
147
|
-
return el('tr', {}, row.map(function (v) {
|
|
148
|
-
if (typeof v === 'boolean') return el('td', {}, el('span', { className: v ? 'yes' : 'no', text: v ? 'Yes' : 'No' }));
|
|
149
|
-
return el('td', { className: typeof v === 'number' ? 'num' : v === null || v === '' ? 'empty-cell' : '', text: v === null || v === '' ? '—' : cellText(v) });
|
|
150
|
-
}));
|
|
151
|
-
}))));
|
|
152
|
-
if (!rows.length) tableBox.appendChild(el('div', { className: 'empty', text: 'No shown row contains "' + state.quick + '".' }));
|
|
153
|
-
}
|
|
154
|
-
quick.addEventListener('input', function () { state.quick = quick.value; drawTable(); });
|
|
155
|
-
drawTable();
|
|
156
|
-
}
|
|
157
|
-
|
|
1
|
+
// ---------- report view ----------
|
|
2
|
+
function renderMain() {
|
|
3
|
+
var m = $('main');
|
|
4
|
+
var keep = m.scrollTop;
|
|
5
|
+
m.textContent = '';
|
|
6
|
+
var c = state.current;
|
|
7
|
+
if (!c) { renderHome(); return; }
|
|
8
|
+
var d = c.def;
|
|
9
|
+
var w = el('div', { className: 'wrap' });
|
|
10
|
+
m.appendChild(w);
|
|
11
|
+
var cat = c.custom ? 'My reports' : (d.category || 'Other');
|
|
12
|
+
w.appendChild(el('div', { className: 'crumbs' }, el('button', { text: 'All reports', onclick: goHome }), '/', el('span', { text: cat })));
|
|
13
|
+
w.appendChild(el('div', { className: 'rhead' }, catIcon(cat), el('div', { style: 'flex:1' },
|
|
14
|
+
el('h2', { text: d.name || 'New report' }),
|
|
15
|
+
d.description ? el('p', { className: 'desc', text: d.description }) : null,
|
|
16
|
+
(d.tags && d.tags.length) ? el('div', { style: 'margin-top:8px' }, d.tags.map(function (t) { return el('span', { className: 'tag', text: t }); })) : null)));
|
|
17
|
+
var tabs = el('div', { className: 'tabs' });
|
|
18
|
+
[['run', 'Run', 'play'], ['design', c.custom ? 'Design' : 'Customize', 'sliders'], ['yaml', 'YAML', 'code']].forEach(function (t) {
|
|
19
|
+
tabs.appendChild(el('button', { className: 'tab' + (state.tab === t[0] ? ' active' : ''), onclick: function () { state.tab = t[0]; renderMain(); } }, icon(t[2]), t[1]));
|
|
20
|
+
});
|
|
21
|
+
w.appendChild(tabs);
|
|
22
|
+
if (state.tab === 'run') renderRun(w);
|
|
23
|
+
else if (state.tab === 'design') renderDesign(w);
|
|
24
|
+
else renderYaml(w);
|
|
25
|
+
m.scrollTop = keep;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function renderRun(w) {
|
|
29
|
+
var c = state.current, d = c.def;
|
|
30
|
+
var card = el('section', { className: 'card' });
|
|
31
|
+
var grid = paramsGrid(d.params, state.paramValues, null, d);
|
|
32
|
+
if (grid) card.appendChild(el('div', { className: 'card-h' }, el('h3', {}, icon('sliders'), 'Options')));
|
|
33
|
+
if (grid) card.appendChild(grid);
|
|
34
|
+
var groupSel = el('select', { className: 'input' }, el('option', { value: '', text: 'Every row' }), fieldChoices(d, true).map(function (g) {
|
|
35
|
+
return el('optgroup', { label: g.label }, g.fields.map(function (o) { return el('option', { value: o.value, text: 'Count by ' + o.label }); }));
|
|
36
|
+
}));
|
|
37
|
+
groupSel.value = state.groupBy || '';
|
|
38
|
+
groupSel.addEventListener('change', function () { state.groupBy = groupSel.value; });
|
|
39
|
+
card.appendChild(el('div', { className: 'runbar', style: grid ? '' : 'margin-top:0;padding-top:0;border-top:none' },
|
|
40
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Show' }), groupSel),
|
|
41
|
+
el('button', { className: 'btn', title: 'Reads only the first 500 records, to check the report quickly', onclick: function () { run(500); } }, icon('eye'), 'Preview'),
|
|
42
|
+
el('button', { className: 'btn primary', onclick: function () { run(); } }, icon('play'), 'Run report'),
|
|
43
|
+
el('span', { className: 'spacer' }),
|
|
44
|
+
c.isNew ? null : el('button', { className: 'btn ghost', title: 'Send it by email or Teams on a schedule', onclick: function () {
|
|
45
|
+
state.editing = { isNew: true, report: d.id, params: clone(state.paramValues || {}) };
|
|
46
|
+
showPage('schedules');
|
|
47
|
+
} }, icon('clock'), 'Schedule this report')));
|
|
48
|
+
w.appendChild(card);
|
|
49
|
+
var out = el('div', { id: 'run-out' });
|
|
50
|
+
w.appendChild(out);
|
|
51
|
+
renderResult();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function paramsForRun() {
|
|
55
|
+
var out = {};
|
|
56
|
+
Object.keys(state.paramValues || {}).forEach(function (k) {
|
|
57
|
+
var v = state.paramValues[k];
|
|
58
|
+
if (v === '' || v === null || v === undefined || (Array.isArray(v) && !v.length)) return;
|
|
59
|
+
out[k] = v;
|
|
60
|
+
});
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
function run(preview) {
|
|
64
|
+
var c = state.current;
|
|
65
|
+
var params = paramsForRun();
|
|
66
|
+
Object.keys(params).forEach(function (k) { if (!c.def.params || !c.def.params[k]) delete params[k]; });
|
|
67
|
+
var body = { definition: c.def, params: params, preview: preview, groupBy: state.groupBy && state.tab === 'run' ? [state.groupBy] : [] };
|
|
68
|
+
state.result = null;
|
|
69
|
+
state.runError = null;
|
|
70
|
+
state.progress = 'Starting...';
|
|
71
|
+
state.running = true;
|
|
72
|
+
state.sortCol = null;
|
|
73
|
+
state.quick = '';
|
|
74
|
+
renderResult();
|
|
75
|
+
api('/api/run', 'POST', body).then(function (r) {
|
|
76
|
+
state.job = r.job;
|
|
77
|
+
poll(r.job);
|
|
78
|
+
}).catch(function (e) { state.running = false; state.runError = errorText(e); renderResult(); });
|
|
79
|
+
}
|
|
80
|
+
function poll(job) {
|
|
81
|
+
state.activeJob = job;
|
|
82
|
+
api('/api/jobs/' + job).then(function (s) {
|
|
83
|
+
if (state.job !== job) return;
|
|
84
|
+
if (s.state === 'running') {
|
|
85
|
+
state.progress = s.progress + ' · ' + s.seconds + 's';
|
|
86
|
+
renderResult();
|
|
87
|
+
setTimeout(function () { poll(job); }, 700);
|
|
88
|
+
} else {
|
|
89
|
+
state.running = false;
|
|
90
|
+
if (s.state === 'error') state.runError = s.error;
|
|
91
|
+
else state.result = s.result;
|
|
92
|
+
renderResult();
|
|
93
|
+
}
|
|
94
|
+
}).catch(function (e) { state.running = false; state.runError = errorText(e); renderResult(); });
|
|
95
|
+
}
|
|
96
|
+
function cellText(v) { return v === null || v === undefined ? '' : typeof v === 'boolean' ? (v ? 'Yes' : 'No') : typeof v === 'number' ? fmtNum(v) : String(v); }
|
|
97
|
+
function renderResult() {
|
|
98
|
+
var out = $('run-out');
|
|
99
|
+
if (!out) return;
|
|
100
|
+
out.textContent = '';
|
|
101
|
+
if (state.running) {
|
|
102
|
+
out.appendChild(el('section', { className: 'card' }, el('div', { className: 'progress', style: 'margin:0' }, el('span', { className: 'spinner' }), el('span', { text: state.progress, style: 'flex:1' }), stopButton())));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (state.runError) { out.appendChild(el('div', { className: 'error', text: state.runError })); return; }
|
|
106
|
+
var r = state.result;
|
|
107
|
+
if (!r) {
|
|
108
|
+
out.appendChild(el('div', { className: 'empty' }, el('b', { text: 'Ready when you are' }), 'Press Preview for a quick look at the first 500 records, or Run report for the full result.'));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
var dl = function (f, label, primary) {
|
|
112
|
+
return el('a', { className: 'btn sm' + (primary ? ' primary' : ''), href: '/api/jobs/' + state.job + '/download?format=' + f + '&k=' + encodeURIComponent(KEY), download: '' }, icon('download'), label);
|
|
113
|
+
};
|
|
114
|
+
var quick = el('input', { className: 'input', placeholder: 'Filter these rows...', value: state.quick || '', style: 'width:230px;padding:6px 10px' });
|
|
115
|
+
var card = el('section', { className: 'card', style: 'padding:16px' });
|
|
116
|
+
card.appendChild(el('div', { className: 'stats' },
|
|
117
|
+
el('div', { className: 'stat' }, el('b', { text: fmtNum(r.total) }), el('span', { text: r.total === 1 ? 'row' : 'rows' })),
|
|
118
|
+
el('div', { className: 'stat' }, el('b', { text: (r.durationMs / 1000).toFixed(1) + 's' }), el('span', { text: 'to run' })),
|
|
119
|
+
el('span', { className: 'spacer', style: 'flex:1' }),
|
|
120
|
+
r.total ? quick : null,
|
|
121
|
+
dl('xlsx', 'Excel', true), dl('csv', 'CSV'), dl('html', 'HTML')));
|
|
122
|
+
r.warnings.forEach(function (x) { card.appendChild(el('div', { className: 'note', text: x })); });
|
|
123
|
+
if (r.total > r.shown) card.appendChild(el('div', { className: 'note', text: 'Showing the first ' + fmtNum(r.shown) + ' rows here. Downloads contain all ' + fmtNum(r.total) + '.' }));
|
|
124
|
+
out.appendChild(card);
|
|
125
|
+
if (!r.total) { card.appendChild(el('div', { className: 'empty' }, el('b', { text: 'No rows' }), 'Nothing in the tenant matches this report. That can be good news.')); return; }
|
|
126
|
+
var tableBox = el('div', { className: 'table-wrap' });
|
|
127
|
+
card.appendChild(tableBox);
|
|
128
|
+
function drawTable() {
|
|
129
|
+
var q = (state.quick || '').toLowerCase();
|
|
130
|
+
var rows = r.rows.filter(function (row) { return !q || row.some(function (v) { return cellText(v).toLowerCase().indexOf(q) >= 0; }); });
|
|
131
|
+
if (state.sortCol !== null && state.sortCol !== undefined) {
|
|
132
|
+
var i = state.sortCol, dir = state.sortDir;
|
|
133
|
+
rows = rows.slice().sort(function (a, b) {
|
|
134
|
+
var x = a[i], y = b[i];
|
|
135
|
+
if (x === null || x === '') return 1; if (y === null || y === '') return -1;
|
|
136
|
+
if (typeof x === 'number' && typeof y === 'number') return (x - y) * dir;
|
|
137
|
+
return String(x).localeCompare(String(y), 'en', { numeric: true, sensitivity: 'base' }) * dir;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
tableBox.textContent = '';
|
|
141
|
+
tableBox.appendChild(el('table', {},
|
|
142
|
+
el('thead', {}, el('tr', {}, r.columns.map(function (col, i) {
|
|
143
|
+
return el('th', { title: 'Sort', onclick: function () { state.sortDir = state.sortCol === i ? -state.sortDir : 1; state.sortCol = i; drawTable(); } },
|
|
144
|
+
col.label, state.sortCol === i ? el('span', { className: 'arrow', text: state.sortDir > 0 ? '▲' : '▼' }) : null);
|
|
145
|
+
}))),
|
|
146
|
+
el('tbody', {}, rows.map(function (row) {
|
|
147
|
+
return el('tr', {}, row.map(function (v) {
|
|
148
|
+
if (typeof v === 'boolean') return el('td', {}, el('span', { className: v ? 'yes' : 'no', text: v ? 'Yes' : 'No' }));
|
|
149
|
+
return el('td', { className: typeof v === 'number' ? 'num' : v === null || v === '' ? 'empty-cell' : '', text: v === null || v === '' ? '—' : cellText(v) });
|
|
150
|
+
}));
|
|
151
|
+
}))));
|
|
152
|
+
if (!rows.length) tableBox.appendChild(el('div', { className: 'empty', text: 'No shown row contains "' + state.quick + '".' }));
|
|
153
|
+
}
|
|
154
|
+
quick.addEventListener('input', function () { state.quick = quick.value; drawTable(); });
|
|
155
|
+
drawTable();
|
|
156
|
+
}
|
|
157
|
+
|
package/ui/js/07-fields.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
// ---------- fields ----------
|
|
2
|
-
var ALIAS_LABEL = { profile: 'Identity profile', mapping: 'Mapping', identity: 'Person', account: 'Account', access: 'Access item', entitlement: 'Entitlement', source: 'Source', role: 'Role', accessProfile: 'Access profile', event: 'Audit event', activity: 'Account activity', campaign: 'Campaign', item: 'Review item', request: 'Access request', request2: 'Request' };
|
|
3
|
-
function datasetOf(name) { return state.catalog.datasets.filter(function (d) { return d.name === name; })[0]; }
|
|
4
|
-
function ensureDisc(dataset) {
|
|
5
|
-
if (state.disc[dataset]) return;
|
|
6
|
-
state.disc[dataset] = { loading: true };
|
|
7
|
-
api('/api/discover/' + dataset).then(function (r) { state.disc[dataset] = r; }, function (e) { state.disc[dataset] = { error: errorText(e) }; })
|
|
8
|
-
.then(function () {
|
|
9
|
-
if (state.page === 'build' && state.bt && state.bt.tab === 'roles' && dataset === 'identities' && !state.imp.busy) { renderBuild(); return; }
|
|
10
|
-
if (!$('roles').classList.contains('hidden')) { if (dataset === 'identities' && ((state.roleTab === 'impact' && !state.imp.busy) || (state.roleTab === 'mining' && !state.mn.busy))) renderRoles(); return; }
|
|
11
|
-
if (state.current && !state.running && state.tab !== 'yaml' && state.current.def.from.dataset === dataset) renderMain();
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
/** Field choices grouped by alias. Each field: { value, label, type, values, path }. */
|
|
15
|
-
function fieldChoices(d, forCounting) {
|
|
16
|
-
var ds = datasetOf(d.from.dataset);
|
|
17
|
-
if (!ds) return [];
|
|
18
|
-
var disc = state.disc[d.from.dataset];
|
|
19
|
-
var discOk = disc && disc.fields;
|
|
20
|
-
var groups = [];
|
|
21
|
-
function addGroup(alias, label, catalog, found) {
|
|
22
|
-
var byPath = {};
|
|
23
|
-
(found || []).forEach(function (f) { byPath[f.path] = f; });
|
|
24
|
-
var known = [], extra = [];
|
|
25
|
-
(catalog || []).forEach(function (f) {
|
|
26
|
-
if (f.type === 'object' || (forCounting && f.type === 'list' && !f.expandable && f.path !== 'tags')) return;
|
|
27
|
-
if (f.expandable) return;
|
|
28
|
-
var df = byPath[f.path];
|
|
29
|
-
known.push({ value: alias + '.' + f.path, label: f.label, type: f.type, values: df ? df.values : [], path: f.path });
|
|
30
|
-
});
|
|
31
|
-
(found || []).forEach(function (f) {
|
|
32
|
-
if (f.known || f.type === 'object') return;
|
|
33
|
-
if ((catalog || []).some(function (c) { return c.path === f.path || f.path.indexOf(c.path + '.') === 0 && c.expandable; })) return;
|
|
34
|
-
extra.push({ value: alias + '.' + f.path, label: f.label, type: f.type, values: f.values, path: f.path });
|
|
35
|
-
});
|
|
36
|
-
if (known.length) groups.push({ label: label, fields: known });
|
|
37
|
-
if (extra.length) groups.push({ label: label + ': more found in your tenant', fields: extra });
|
|
38
|
-
}
|
|
39
|
-
var root = d.from.as || ds.alias;
|
|
40
|
-
addGroup(root, ALIAS_LABEL[root] || ds.label, ds.fields, discOk ? disc.fields : null);
|
|
41
|
-
if (d.expand) {
|
|
42
|
-
var key = d.expand.path.split('.').slice(1).join('.');
|
|
43
|
-
var items = ds.itemFields && ds.itemFields[key];
|
|
44
|
-
if (items) addGroup(d.expand.as, ALIAS_LABEL[d.expand.as] || d.expand.as, items, discOk && disc.items ? disc.items[key] : null);
|
|
45
|
-
}
|
|
46
|
-
(d.joins || []).forEach(function (j) {
|
|
47
|
-
var jd = datasetOf(j.dataset);
|
|
48
|
-
if (jd) addGroup(j.as, (ALIAS_LABEL[j.as] || jd.label) + ' (looked up)', jd.fields, null);
|
|
49
|
-
});
|
|
50
|
-
return groups;
|
|
51
|
-
}
|
|
52
|
-
function flatFields(d) { return [].concat.apply([], fieldChoices(d).map(function (g) { return g.fields; })); }
|
|
53
|
-
function fieldInfo(d, value) {
|
|
54
|
-
var f = flatFields(d).filter(function (x) { return x.value === value; })[0];
|
|
55
|
-
return f || { value: value, label: value, type: 'string', values: [] };
|
|
56
|
-
}
|
|
57
|
-
function fieldSelect(d, value, onChange, opts) {
|
|
58
|
-
opts = opts || {};
|
|
59
|
-
var s = el('select', { className: 'input' });
|
|
60
|
-
if (opts.empty) s.appendChild(el('option', { value: '', text: opts.empty }));
|
|
61
|
-
var found = false;
|
|
62
|
-
fieldChoices(d, opts.counting).forEach(function (g) {
|
|
63
|
-
s.appendChild(el('optgroup', { label: g.label }, g.fields.map(function (f) { if (f.value === value) found = true; return el('option', { value: f.value, text: f.label }); })));
|
|
64
|
-
});
|
|
65
|
-
if (value && !found) s.insertBefore(el('option', { value: value, text: value }), s.firstChild);
|
|
66
|
-
s.value = value || '';
|
|
67
|
-
s.addEventListener('change', function () { onChange(s.value); });
|
|
68
|
-
return s;
|
|
69
|
-
}
|
|
70
|
-
function isSourceId(path) { return /(^|\.)source\.id$|(^|\.)sourceId$/.test(path); }
|
|
71
|
-
function isSourceName(path) { return /(^|\.)source\.name$|(^|\.)sourceName$|(^|\.)source\.displayableName$/.test(path); }
|
|
72
|
-
function formatFor(type) { return type === 'date' ? 'date' : type === 'boolean' ? 'boolean' : type === 'number' ? 'number' : type === 'list' ? 'list' : undefined; }
|
|
73
|
-
|
|
74
|
-
// operators shown for each kind of field
|
|
75
|
-
var OPS_BY_TYPE = {
|
|
76
|
-
string: [['eq', 'is'], ['ne', 'is not'], ['in', 'is one of'], ['notIn', 'is none of'], ['contains', 'contains'], ['notContains', 'does not contain'], ['startsWith', 'starts with'], ['endsWith', 'ends with'], ['exists', 'has a value'], ['missing', 'is empty'], ['matches', 'matches pattern']],
|
|
77
|
-
list: [['eq', 'includes'], ['in', 'includes one of'], ['notIn', 'includes none of'], ['contains', 'has an item containing'], ['exists', 'is not empty'], ['missing', 'is empty']],
|
|
78
|
-
boolean: [['isTrue', 'is Yes'], ['isFalse', 'is No'], ['missing', 'is empty']],
|
|
79
|
-
number: [['eq', '='], ['ne', '≠'], ['gt', '>'], ['gte', '≥'], ['lt', '<'], ['lte', '≤'], ['exists', 'has a value'], ['missing', 'is empty']],
|
|
80
|
-
date: [['newerThanDays', 'in the last (days)'], ['olderThanDays', 'more than (days) ago'], ['exists', 'has a value'], ['missing', 'is empty']]
|
|
81
|
-
};
|
|
82
|
-
function opsFor(type) { return OPS_BY_TYPE[type] || OPS_BY_TYPE.string; }
|
|
83
|
-
function needsValue(op) { var o = state.catalog.operators.filter(function (x) { return x.op === op; })[0]; return o ? o.needsValue : true; }
|
|
84
|
-
var ASK = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;
|
|
85
|
-
|
|
1
|
+
// ---------- fields ----------
|
|
2
|
+
var ALIAS_LABEL = { profile: 'Identity profile', mapping: 'Mapping', identity: 'Person', account: 'Account', access: 'Access item', entitlement: 'Entitlement', source: 'Source', role: 'Role', accessProfile: 'Access profile', event: 'Audit event', activity: 'Account activity', campaign: 'Campaign', item: 'Review item', request: 'Access request', request2: 'Request' };
|
|
3
|
+
function datasetOf(name) { return state.catalog.datasets.filter(function (d) { return d.name === name; })[0]; }
|
|
4
|
+
function ensureDisc(dataset) {
|
|
5
|
+
if (state.disc[dataset]) return;
|
|
6
|
+
state.disc[dataset] = { loading: true };
|
|
7
|
+
api('/api/discover/' + dataset).then(function (r) { state.disc[dataset] = r; }, function (e) { state.disc[dataset] = { error: errorText(e) }; })
|
|
8
|
+
.then(function () {
|
|
9
|
+
if (state.page === 'build' && state.bt && state.bt.tab === 'roles' && dataset === 'identities' && !state.imp.busy) { renderBuild(); return; }
|
|
10
|
+
if (!$('roles').classList.contains('hidden')) { if (dataset === 'identities' && ((state.roleTab === 'impact' && !state.imp.busy) || (state.roleTab === 'mining' && !state.mn.busy))) renderRoles(); return; }
|
|
11
|
+
if (state.current && !state.running && state.tab !== 'yaml' && state.current.def.from.dataset === dataset) renderMain();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** Field choices grouped by alias. Each field: { value, label, type, values, path }. */
|
|
15
|
+
function fieldChoices(d, forCounting) {
|
|
16
|
+
var ds = datasetOf(d.from.dataset);
|
|
17
|
+
if (!ds) return [];
|
|
18
|
+
var disc = state.disc[d.from.dataset];
|
|
19
|
+
var discOk = disc && disc.fields;
|
|
20
|
+
var groups = [];
|
|
21
|
+
function addGroup(alias, label, catalog, found) {
|
|
22
|
+
var byPath = {};
|
|
23
|
+
(found || []).forEach(function (f) { byPath[f.path] = f; });
|
|
24
|
+
var known = [], extra = [];
|
|
25
|
+
(catalog || []).forEach(function (f) {
|
|
26
|
+
if (f.type === 'object' || (forCounting && f.type === 'list' && !f.expandable && f.path !== 'tags')) return;
|
|
27
|
+
if (f.expandable) return;
|
|
28
|
+
var df = byPath[f.path];
|
|
29
|
+
known.push({ value: alias + '.' + f.path, label: f.label, type: f.type, values: df ? df.values : [], path: f.path });
|
|
30
|
+
});
|
|
31
|
+
(found || []).forEach(function (f) {
|
|
32
|
+
if (f.known || f.type === 'object') return;
|
|
33
|
+
if ((catalog || []).some(function (c) { return c.path === f.path || f.path.indexOf(c.path + '.') === 0 && c.expandable; })) return;
|
|
34
|
+
extra.push({ value: alias + '.' + f.path, label: f.label, type: f.type, values: f.values, path: f.path });
|
|
35
|
+
});
|
|
36
|
+
if (known.length) groups.push({ label: label, fields: known });
|
|
37
|
+
if (extra.length) groups.push({ label: label + ': more found in your tenant', fields: extra });
|
|
38
|
+
}
|
|
39
|
+
var root = d.from.as || ds.alias;
|
|
40
|
+
addGroup(root, ALIAS_LABEL[root] || ds.label, ds.fields, discOk ? disc.fields : null);
|
|
41
|
+
if (d.expand) {
|
|
42
|
+
var key = d.expand.path.split('.').slice(1).join('.');
|
|
43
|
+
var items = ds.itemFields && ds.itemFields[key];
|
|
44
|
+
if (items) addGroup(d.expand.as, ALIAS_LABEL[d.expand.as] || d.expand.as, items, discOk && disc.items ? disc.items[key] : null);
|
|
45
|
+
}
|
|
46
|
+
(d.joins || []).forEach(function (j) {
|
|
47
|
+
var jd = datasetOf(j.dataset);
|
|
48
|
+
if (jd) addGroup(j.as, (ALIAS_LABEL[j.as] || jd.label) + ' (looked up)', jd.fields, null);
|
|
49
|
+
});
|
|
50
|
+
return groups;
|
|
51
|
+
}
|
|
52
|
+
function flatFields(d) { return [].concat.apply([], fieldChoices(d).map(function (g) { return g.fields; })); }
|
|
53
|
+
function fieldInfo(d, value) {
|
|
54
|
+
var f = flatFields(d).filter(function (x) { return x.value === value; })[0];
|
|
55
|
+
return f || { value: value, label: value, type: 'string', values: [] };
|
|
56
|
+
}
|
|
57
|
+
function fieldSelect(d, value, onChange, opts) {
|
|
58
|
+
opts = opts || {};
|
|
59
|
+
var s = el('select', { className: 'input' });
|
|
60
|
+
if (opts.empty) s.appendChild(el('option', { value: '', text: opts.empty }));
|
|
61
|
+
var found = false;
|
|
62
|
+
fieldChoices(d, opts.counting).forEach(function (g) {
|
|
63
|
+
s.appendChild(el('optgroup', { label: g.label }, g.fields.map(function (f) { if (f.value === value) found = true; return el('option', { value: f.value, text: f.label }); })));
|
|
64
|
+
});
|
|
65
|
+
if (value && !found) s.insertBefore(el('option', { value: value, text: value }), s.firstChild);
|
|
66
|
+
s.value = value || '';
|
|
67
|
+
s.addEventListener('change', function () { onChange(s.value); });
|
|
68
|
+
return s;
|
|
69
|
+
}
|
|
70
|
+
function isSourceId(path) { return /(^|\.)source\.id$|(^|\.)sourceId$/.test(path); }
|
|
71
|
+
function isSourceName(path) { return /(^|\.)source\.name$|(^|\.)sourceName$|(^|\.)source\.displayableName$/.test(path); }
|
|
72
|
+
function formatFor(type) { return type === 'date' ? 'date' : type === 'boolean' ? 'boolean' : type === 'number' ? 'number' : type === 'list' ? 'list' : undefined; }
|
|
73
|
+
|
|
74
|
+
// operators shown for each kind of field
|
|
75
|
+
var OPS_BY_TYPE = {
|
|
76
|
+
string: [['eq', 'is'], ['ne', 'is not'], ['in', 'is one of'], ['notIn', 'is none of'], ['contains', 'contains'], ['notContains', 'does not contain'], ['startsWith', 'starts with'], ['endsWith', 'ends with'], ['exists', 'has a value'], ['missing', 'is empty'], ['matches', 'matches pattern']],
|
|
77
|
+
list: [['eq', 'includes'], ['in', 'includes one of'], ['notIn', 'includes none of'], ['contains', 'has an item containing'], ['exists', 'is not empty'], ['missing', 'is empty']],
|
|
78
|
+
boolean: [['isTrue', 'is Yes'], ['isFalse', 'is No'], ['missing', 'is empty']],
|
|
79
|
+
number: [['eq', '='], ['ne', '≠'], ['gt', '>'], ['gte', '≥'], ['lt', '<'], ['lte', '≤'], ['exists', 'has a value'], ['missing', 'is empty']],
|
|
80
|
+
date: [['newerThanDays', 'in the last (days)'], ['olderThanDays', 'more than (days) ago'], ['exists', 'has a value'], ['missing', 'is empty']]
|
|
81
|
+
};
|
|
82
|
+
function opsFor(type) { return OPS_BY_TYPE[type] || OPS_BY_TYPE.string; }
|
|
83
|
+
function needsValue(op) { var o = state.catalog.operators.filter(function (x) { return x.op === op; })[0]; return o ? o.needsValue : true; }
|
|
84
|
+
var ASK = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;
|
|
85
|
+
|