identityscope 0.0.0-stage → 0.28.3
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 -0
- package/README.md +917 -3
- package/SECURITY.md +56 -0
- package/dist/core/audit-readiness.d.ts +158 -0
- package/dist/core/audit-readiness.js +357 -0
- package/dist/core/audit-readiness.js.map +1 -0
- package/dist/core/certs.d.ts +68 -0
- package/dist/core/certs.js +132 -0
- package/dist/core/certs.js.map +1 -0
- package/dist/core/checks.d.ts +133 -0
- package/dist/core/checks.js +512 -0
- package/dist/core/checks.js.map +1 -0
- package/dist/core/cloud-rules.d.ts +20 -0
- package/dist/core/cloud-rules.js +44 -0
- package/dist/core/cloud-rules.js.map +1 -0
- package/dist/core/compare.d.ts +45 -0
- package/dist/core/compare.js +372 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/conditions.d.ts +10 -0
- package/dist/core/conditions.js +201 -0
- package/dist/core/conditions.js.map +1 -0
- package/dist/core/credentials.d.ts +71 -0
- package/dist/core/credentials.js +211 -0
- package/dist/core/credentials.js.map +1 -0
- package/dist/core/datasets.d.ts +53 -0
- package/dist/core/datasets.js +596 -0
- package/dist/core/datasets.js.map +1 -0
- package/dist/core/definition.d.ts +32 -0
- package/dist/core/definition.js +301 -0
- package/dist/core/definition.js.map +1 -0
- package/dist/core/discover.d.ts +32 -0
- package/dist/core/discover.js +105 -0
- package/dist/core/discover.js.map +1 -0
- package/dist/core/engine.d.ts +18 -0
- package/dist/core/engine.js +290 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/fields.d.ts +16 -0
- package/dist/core/fields.js +132 -0
- package/dist/core/fields.js.map +1 -0
- package/dist/core/governance-trail.d.ts +211 -0
- package/dist/core/governance-trail.js +557 -0
- package/dist/core/governance-trail.js.map +1 -0
- package/dist/core/http-transport.d.ts +66 -0
- package/dist/core/http-transport.js +247 -0
- package/dist/core/http-transport.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/insights.d.ts +176 -0
- package/dist/core/insights.js +417 -0
- package/dist/core/insights.js.map +1 -0
- package/dist/core/joiner-evidence.d.ts +98 -0
- package/dist/core/joiner-evidence.js +254 -0
- package/dist/core/joiner-evidence.js.map +1 -0
- package/dist/core/lab/credential-map.d.ts +50 -0
- package/dist/core/lab/credential-map.js +163 -0
- package/dist/core/lab/credential-map.js.map +1 -0
- package/dist/core/lab/javadate.d.ts +7 -0
- package/dist/core/lab/javadate.js +307 -0
- package/dist/core/lab/javadate.js.map +1 -0
- package/dist/core/lab/jsonpath.d.ts +11 -0
- package/dist/core/lab/jsonpath.js +273 -0
- package/dist/core/lab/jsonpath.js.map +1 -0
- package/dist/core/lab/policy-preview.d.ts +43 -0
- package/dist/core/lab/policy-preview.js +78 -0
- package/dist/core/lab/policy-preview.js.map +1 -0
- package/dist/core/lab/rfc5646.d.ts +2 -0
- package/dist/core/lab/rfc5646.js +421 -0
- package/dist/core/lab/rfc5646.js.map +1 -0
- package/dist/core/lab/transform-impact.d.ts +63 -0
- package/dist/core/lab/transform-impact.js +138 -0
- package/dist/core/lab/transform-impact.js.map +1 -0
- package/dist/core/lab/transform-people.d.ts +61 -0
- package/dist/core/lab/transform-people.js +132 -0
- package/dist/core/lab/transform-people.js.map +1 -0
- package/dist/core/lab/transforms.d.ts +79 -0
- package/dist/core/lab/transforms.js +738 -0
- package/dist/core/lab/transforms.js.map +1 -0
- package/dist/core/lab/velocity.d.ts +33 -0
- package/dist/core/lab/velocity.js +874 -0
- package/dist/core/lab/velocity.js.map +1 -0
- package/dist/core/lab/workflow-health.d.ts +80 -0
- package/dist/core/lab/workflow-health.js +234 -0
- package/dist/core/lab/workflow-health.js.map +1 -0
- package/dist/core/lab/workflows.d.ts +87 -0
- package/dist/core/lab/workflows.js +568 -0
- package/dist/core/lab/workflows.js.map +1 -0
- package/dist/core/lifecycle-gaps.d.ts +192 -0
- package/dist/core/lifecycle-gaps.js +389 -0
- package/dist/core/lifecycle-gaps.js.map +1 -0
- package/dist/core/logs.d.ts +145 -0
- package/dist/core/logs.js +342 -0
- package/dist/core/logs.js.map +1 -0
- package/dist/core/lookup.d.ts +129 -0
- package/dist/core/lookup.js +289 -0
- package/dist/core/lookup.js.map +1 -0
- package/dist/core/model-insights.d.ts +247 -0
- package/dist/core/model-insights.js +474 -0
- package/dist/core/model-insights.js.map +1 -0
- package/dist/core/narrow.d.ts +23 -0
- package/dist/core/narrow.js +137 -0
- package/dist/core/narrow.js.map +1 -0
- package/dist/core/nerm.d.ts +154 -0
- package/dist/core/nerm.js +397 -0
- package/dist/core/nerm.js.map +1 -0
- package/dist/core/operations-watch.d.ts +232 -0
- package/dist/core/operations-watch.js +491 -0
- package/dist/core/operations-watch.js.map +1 -0
- package/dist/core/output/csv.d.ts +6 -0
- package/dist/core/output/csv.js +22 -0
- package/dist/core/output/csv.js.map +1 -0
- package/dist/core/output/html.d.ts +11 -0
- package/dist/core/output/html.js +66 -0
- package/dist/core/output/html.js.map +1 -0
- package/dist/core/output/xlsx.d.ts +3 -0
- package/dist/core/output/xlsx.js +130 -0
- package/dist/core/output/xlsx.js.map +1 -0
- package/dist/core/output/zip.d.ts +16 -0
- package/dist/core/output/zip.js +106 -0
- package/dist/core/output/zip.js.map +1 -0
- package/dist/core/ownership.d.ts +39 -0
- package/dist/core/ownership.js +100 -0
- package/dist/core/ownership.js.map +1 -0
- package/dist/core/patterns.d.ts +11 -0
- package/dist/core/patterns.js +31 -0
- package/dist/core/patterns.js.map +1 -0
- package/dist/core/preview.d.ts +96 -0
- package/dist/core/preview.js +173 -0
- package/dist/core/preview.js.map +1 -0
- package/dist/core/roles.d.ts +125 -0
- package/dist/core/roles.js +420 -0
- package/dist/core/roles.js.map +1 -0
- package/dist/core/tenant.d.ts +67 -0
- package/dist/core/tenant.js +194 -0
- package/dist/core/tenant.js.map +1 -0
- package/dist/core/threat-signals.d.ts +112 -0
- package/dist/core/threat-signals.js +250 -0
- package/dist/core/threat-signals.js.map +1 -0
- package/dist/core/threat-watch.d.ts +144 -0
- package/dist/core/threat-watch.js +282 -0
- package/dist/core/threat-watch.js.map +1 -0
- package/dist/core/transport.d.ts +82 -0
- package/dist/core/transport.js +312 -0
- package/dist/core/transport.js.map +1 -0
- package/dist/core/types.d.ts +137 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/warnings.d.ts +236 -0
- package/dist/core/warnings.js +504 -0
- package/dist/core/warnings.js.map +1 -0
- package/dist/demo/tenant.d.ts +1572 -0
- package/dist/demo/tenant.js +1023 -0
- package/dist/demo/tenant.js.map +1 -0
- package/dist/node/attribute-history.d.ts +22 -0
- package/dist/node/attribute-history.js +86 -0
- package/dist/node/attribute-history.js.map +1 -0
- package/dist/node/changes.d.ts +20 -0
- package/dist/node/changes.js +78 -0
- package/dist/node/changes.js.map +1 -0
- package/dist/node/cli.d.ts +2 -0
- package/dist/node/cli.js +291 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config.d.ts +72 -0
- package/dist/node/config.js +203 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/credentials.d.ts +13 -0
- package/dist/node/credentials.js +24 -0
- package/dist/node/credentials.js.map +1 -0
- package/dist/node/delivery.d.ts +10 -0
- package/dist/node/delivery.js +105 -0
- package/dist/node/delivery.js.map +1 -0
- package/dist/node/doctor.d.ts +2 -0
- package/dist/node/doctor.js +151 -0
- package/dist/node/doctor.js.map +1 -0
- package/dist/node/drift.d.ts +31 -0
- package/dist/node/drift.js +56 -0
- package/dist/node/drift.js.map +1 -0
- package/dist/node/evidence.d.ts +42 -0
- package/dist/node/evidence.js +129 -0
- package/dist/node/evidence.js.map +1 -0
- package/dist/node/exceptions.d.ts +30 -0
- package/dist/node/exceptions.js +83 -0
- package/dist/node/exceptions.js.map +1 -0
- package/dist/node/history.d.ts +35 -0
- package/dist/node/history.js +74 -0
- package/dist/node/history.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +8 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/keep.d.ts +9 -0
- package/dist/node/keep.js +39 -0
- package/dist/node/keep.js.map +1 -0
- package/dist/node/loader.d.ts +7 -0
- package/dist/node/loader.js +35 -0
- package/dist/node/loader.js.map +1 -0
- package/dist/node/log-files.d.ts +16 -0
- package/dist/node/log-files.js +93 -0
- package/dist/node/log-files.js.map +1 -0
- package/dist/node/monthly.d.ts +41 -0
- package/dist/node/monthly.js +108 -0
- package/dist/node/monthly.js.map +1 -0
- package/dist/node/oauth-login.d.ts +45 -0
- package/dist/node/oauth-login.js +121 -0
- package/dist/node/oauth-login.js.map +1 -0
- package/dist/node/packs.d.ts +32 -0
- package/dist/node/packs.js +43 -0
- package/dist/node/packs.js.map +1 -0
- package/dist/node/privileged-seen.d.ts +11 -0
- package/dist/node/privileged-seen.js +41 -0
- package/dist/node/privileged-seen.js.map +1 -0
- package/dist/node/recipients.d.ts +17 -0
- package/dist/node/recipients.js +51 -0
- package/dist/node/recipients.js.map +1 -0
- package/dist/node/runner.d.ts +51 -0
- package/dist/node/runner.js +298 -0
- package/dist/node/runner.js.map +1 -0
- package/dist/node/runtime.d.ts +12 -0
- package/dist/node/runtime.js +13 -0
- package/dist/node/runtime.js.map +1 -0
- package/dist/node/schedules.d.ts +87 -0
- package/dist/node/schedules.js +141 -0
- package/dist/node/schedules.js.map +1 -0
- package/dist/node/secrets.d.ts +37 -0
- package/dist/node/secrets.js +219 -0
- package/dist/node/secrets.js.map +1 -0
- package/dist/node/support.d.ts +14 -0
- package/dist/node/support.js +133 -0
- package/dist/node/support.js.map +1 -0
- package/dist/node/tenants.d.ts +93 -0
- package/dist/node/tenants.js +255 -0
- package/dist/node/tenants.js.map +1 -0
- package/dist/node/ui-page.d.ts +1 -0
- package/dist/node/ui-page.js +3 -0
- package/dist/node/ui-page.js.map +1 -0
- package/dist/node/ui-server.d.ts +48 -0
- package/dist/node/ui-server.js +2665 -0
- package/dist/node/ui-server.js.map +1 -0
- package/dist/node/write.d.ts +9 -0
- package/dist/node/write.js +53 -0
- package/dist/node/write.js.map +1 -0
- package/dist/reports/builtin.generated.d.ts +1 -0
- package/dist/reports/builtin.generated.js +49 -0
- package/dist/reports/builtin.generated.js.map +1 -0
- package/dist/reports/library.d.ts +6 -0
- package/dist/reports/library.js +18 -0
- package/dist/reports/library.js.map +1 -0
- package/launcher/IdentityScope.cmd +11 -0
- package/package.json +69 -4
- package/reports/access-profile-members.yaml +29 -0
- package/reports/access-profile-membership-counts.yaml +17 -0
- package/reports/access-profiles-without-owner.yaml +16 -0
- package/reports/access-request-audit-trail.yaml +36 -0
- package/reports/accounts-by-source.yaml +19 -0
- package/reports/active-identities-without-manager.yaml +22 -0
- package/reports/aggregation-failures.yaml +29 -0
- package/reports/aggregation-history.yaml +27 -0
- package/reports/all-sources.yaml +16 -0
- package/reports/application-accounts.yaml +32 -0
- package/reports/application-entitlements.yaml +31 -0
- package/reports/campaign-progress.yaml +23 -0
- package/reports/certification-decisions.yaml +31 -0
- package/reports/direct-reports-per-manager.yaml +20 -0
- package/reports/disabled-accounts-of-active-people.yaml +33 -0
- package/reports/duplicate-emails.yaml +16 -0
- package/reports/entitlement-holders.yaml +35 -0
- package/reports/entitlements-held-by-inactive-identities.yaml +31 -0
- package/reports/entitlements-without-owner.yaml +28 -0
- package/reports/identities-by-lifecycle-state.yaml +15 -0
- package/reports/identities-missing-key-attributes.yaml +27 -0
- package/reports/identities-with-processing-errors.yaml +19 -0
- package/reports/identity-attribute-mappings.yaml +27 -0
- package/reports/machine-accounts.yaml +28 -0
- package/reports/managers-and-direct-reports.yaml +23 -0
- package/reports/most-access.yaml +18 -0
- package/reports/new-identities.yaml +24 -0
- package/reports/old-passwords.yaml +35 -0
- package/reports/pending-reviews-by-reviewer.yaml +20 -0
- package/reports/person-access.yaml +31 -0
- package/reports/privileged-access.yaml +29 -0
- package/reports/provisioning-error-causes.yaml +27 -0
- package/reports/provisioning-errors.yaml +32 -0
- package/reports/provisioning-failures.yaml +28 -0
- package/reports/recent-access-requests.yaml +22 -0
- package/reports/recent-activity.yaml +32 -0
- package/reports/recent-leavers.yaml +34 -0
- package/reports/role-members.yaml +29 -0
- package/reports/role-membership-counts.yaml +18 -0
- package/reports/roles-without-owner.yaml +17 -0
- package/reports/sources-needing-attention.yaml +23 -0
- package/reports/stuck-access-requests.yaml +29 -0
- package/reports/team-access.yaml +30 -0
- package/reports/terminated-users-with-active-accounts.yaml +46 -0
- package/reports/uncorrelated-accounts.yaml +38 -0
- package/ui/js/00-setup.js +6 -0
- package/ui/js/01-small-helpers.js +143 -0
- package/ui/js/02-connection.js +150 -0
- package/ui/js/03-health-check.js +17 -0
- package/ui/js/04-library.js +135 -0
- package/ui/js/05-pickers.js +163 -0
- package/ui/js/06-report-view.js +157 -0
- package/ui/js/07-fields.js +85 -0
- package/ui/js/08-designer.js +360 -0
- package/ui/js/09-yaml.js +22 -0
- package/ui/js/10-instant-check.js +171 -0
- package/ui/js/11-lookup.js +161 -0
- package/ui/js/12-tenant.js +115 -0
- package/ui/js/13-source-configuration-and-diagnostics.js +64 -0
- package/ui/js/14-certifications.js +68 -0
- package/ui/js/15-monthly-report.js +24 -0
- package/ui/js/16-ownership.js +39 -0
- package/ui/js/17-compare-tenants.js +102 -0
- package/ui/js/18-audit.js +181 -0
- package/ui/js/19-insights.js +108 -0
- package/ui/js/20-role-mining.js +35 -0
- package/ui/js/21-share-reports.js +45 -0
- package/ui/js/22-partner-overview-all-customer-tenants.js +228 -0
- package/ui/js/23-in-app-guidance.js +217 -0
- package/ui/js/24-role-tools.js +220 -0
- package/ui/js/25-schedules.js +264 -0
- package/ui/js/26-start.js +7 -0
- package/ui/js/27-warnings.js +224 -0
- package/ui/js/28-audit-readiness.js +99 -0
- package/ui/js/29-lifecycle.js +182 -0
- package/ui/js/30-labs.js +265 -0
- package/ui/js/31-build.js +203 -0
- package/ui/js/32-lab-examples.js +148 -0
- package/ui/js/33-finder.js +89 -0
- package/ui/js/34-governance.js +129 -0
- package/ui/js/35-watch.js +266 -0
- package/ui/js/36-model.js +247 -0
- package/ui/js/37-logs-and-watch.js +224 -0
- package/ui/shell.html +112 -0
- package/ui/style.css +350 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// ---------- role tools ----------
|
|
2
|
+
function pollJob(id, onProgress, onDone, onError, misses) {
|
|
3
|
+
state.activeJob = id;
|
|
4
|
+
api('/api/jobs/' + id).then(function (s) {
|
|
5
|
+
if (s.state === 'running') { onProgress(s.progress + ' · ' + s.seconds + 's'); setTimeout(function () { pollJob(id, onProgress, onDone, onError); }, 800); }
|
|
6
|
+
else if (s.state === 'error') onError(s.error);
|
|
7
|
+
else onDone(s);
|
|
8
|
+
}).catch(function (e) {
|
|
9
|
+
// The local program may be busy for a moment: try again for about a minute before giving up.
|
|
10
|
+
var n = (misses || 0) + 1;
|
|
11
|
+
if (e && e.name === 'TypeError' && n <= 20) { onProgress('Waiting for IdentityScope to answer...'); setTimeout(function () { pollJob(id, onProgress, onDone, onError, n); }, 3000); }
|
|
12
|
+
else onError(errorText(e));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function downloads(job) {
|
|
16
|
+
var dl = function (f, label, primary) { return el('a', { className: 'btn sm' + (primary ? ' primary' : ''), href: '/api/jobs/' + job + '/download?format=' + f + '&k=' + encodeURIComponent(KEY), download: '' }, icon('download'), label); };
|
|
17
|
+
return el('div', { className: 'bar' }, dl('xlsx', 'Excel', true), dl('csv', 'CSV'), dl('html', 'HTML'));
|
|
18
|
+
}
|
|
19
|
+
state.roleTab = state.roleTab || 'compare';
|
|
20
|
+
state.cmp = { roles: [] };
|
|
21
|
+
state.imp = { roleId: '', criteria: null, loaded: null };
|
|
22
|
+
|
|
23
|
+
function renderRoles() {
|
|
24
|
+
// The role change preview also lives on the Build & test page: redraw that page when it is open.
|
|
25
|
+
if (state.page === 'build') { renderBuild(); return; }
|
|
26
|
+
var outer = $('roles');
|
|
27
|
+
outer.textContent = '';
|
|
28
|
+
var w = el('div', { className: 'wrap', style: 'max-width:1180px' });
|
|
29
|
+
outer.appendChild(w);
|
|
30
|
+
w.appendChild(el('div', { className: 'rhead', style: 'margin-bottom:4px' }, catIcon('Access model'),
|
|
31
|
+
el('div', {}, el('h2', { text: 'Role tools' }), el('p', { className: 'desc', text: 'Understand roles before you change them. Read-only: nothing is changed in ISC.' }))));
|
|
32
|
+
var tabs = el('div', { className: 'tabs' });
|
|
33
|
+
[['compare', 'Compare roles', 'cols'], ['impact', 'Preview a role change', 'eye'], ['mining', 'Find candidate roles', 'search']].forEach(function (t) {
|
|
34
|
+
tabs.appendChild(el('button', { className: 'tab' + (state.roleTab === t[0] ? ' active' : ''), onclick: function () { state.roleTab = t[0]; renderRoles(); } }, icon(t[2]), t[1]));
|
|
35
|
+
});
|
|
36
|
+
w.appendChild(tabs);
|
|
37
|
+
if (state.roleTab === 'compare') renderCompare(w); else if (state.roleTab === 'mining') renderMining(w); else renderImpact(w);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function renderCompare(w) {
|
|
41
|
+
var c = state.cmp;
|
|
42
|
+
var card = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Pick two to six roles' })));
|
|
43
|
+
card.appendChild(el('div', { className: 'runbar', style: 'margin-top:0;padding-top:0;border-top:none' },
|
|
44
|
+
el('label', { className: 'field', style: 'flex:1;min-width:320px' }, el('span', { className: 'lbl', text: 'Roles' }), picker({ options: loadPick('roles'), multiple: true, value: c.roles, placeholder: 'Pick roles', onChange: function (v) { c.roles = v; } })),
|
|
45
|
+
el('button', { className: 'btn primary', onclick: function () {
|
|
46
|
+
c.error = null; c.data = null; c.busy = 'Starting...'; renderRoles();
|
|
47
|
+
api('/api/roles/compare', 'POST', { roles: c.roles }).then(function (r) {
|
|
48
|
+
c.job = r.job;
|
|
49
|
+
pollJob(r.job, function (m) { c.busy = m; var p = $('cmp-progress'); if (p) p.textContent = m; }, function (s) { c.busy = null; c.data = s.extra; renderRoles(); }, function (e) { c.busy = null; c.error = e; renderRoles(); });
|
|
50
|
+
}).catch(function (e) { c.busy = null; c.error = errorText(e); renderRoles(); });
|
|
51
|
+
} }, icon('cols'), 'Compare')));
|
|
52
|
+
w.appendChild(card);
|
|
53
|
+
if (c.busy) { w.appendChild(el('section', { className: 'card' }, el('div', { className: 'progress', style: 'margin:0' }, el('span', { className: 'spinner' }), el('span', { id: 'cmp-progress', text: c.busy, style: 'flex:1' }), stopButton()))); return; }
|
|
54
|
+
if (c.error) { w.appendChild(el('div', { className: 'error', text: c.error })); return; }
|
|
55
|
+
var d = c.data;
|
|
56
|
+
if (!d) { w.appendChild(el('div', { className: 'empty' }, el('b', { text: 'Which roles overlap?' }), 'Compare roles to find duplicates to merge, or to explain how two job roles differ.')); return; }
|
|
57
|
+
w.appendChild(el('div', { className: 'rolecards' }, d.roles.map(function (r) {
|
|
58
|
+
return el('div', { className: 'rolecard' }, el('h4', { text: r.name }),
|
|
59
|
+
el('div', { className: 'kv' }, el('span', {}, el('b', { text: fmtNum(r.members) }), ' members'), el('span', {}, el('b', { text: String(r.accessProfiles.length) }), ' access profiles'), el('span', {}, el('b', { text: String(r.effectiveEntitlements) }), ' entitlements')),
|
|
60
|
+
el('div', { className: 'kv', style: 'margin-top:4px' }, el('span', { text: 'Owner: ' + (r.owner || 'none') }), el('span', { text: r.enabled === false ? 'Disabled' : 'Enabled' }), el('span', { text: r.requestable ? 'Requestable' : 'Not requestable' })),
|
|
61
|
+
el('div', { className: 'crit', text: r.criteriaText }));
|
|
62
|
+
})));
|
|
63
|
+
var stats = el('section', { className: 'card' });
|
|
64
|
+
if (d.similarity !== undefined && d.similarity !== null) {
|
|
65
|
+
var pct = Math.round(d.similarity * 100);
|
|
66
|
+
stats.appendChild(el('div', { className: 'bar', style: 'justify-content:space-between' }, el('b', { text: 'Entitlement overlap of the first two roles: ' + pct + '%' }),
|
|
67
|
+
el('span', { className: 'muted small', text: pct >= 80 ? 'Very similar: candidates to merge.' : pct >= 40 ? 'Partly overlapping.' : 'Mostly different.' })));
|
|
68
|
+
stats.appendChild(el('div', { className: 'meter' }, el('span', { style: 'width:' + pct + '%' })));
|
|
69
|
+
}
|
|
70
|
+
stats.appendChild(el('div', { className: 'kv', style: 'margin-top:6px' },
|
|
71
|
+
el('span', {}, el('b', { text: fmtNum(d.members.inAll) }), ' people hold all of them'),
|
|
72
|
+
d.roles.map(function (r, i) { return el('span', {}, el('b', { text: fmtNum(d.members.only[i]) }), ' only ' + r.name); })));
|
|
73
|
+
w.appendChild(stats);
|
|
74
|
+
var filter = c.filter || 'all';
|
|
75
|
+
var chips = el('div', { className: 'chips' }, [['all', 'All access'], ['shared', 'In every role'], ['diff', 'Differences']].map(function (f) {
|
|
76
|
+
return el('button', { className: 'chip' + (filter === f[0] ? ' active' : ''), text: f[1], onclick: function () { c.filter = f[0]; renderRoles(); } });
|
|
77
|
+
}));
|
|
78
|
+
var rows = d.items.filter(function (x) { var all = x.inRole.every(Boolean); return filter === 'all' || (filter === 'shared' ? all : !all); });
|
|
79
|
+
var tcard = el('section', { className: 'card', style: 'padding:16px' }, el('div', { className: 'bar', style: 'justify-content:space-between;margin-bottom:12px' }, chips, downloads(c.job)));
|
|
80
|
+
tcard.appendChild(el('div', { className: 'table-wrap' }, el('table', {},
|
|
81
|
+
el('thead', {}, el('tr', {}, ['Type', 'Access', 'Source'].concat(d.roles.map(function (r) { return r.name; }), ['Granted through']).map(function (h) { return el('th', { text: h, style: 'cursor:default' }); }))),
|
|
82
|
+
el('tbody', {}, rows.map(function (x) {
|
|
83
|
+
return el('tr', {}, el('td', { text: x.type }), el('td', { text: x.name }), el('td', { className: x.source ? '' : 'empty-cell', text: x.source || '—' }),
|
|
84
|
+
x.inRole.map(function (v) { return el('td', {}, el('span', { className: v ? 'tick' : 'dash', text: v ? '✓' : '—' })); }),
|
|
85
|
+
el('td', { className: 'muted', text: x.via.join(', ') }));
|
|
86
|
+
})))));
|
|
87
|
+
if (!rows.length) tcard.appendChild(el('div', { className: 'empty', text: 'Nothing in this view.' }));
|
|
88
|
+
w.appendChild(tcard);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var CRIT_OPS = [['EQUALS', 'is'], ['NOT_EQUALS', 'is not'], ['CONTAINS', 'contains'], ['DOES_NOT_CONTAIN', 'does not contain'], ['STARTS_WITH', 'starts with'], ['ENDS_WITH', 'ends with'], ['GREATER_THAN', '>'], ['LESS_THAN', '<'], ['GREATER_THAN_EQUALS', '≥'], ['LESS_THAN_EQUALS', '≤']];
|
|
92
|
+
function newLeaf() { return { operation: 'EQUALS', key: { type: 'IDENTITY', property: 'attribute.department', sourceId: null }, stringValue: '' }; }
|
|
93
|
+
function normalizeCriteria(c) {
|
|
94
|
+
if (!c) return { operation: 'AND', children: [newLeaf()] };
|
|
95
|
+
c = clone(c);
|
|
96
|
+
if (c.operation !== 'AND' && c.operation !== 'OR') return { operation: 'AND', children: [c] };
|
|
97
|
+
return c;
|
|
98
|
+
}
|
|
99
|
+
function identityAttrs() {
|
|
100
|
+
var disc = state.disc.identities;
|
|
101
|
+
if (!disc) { ensureDisc('identities'); return []; }
|
|
102
|
+
return (disc.fields || []).filter(function (f) { return f.path.indexOf('attributes.') === 0; }).map(function (f) { return { name: f.path.slice(11), values: f.values }; });
|
|
103
|
+
}
|
|
104
|
+
function critRow(leaf, onRemove) {
|
|
105
|
+
leaf.key = leaf.key || { type: 'IDENTITY', property: '', sourceId: null };
|
|
106
|
+
var attrs = identityAttrs();
|
|
107
|
+
var type = el('select', { className: 'input', 'aria-label': 'Condition on' }, el('option', { value: 'IDENTITY', text: 'Identity attribute' }), el('option', { value: 'ACCOUNT', text: 'Account attribute' }), el('option', { value: 'ENTITLEMENT', text: 'Entitlement' }));
|
|
108
|
+
type.value = leaf.key.type;
|
|
109
|
+
type.addEventListener('change', function () {
|
|
110
|
+
leaf.key.type = type.value;
|
|
111
|
+
leaf.key.sourceId = type.value === 'IDENTITY' ? null : leaf.key.sourceId;
|
|
112
|
+
if (type.value === 'ENTITLEMENT') leaf.key.property = 'attribute.memberOf';
|
|
113
|
+
renderRoles();
|
|
114
|
+
});
|
|
115
|
+
var src = leaf.key.type === 'IDENTITY' ? el('div', { className: 'muted small', style: 'padding:9px 4px', text: 'any source' })
|
|
116
|
+
: picker({ options: loadPick('sources'), value: leaf.key.sourceId || '', placeholder: 'Pick a source', onChange: function (v) { leaf.key.sourceId = v || null; } });
|
|
117
|
+
var dl1 = 'ca' + Math.random().toString(36).slice(2), dl2 = 'cv' + Math.random().toString(36).slice(2);
|
|
118
|
+
var name = (leaf.key.property || '').replace(/^attribute\./, '');
|
|
119
|
+
var prop = el('input', { className: 'input', value: name, placeholder: leaf.key.type === 'ENTITLEMENT' ? 'memberOf' : 'attribute name', list: leaf.key.type === 'IDENTITY' ? dl1 : null });
|
|
120
|
+
prop.addEventListener('input', function () { leaf.key.property = 'attribute.' + prop.value.trim(); });
|
|
121
|
+
prop.addEventListener('change', function () { renderRoles(); });
|
|
122
|
+
var op = el('select', { className: 'input', 'aria-label': 'Comparison' }, CRIT_OPS.map(function (o) { return el('option', { value: o[0], text: o[1] }); }));
|
|
123
|
+
op.value = leaf.operation;
|
|
124
|
+
op.addEventListener('change', function () { leaf.operation = op.value; });
|
|
125
|
+
var a = attrs.filter(function (x) { return x.name === name; })[0];
|
|
126
|
+
var val = el('input', { className: 'input', value: leaf.stringValue || '', placeholder: leaf.key.type === 'ENTITLEMENT' ? 'entitlement value, e.g. CN=VPN Users,...' : 'value', list: a && a.values.length ? dl2 : null });
|
|
127
|
+
val.addEventListener('input', function () { leaf.stringValue = val.value; });
|
|
128
|
+
return el('div', { className: 'crit-row' }, type, src, el('div', {}, prop, leaf.key.type === 'IDENTITY' ? el('datalist', { id: dl1 }, attrs.map(function (x) { return el('option', { value: x.name }); })) : null),
|
|
129
|
+
op, el('div', {}, val, a && a.values.length ? el('datalist', { id: dl2 }, a.values.map(function (v) { return el('option', { value: v }); })) : null),
|
|
130
|
+
el('button', { className: 'btn icon ghost', title: 'Remove', onclick: onRemove }, icon('x')));
|
|
131
|
+
}
|
|
132
|
+
function opSelect(node) {
|
|
133
|
+
var s = el('select', { className: 'input', style: 'width:auto;display:inline-block', 'aria-label': 'All or any' }, el('option', { value: 'AND', text: 'all' }), el('option', { value: 'OR', text: 'any' }));
|
|
134
|
+
s.value = node.operation;
|
|
135
|
+
s.addEventListener('change', function () { node.operation = s.value; });
|
|
136
|
+
return s;
|
|
137
|
+
}
|
|
138
|
+
function renderImpact(w) {
|
|
139
|
+
var im = state.imp;
|
|
140
|
+
if (!im.criteria) im.criteria = normalizeCriteria(null);
|
|
141
|
+
var card = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Which role?' })));
|
|
142
|
+
card.appendChild(el('div', { className: 'grid', style: 'grid-template-columns:minmax(280px,1fr) 2fr' },
|
|
143
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Role (leave empty to try criteria for a new role)' }),
|
|
144
|
+
picker({ options: loadPick('roles'), value: im.roleId, placeholder: 'New role', onChange: function (v) {
|
|
145
|
+
im.roleId = v; im.loaded = null; im.data = null; im.error = null;
|
|
146
|
+
if (!v) { im.criteria = normalizeCriteria(null); renderRoles(); return; }
|
|
147
|
+
api('/api/roles/' + v).then(function (r) { im.loaded = r; im.criteria = normalizeCriteria(r.criteria); renderRoles(); }).catch(function (e) { im.error = errorText(e); renderRoles(); });
|
|
148
|
+
} })),
|
|
149
|
+
im.loaded ? el('div', { className: 'field' }, el('span', { className: 'lbl', text: 'Current criteria' }), el('div', { className: 'crit', style: 'font:12.5px/1.5 ui-monospace,Consolas,monospace;background:var(--sunken);border-radius:8px;padding:9px 11px', text: im.loaded.criteriaText })) : el('div')));
|
|
150
|
+
if (im.loaded && im.loaded.membershipType === 'IDENTITY_LIST') card.appendChild(el('div', { className: 'note', text: 'This role is given to a fixed list of identities today. You can still try criteria to see who they would cover.' }));
|
|
151
|
+
w.appendChild(card);
|
|
152
|
+
|
|
153
|
+
var ed = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'New criteria' }), el('span', { className: 'muted small', text: 'compared without case, like ISC' })));
|
|
154
|
+
var root = im.criteria;
|
|
155
|
+
ed.appendChild(el('div', { className: 'joiner' }, 'Give the role to people who match', opSelect(root), 'of:'));
|
|
156
|
+
(root.children || []).forEach(function (ch, i) {
|
|
157
|
+
var removeMe = function () { root.children.splice(i, 1); renderRoles(); };
|
|
158
|
+
if (ch.operation === 'AND' || ch.operation === 'OR') {
|
|
159
|
+
var g = el('div', { className: 'crit-group' }, el('div', { className: 'joiner', style: 'justify-content:space-between' }, el('span', {}, 'A group matching ', opSelect(ch), ' of:'), el('button', { className: 'btn icon ghost', title: 'Remove group', onclick: removeMe }, icon('x'))));
|
|
160
|
+
(ch.children || []).forEach(function (leaf, j) { g.appendChild(critRow(leaf, function () { ch.children.splice(j, 1); if (!ch.children.length) root.children.splice(i, 1); renderRoles(); })); });
|
|
161
|
+
g.appendChild(el('button', { className: 'btn sm', onclick: function () { ch.children.push(newLeaf()); renderRoles(); } }, icon('plus'), 'Condition in this group'));
|
|
162
|
+
ed.appendChild(g);
|
|
163
|
+
} else ed.appendChild(critRow(ch, removeMe));
|
|
164
|
+
});
|
|
165
|
+
ed.appendChild(el('div', { className: 'bar', style: 'margin-top:6px' },
|
|
166
|
+
el('button', { className: 'btn', onclick: function () { root.children.push(newLeaf()); renderRoles(); } }, icon('plus'), 'Add condition'),
|
|
167
|
+
el('button', { className: 'btn', onclick: function () { root.children.push({ operation: root.operation === 'AND' ? 'OR' : 'AND', children: [newLeaf()] }); renderRoles(); } }, icon('plus'), 'Add group'),
|
|
168
|
+
el('span', { style: 'flex:1' }),
|
|
169
|
+
el('button', { className: 'btn ghost', onclick: function () { modal('Criteria as JSON (for the ISC role API, membership.criteria)', JSON.stringify(im.criteria, null, 2)); } }, icon('code'), 'Show JSON'),
|
|
170
|
+
el('button', { className: 'btn primary', onclick: function () {
|
|
171
|
+
im.error = null; im.data = null; im.busy = 'Starting...'; renderRoles();
|
|
172
|
+
api('/api/roles/impact', 'POST', { roleId: im.roleId || undefined, criteria: im.criteria }).then(function (r) {
|
|
173
|
+
im.job = r.job;
|
|
174
|
+
pollJob(r.job, function (m) { im.busy = m; var p = $('imp-progress'); if (p) p.textContent = m; }, function (s) { im.busy = null; im.data = s.extra; renderRoles(); }, function (e) { im.busy = null; im.error = e; renderRoles(); });
|
|
175
|
+
}).catch(function (e) { im.busy = null; im.error = errorText(e); renderRoles(); });
|
|
176
|
+
} }, icon('eye'), 'Preview who is affected')));
|
|
177
|
+
w.appendChild(ed);
|
|
178
|
+
if (im.busy) { w.appendChild(el('section', { className: 'card' }, el('div', { className: 'progress', style: 'margin:0' }, el('span', { className: 'spinner' }), el('span', { id: 'imp-progress', text: im.busy, style: 'flex:1' }), stopButton()))); return; }
|
|
179
|
+
if (im.error) { w.appendChild(el('div', { className: 'error', text: im.error })); return; }
|
|
180
|
+
var d = im.data;
|
|
181
|
+
if (!d) return;
|
|
182
|
+
var res = el('section', { className: 'card' });
|
|
183
|
+
res.appendChild(el('div', { className: 'card-h' }, el('h3', { text: 'What would change' }), downloads(im.job)));
|
|
184
|
+
res.appendChild(el('div', { className: 'crit', style: 'font:12.5px/1.5 ui-monospace,Consolas,monospace;background:var(--sunken);border-radius:8px;padding:9px 11px;margin-bottom:12px', text: 'New: ' + d.newCriteria }));
|
|
185
|
+
res.appendChild(el('div', { className: 'bigstats' },
|
|
186
|
+
el('div', { className: 'bigstat gain' }, el('b', { text: '+' + fmtNum(d.gain) }), el('span', { text: 'would gain the role' })),
|
|
187
|
+
el('div', { className: 'bigstat lose' }, el('b', { text: '−' + fmtNum(d.lose) }), el('span', { text: 'would lose it' })),
|
|
188
|
+
d.role ? el('div', { className: 'bigstat' }, el('b', { text: fmtNum(d.holdersNow) }), el('span', { text: 'hold it now' })) : null,
|
|
189
|
+
el('div', { className: 'bigstat' }, el('b', { text: fmtNum(d.matchNew) }), el('span', { text: 'match the new criteria' })),
|
|
190
|
+
d.keepOther ? el('div', { className: 'bigstat' }, el('b', { text: fmtNum(d.keepOther) }), el('span', { text: 'keep it (given another way)' })) : null,
|
|
191
|
+
el('div', { className: 'bigstat' }, el('b', { text: fmtNum(d.identitiesChecked) }), el('span', { text: 'identities checked' }))));
|
|
192
|
+
d.warnings.forEach(function (x) { res.appendChild(el('div', { className: 'note', text: x })); });
|
|
193
|
+
if (d.conditions && d.conditions.length) {
|
|
194
|
+
res.appendChild(el('div', { className: 'muted small', style: 'margin:14px 0 6px;font-weight:600', text: 'Each condition on its own (of ' + fmtNum(d.identitiesChecked) + ' identities)' }));
|
|
195
|
+
res.appendChild(el('div', { className: 'table-wrap', style: 'margin-bottom:14px' }, el('table', {},
|
|
196
|
+
el('thead', {}, el('tr', {}, ['Condition', 'People matching', 'People with any value', 'Most common values'].map(function (h) { return el('th', { text: h, style: 'cursor:default' }); }))),
|
|
197
|
+
el('tbody', {}, d.conditions.map(function (c) {
|
|
198
|
+
return el('tr', {}, el('td', { style: 'font-family:ui-monospace,Consolas,monospace;font-size:12.5px', text: c.text }),
|
|
199
|
+
el('td', { className: 'num' }, el('span', { className: c.matches ? '' : 'chg lose', text: fmtNum(c.matches) })),
|
|
200
|
+
el('td', { className: 'num', text: c.withValue === null ? '\u2014' : fmtNum(c.withValue) }),
|
|
201
|
+
el('td', { className: 'muted', text: c.topValues.map(function (v) { return v.value + ' (' + fmtNum(v.count) + ')'; }).join(', ') || '\u2014' }));
|
|
202
|
+
})))));
|
|
203
|
+
}
|
|
204
|
+
var filter = im.filter || 'all';
|
|
205
|
+
res.appendChild(el('div', { className: 'chips' }, [['all', 'Everyone affected'], ['gain', 'Gain'], ['lose', 'Lose'], ['keep-other', 'Keep (other way)']].map(function (f) {
|
|
206
|
+
return el('button', { className: 'chip' + (filter === f[0] ? ' active' : ''), text: f[1], onclick: function () { im.filter = f[0]; renderRoles(); } });
|
|
207
|
+
})));
|
|
208
|
+
var people = d.people.filter(function (p) { return filter === 'all' || p.change === filter; });
|
|
209
|
+
var label = { gain: 'Gains', lose: 'Loses', 'keep-other': 'Keeps' };
|
|
210
|
+
if (people.length) {
|
|
211
|
+
res.appendChild(el('div', { className: 'table-wrap' }, el('table', {},
|
|
212
|
+
el('thead', {}, el('tr', {}, ['Change', 'Person', 'Email', 'Department', 'Lifecycle state', 'Manager'].map(function (h) { return el('th', { text: h, style: 'cursor:default' }); }))),
|
|
213
|
+
el('tbody', {}, people.slice(0, 1000).map(function (p) {
|
|
214
|
+
return el('tr', {}, el('td', {}, el('span', { className: 'chg ' + p.change, text: label[p.change] })), el('td', { text: p.name }), el('td', { text: p.email || '—' }), el('td', { text: p.department || '—' }), el('td', { text: p.lifecycleState || '—' }), el('td', { text: p.manager || '—' }));
|
|
215
|
+
})))));
|
|
216
|
+
if (people.length > 1000) res.appendChild(el('div', { className: 'note', text: 'Showing 1,000 of ' + fmtNum(people.length) + '. Downloads contain everyone.' }));
|
|
217
|
+
} else res.appendChild(el('div', { className: 'empty', text: d.gain + d.lose === 0 ? 'Nobody would gain or lose the role.' : 'Nobody in this view.' }));
|
|
218
|
+
w.appendChild(res);
|
|
219
|
+
}
|
|
220
|
+
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// ---------- schedules ----------
|
|
2
|
+
var DAYNAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
3
|
+
function loadSchedules(message) {
|
|
4
|
+
var box = $('schedules');
|
|
5
|
+
box.textContent = '';
|
|
6
|
+
box.appendChild(el('div', { className: 'wrap' }, el('div', { className: 'progress' }, el('span', { className: 'spinner' }), el('span', { text: 'Loading schedules...' }))));
|
|
7
|
+
Promise.all([api('/api/schedules'), state.reports.length ? Promise.resolve(state.reports) : api('/api/reports')]).then(function (r) {
|
|
8
|
+
state.sched = r[0];
|
|
9
|
+
state.reports = r[1];
|
|
10
|
+
renderSchedules(message);
|
|
11
|
+
}).catch(function (e) { box.textContent = ''; box.appendChild(el('div', { className: 'error', text: errorText(e) })); });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function renderSchedules(message) {
|
|
15
|
+
var sd = state.sched, outer = $('schedules');
|
|
16
|
+
outer.textContent = '';
|
|
17
|
+
var box = el('div', { className: 'wrap', style: 'max-width:1120px' });
|
|
18
|
+
outer.appendChild(box);
|
|
19
|
+
box.appendChild(el('div', { className: 'rhead', style: 'margin-bottom:18px' }, el('span', { className: 'cat-ico', style: 'color:#2457d6;background:#eaf0fd' }, icon('clock')),
|
|
20
|
+
el('div', {}, el('h2', { text: 'Schedules' }), el('p', { className: 'desc', text: 'Send reports by email or to Teams/Slack automatically. Files are also saved in ' + sd.outputDir + '.' }))));
|
|
21
|
+
if (message) box.appendChild(el('div', { className: 'success', text: message }));
|
|
22
|
+
|
|
23
|
+
if (state.editing) {
|
|
24
|
+
box.appendChild(jobForm(state.editing));
|
|
25
|
+
if (!sd.email) {
|
|
26
|
+
box.appendChild(el('div', { className: 'note', text: 'To send this report by email, fill in the email server once (below). For Teams or Slack only, you can skip it.' }));
|
|
27
|
+
box.appendChild(emailCard(true));
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// tenant for automatic runs
|
|
33
|
+
var remember = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Tenant for automatic runs' })));
|
|
34
|
+
if (sd.remembered) {
|
|
35
|
+
remember.appendChild(el('div', { className: 'bar' }, el('span', { className: 'pill on', text: 'Saved on this computer' }),
|
|
36
|
+
el('span', { className: 'muted', text: 'Automatic runs sign in with the saved token, even when this screen is closed.' }),
|
|
37
|
+
el('button', { className: 'btn sm', text: 'Forget it', onclick: function () { api('/api/remember', 'POST', { remember: false }).then(function () { loadSchedules('Saved tenant details removed.'); }); } })));
|
|
38
|
+
} else if (state.signedIn) {
|
|
39
|
+
remember.appendChild(el('div', { className: 'bar' }, el('span', { className: 'pill off', text: 'Not saved' }),
|
|
40
|
+
el('span', { className: 'muted', text: 'You signed in with SailPoint. Sign-ins expire, so automatic runs need a personal access token: disconnect, connect with a token of a reporting identity, then click "Remember my tenant". "Run now" works with your sign-in.' })));
|
|
41
|
+
} else {
|
|
42
|
+
remember.appendChild(el('div', { className: 'bar' }, el('span', { className: 'pill off', text: 'Not saved' }),
|
|
43
|
+
el('span', { className: 'muted', text: 'Automatic runs happen when this screen is closed, so they need your tenant details saved on this computer (in your user profile, readable only by you).' }),
|
|
44
|
+
el('button', { className: 'btn primary sm', text: 'Remember my tenant', onclick: function () {
|
|
45
|
+
api('/api/remember', 'POST', { remember: true }).then(function () { loadSchedules('Tenant details saved for automatic runs.'); }).catch(function (e) { alert(errorText(e)); });
|
|
46
|
+
} })));
|
|
47
|
+
}
|
|
48
|
+
box.appendChild(remember);
|
|
49
|
+
|
|
50
|
+
// jobs
|
|
51
|
+
var jobsCard = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'My schedules' }),
|
|
52
|
+
el('button', { className: 'btn primary', text: '+ New schedule', onclick: function () { state.editing = { isNew: true }; renderSchedules(); } })));
|
|
53
|
+
if (!sd.jobs.length) jobsCard.appendChild(el('div', { className: 'muted', text: 'No schedules yet. Click "New schedule", or open a report and click "Schedule this report".' }));
|
|
54
|
+
else {
|
|
55
|
+
var t = el('table', { className: 'jobs' }, el('thead', {}, el('tr', {}, ['Name', 'Report', 'When', 'Sends to', 'Runs automatically', ''].map(function (h) { return el('th', { text: h }); }))));
|
|
56
|
+
var tb = el('tbody');
|
|
57
|
+
sd.jobs.forEach(function (j) {
|
|
58
|
+
var to = [];
|
|
59
|
+
if (j.emailTo.length) to.push(j.emailTo.join(', '));
|
|
60
|
+
if (j.webhookKind) to.push(j.webhookKind === 'teams' ? 'Teams' : j.webhookKind === 'slack' ? 'Slack' : 'Webhook');
|
|
61
|
+
var status = el('div');
|
|
62
|
+
var auto = j.automatic
|
|
63
|
+
? el('div', {}, el('span', { className: 'pill on', text: 'On' }), el('div', { className: 'muted', style: 'font-size:12px', text: 'Next: ' + j.automatic.next }))
|
|
64
|
+
: el('span', { className: 'pill off', text: 'Off' });
|
|
65
|
+
tb.appendChild(el('tr', {},
|
|
66
|
+
el('td', { text: j.name }), el('td', { text: j.reportName }), el('td', { text: j.whenText }), el('td', { text: to.join(' + ') || 'files only' }), el('td', {}, auto),
|
|
67
|
+
el('td', {}, el('div', { className: 'actions' },
|
|
68
|
+
el('button', { className: 'btn sm', text: 'Run now', onclick: function () { runNow(j, status); } }),
|
|
69
|
+
el('button', { className: 'btn sm', text: j.automatic ? 'Turn off' : 'Turn on', title: sd.windows === false ? '' : 'Uses Windows Task Scheduler', onclick: function () { toggleAuto(j); } }),
|
|
70
|
+
el('button', { className: 'btn sm', text: 'Edit', onclick: function () { state.editing = j; renderSchedules(); } }),
|
|
71
|
+
el('button', { className: 'btn sm', text: 'Delete', onclick: function () {
|
|
72
|
+
if (!confirm('Delete the schedule "' + j.name + '"?')) return;
|
|
73
|
+
api('/api/schedules/jobs/' + encodeURIComponent(j.name), 'DELETE').then(function () { loadSchedules('Schedule deleted.'); });
|
|
74
|
+
} })))));
|
|
75
|
+
tb.appendChild(el('tr', {}, el('td', { colspan: '6', style: 'border-bottom:none;padding-top:0' }, status, j.lastLog ? el('details', {}, el('summary', { className: 'muted', text: 'Last automatic runs' }), el('div', { className: 'log', text: j.lastLog })) : null)));
|
|
76
|
+
});
|
|
77
|
+
t.appendChild(tb);
|
|
78
|
+
jobsCard.appendChild(el('div', { className: 'table-wrap', style: 'max-height:none' }, t));
|
|
79
|
+
}
|
|
80
|
+
box.appendChild(jobsCard);
|
|
81
|
+
box.appendChild(emailCard());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function runNow(j, status) {
|
|
85
|
+
status.textContent = '';
|
|
86
|
+
status.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), el('span', { text: 'Running "' + j.name + '" now...' })));
|
|
87
|
+
api('/api/schedules/jobs/' + encodeURIComponent(j.name) + '/run', 'POST', {}).then(function (r) {
|
|
88
|
+
var check = function () {
|
|
89
|
+
api('/api/schedules/runs/' + r.run).then(function (s) {
|
|
90
|
+
if (s.state === 'running') { setTimeout(check, 1000); return; }
|
|
91
|
+
var o = s.outcome;
|
|
92
|
+
status.textContent = '';
|
|
93
|
+
if (o.ok) {
|
|
94
|
+
var parts = [(o.rows || 0).toLocaleString('en-US') + ' rows'];
|
|
95
|
+
if (o.skipped) parts.push('nothing sent (no rows)');
|
|
96
|
+
if (o.delivered.length) parts.push('sent: ' + o.delivered.join(', '));
|
|
97
|
+
if (o.files.length) parts.push('saved ' + o.files.length + ' file(s)');
|
|
98
|
+
status.appendChild(el('div', { className: 'success', text: 'Done: ' + parts.join(' · ') }));
|
|
99
|
+
} else status.appendChild(el('div', { className: 'error', text: o.error || 'Failed' }));
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
check();
|
|
103
|
+
}).catch(function (e) { status.textContent = ''; status.appendChild(el('div', { className: 'error', text: errorText(e) })); });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function toggleAuto(j) {
|
|
107
|
+
api('/api/schedules/jobs/' + encodeURIComponent(j.name) + '/automatic', 'POST', { on: !j.automatic })
|
|
108
|
+
.then(function () { loadSchedules(j.automatic ? 'Automatic runs turned off for "' + j.name + '".' : '"' + j.name + '" will now run automatically (' + j.whenText + ') while this computer is on.'); })
|
|
109
|
+
.catch(function (e) { alert(errorText(e)); });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function emailCard(inForm) {
|
|
113
|
+
var e = state.sched.email || {};
|
|
114
|
+
var host = el('input', { className: 'input', value: e.host || '', placeholder: 'smtp.office365.com' });
|
|
115
|
+
var port = el('input', { className: 'input', value: e.port || 587, style: 'width:90px' });
|
|
116
|
+
var user = el('input', { className: 'input', value: e.user || '', placeholder: 'reports@company.com' });
|
|
117
|
+
var pass = el('input', { className: 'input', type: 'password', placeholder: e.passwordSaved ? 'saved (leave empty to keep)' : '' });
|
|
118
|
+
var from = el('input', { className: 'input', value: e.from || '', placeholder: 'IAM Reports <reports@company.com>' });
|
|
119
|
+
var testTo = el('input', { className: 'input', placeholder: 'you@company.com', style: 'width:240px' });
|
|
120
|
+
var msg = el('div');
|
|
121
|
+
var card = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Email server' })),
|
|
122
|
+
el('p', { className: 'muted', style: 'margin-top:0', text: 'Ask your mail team for an SMTP relay or an app password. The password is stored only on this computer.' }),
|
|
123
|
+
el('div', { className: 'grid' }, el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Server' }), host), el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Port' }), port),
|
|
124
|
+
el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'User name' }), user), el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Password' }), pass)),
|
|
125
|
+
el('div', { className: 'grid' }, el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'From' }), from)),
|
|
126
|
+
el('div', { className: 'bar' },
|
|
127
|
+
el('button', { className: 'btn primary', text: 'Save email settings', onclick: function () {
|
|
128
|
+
msg.textContent = '';
|
|
129
|
+
api('/api/schedules/email', 'PUT', { host: host.value, port: Number(port.value), user: user.value, password: pass.value, from: from.value })
|
|
130
|
+
.then(function () {
|
|
131
|
+
if (!inForm) return loadSchedules('Email settings saved.');
|
|
132
|
+
return api('/api/schedules').then(function (sd) {
|
|
133
|
+
state.sched = sd;
|
|
134
|
+
msg.appendChild(el('div', { className: 'success', text: 'Email settings saved. Now click "Save schedule" above.' }));
|
|
135
|
+
});
|
|
136
|
+
})
|
|
137
|
+
.catch(function (er) { msg.appendChild(el('div', { className: 'error', text: errorText(er) })); });
|
|
138
|
+
} }),
|
|
139
|
+
el('span', { className: 'muted', text: 'Send a test to' }), testTo,
|
|
140
|
+
el('button', { className: 'btn', text: 'Send test email', onclick: function () {
|
|
141
|
+
msg.textContent = '';
|
|
142
|
+
msg.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), el('span', { text: 'Sending...' })));
|
|
143
|
+
api('/api/schedules/email/test', 'POST', { to: testTo.value }).then(function () { msg.textContent = ''; msg.appendChild(el('div', { className: 'success', text: 'Test email sent to ' + testTo.value + '.' })); })
|
|
144
|
+
.catch(function (er) { msg.textContent = ''; msg.appendChild(el('div', { className: 'error', text: errorText(er) })); });
|
|
145
|
+
} })),
|
|
146
|
+
msg);
|
|
147
|
+
return card;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function jobForm(j) {
|
|
151
|
+
var editing = !j.isNew;
|
|
152
|
+
var reports = state.reports.map(function (r) { return r.definition; });
|
|
153
|
+
var name = el('input', { className: 'input', value: j.name || '', placeholder: 'weekly-leavers' });
|
|
154
|
+
var reportSel = el('select', { className: 'input' }, el('option', { value: '', text: 'Choose a report' }), el('option', { value: '@instant-check', text: 'Instant check (all checks, a summary)' }), el('option', { value: '@all-tenants-check', text: 'All tenants: instant check of every customer tenant (partner overview)' }), reports.map(function (d) { return el('option', { value: d.id, text: d.name }); }));
|
|
155
|
+
reportSel.value = j.report || '';
|
|
156
|
+
var paramsBox = el('div');
|
|
157
|
+
var paramValues = Object.assign({}, j.params || {});
|
|
158
|
+
function drawParams() {
|
|
159
|
+
paramsBox.textContent = '';
|
|
160
|
+
var d = reports.filter(function (x) { return x.id === reportSel.value; })[0];
|
|
161
|
+
if (!d || !d.params) return;
|
|
162
|
+
var g = paramsGrid(d.params, paramValues);
|
|
163
|
+
if (g) { g.style.marginBottom = '14px'; paramsBox.appendChild(g); }
|
|
164
|
+
}
|
|
165
|
+
var nameFor = function (r) { return r === '@instant-check' ? 'daily-instant-check' : r === '@all-tenants-check' ? 'daily-all-tenants' : r; };
|
|
166
|
+
reportSel.addEventListener('change', function () { paramValues = {}; drawParams(); if ((!name.value || name.value === '@instant-check' || name.value === '@all-tenants-check') && reportSel.value) name.value = nameFor(reportSel.value); });
|
|
167
|
+
drawParams();
|
|
168
|
+
if (!name.value && j.report) name.value = nameFor(j.report);
|
|
169
|
+
|
|
170
|
+
var w = j.when || { every: 'week', time: '08:00', weekday: 1, day: 1 };
|
|
171
|
+
var every = el('select', { className: 'input' }, el('option', { value: 'day', text: 'Every day' }), el('option', { value: 'week', text: 'Every week' }), el('option', { value: 'month', text: 'Every month' }));
|
|
172
|
+
every.value = w.every;
|
|
173
|
+
var time = el('input', { className: 'input', type: 'time', value: w.time || '08:00' });
|
|
174
|
+
var weekday = el('select', { className: 'input' }, DAYNAMES.map(function (n, i) { return el('option', { value: String(i), text: 'on ' + n }); }));
|
|
175
|
+
weekday.value = String(w.weekday === undefined ? 1 : w.weekday);
|
|
176
|
+
var day = el('select', { className: 'input' }, Array.from({ length: 28 }, function (_, i) { return el('option', { value: String(i + 1), text: 'on day ' + (i + 1) }); }));
|
|
177
|
+
day.value = String(w.day || 1);
|
|
178
|
+
var syncWhen = function () { weekday.style.display = every.value === 'week' ? '' : 'none'; day.style.display = every.value === 'month' ? '' : 'none'; };
|
|
179
|
+
every.addEventListener('change', syncWhen); syncWhen();
|
|
180
|
+
|
|
181
|
+
var fmts = j.formats || ['xlsx'];
|
|
182
|
+
var checks = ['xlsx', 'csv', 'html'].map(function (f) {
|
|
183
|
+
var c = el('input', { type: 'checkbox' });
|
|
184
|
+
c.checked = fmts.indexOf(f) >= 0;
|
|
185
|
+
return { f: f, c: c };
|
|
186
|
+
});
|
|
187
|
+
var emailTo = el('input', { className: 'input', value: (j.emailTo || []).join(', '), placeholder: 'audit@company.com, you@company.com' });
|
|
188
|
+
var allow = {};
|
|
189
|
+
(j.allowUnverified || []).forEach(function (a) { allow[a.toLowerCase()] = true; });
|
|
190
|
+
var recipientsBox = el('div');
|
|
191
|
+
function showRecipients(list) {
|
|
192
|
+
recipientsBox.textContent = '';
|
|
193
|
+
list.forEach(function (r) {
|
|
194
|
+
var line = el('div', { style: 'font-size:13px;margin:3px 0' });
|
|
195
|
+
if (r.ok) {
|
|
196
|
+
line.appendChild(el('span', { className: 'ok', text: '\u2713 ' + r.email }));
|
|
197
|
+
line.appendChild(el('span', { className: 'muted', text: r.identity ? ' (' + r.identity + ')' : r.reason ? ' (' + r.reason + ')' : '' }));
|
|
198
|
+
} else {
|
|
199
|
+
line.appendChild(el('span', { style: 'color:var(--danger)', text: '\u2717 ' + r.email + ': ' + r.reason }));
|
|
200
|
+
if (r.reason === 'no identity in ISC has this email') {
|
|
201
|
+
var c = el('input', { type: 'checkbox' });
|
|
202
|
+
c.checked = !!allow[r.email.toLowerCase()];
|
|
203
|
+
c.addEventListener('change', function () { if (c.checked) allow[r.email.toLowerCase()] = true; else delete allow[r.email.toLowerCase()]; });
|
|
204
|
+
line.appendChild(el('label', { className: 'check', style: 'margin-left:12px' }, c, 'It is a shared mailbox or distribution list of our company: allow it'));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
recipientsBox.appendChild(line);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
var checkBtn = el('button', { className: 'btn sm', text: 'Check recipients in ISC', onclick: function () {
|
|
211
|
+
recipientsBox.textContent = 'Checking...';
|
|
212
|
+
api('/api/schedules/recipients', 'POST', { emails: emailTo.value, allowUnverified: Object.keys(allow) })
|
|
213
|
+
.then(function (r) { showRecipients(r.recipients); })
|
|
214
|
+
.catch(function (e) { recipientsBox.textContent = ''; recipientsBox.appendChild(el('div', { className: 'error', text: errorText(e) })); });
|
|
215
|
+
} });
|
|
216
|
+
var kind = el('select', { className: 'input' }, el('option', { value: '', text: 'No chat message' }), el('option', { value: 'teams', text: 'Microsoft Teams' }), el('option', { value: 'slack', text: 'Slack' }));
|
|
217
|
+
kind.value = j.webhookKind || '';
|
|
218
|
+
var hook = el('input', { className: 'input', placeholder: j.webhookSaved ? 'saved (leave empty to keep)' : 'https://...' });
|
|
219
|
+
var syncHook = function () { hook.parentNode.style.display = kind.value ? '' : 'none'; };
|
|
220
|
+
var sendWhen = el('select', { className: 'input', style: 'width:auto' },
|
|
221
|
+
el('option', { value: 'always', text: 'every time it runs' }),
|
|
222
|
+
el('option', { value: 'rows', text: 'only when there is something (rows, or a check that is not OK)' }),
|
|
223
|
+
el('option', { value: 'new', text: 'only when something is new or got worse since the last run' }));
|
|
224
|
+
sendWhen.value = j.sendWhen || (j.skipWhenEmpty ? 'rows' : (j.isNew && (j.report === '@instant-check' || j.report === '@all-tenants-check') ? 'new' : 'always'));
|
|
225
|
+
reportSel.addEventListener('change', function () { if ((reportSel.value === '@instant-check' || reportSel.value === '@all-tenants-check') && sendWhen.value === 'always') sendWhen.value = 'new'; });
|
|
226
|
+
var msg = el('div');
|
|
227
|
+
var hookLabel = el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Webhook address (Teams: channel > Workflows > "Send webhook alerts to a channel")' }), hook);
|
|
228
|
+
var form = el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: editing ? 'Edit schedule' : 'New schedule' })),
|
|
229
|
+
el('div', { className: 'grid' }, el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Name' }), name), el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Report' }), reportSel)),
|
|
230
|
+
paramsBox,
|
|
231
|
+
el('div', { className: 'inline', style: 'margin-bottom:14px' }, el('span', { className: 'muted', text: 'Runs' }), every, weekday, day, el('span', { className: 'muted', text: 'at' }), time),
|
|
232
|
+
el('div', { className: 'bar', style: 'margin-bottom:12px' }, el('span', { className: 'muted', text: 'Files:' }), checks.map(function (x) { return el('label', { className: 'check' }, x.c, x.f === 'xlsx' ? 'Excel' : x.f.toUpperCase()); }),
|
|
233
|
+
el('span', { className: 'muted', style: 'margin-left:12px', text: 'Send' }), sendWhen),
|
|
234
|
+
el('div', { className: 'inline', style: 'align-items:flex-start;margin:6px 0 16px' },
|
|
235
|
+
el('label', { className: 'field', style: 'flex:1;min-width:300px;margin:0' }, el('span', { className: 'lbl', text: 'Email to' }), emailTo, el('span', { className: 'hint', text: 'Comma separated. Each address must belong to an active identity in ISC.' })),
|
|
236
|
+
el('div', { style: 'padding-top:23px' }, checkBtn)),
|
|
237
|
+
recipientsBox,
|
|
238
|
+
el('div', { className: 'grid' }, el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Also post a summary to' }), kind), hookLabel),
|
|
239
|
+
el('p', { className: 'muted', text: 'Chat messages carry only counts and check results, never names; the data goes by email or stays in the saved files.' }),
|
|
240
|
+
msg,
|
|
241
|
+
el('div', { className: 'bar' },
|
|
242
|
+
el('button', { className: 'btn primary', text: 'Save schedule', onclick: function () {
|
|
243
|
+
msg.textContent = '';
|
|
244
|
+
var body = {
|
|
245
|
+
previousName: editing ? j.name : undefined,
|
|
246
|
+
name: name.value.trim(), report: reportSel.value, params: paramValues,
|
|
247
|
+
when: { every: every.value, time: time.value, weekday: Number(weekday.value), day: Number(day.value) },
|
|
248
|
+
formats: checks.filter(function (x) { return x.c.checked; }).map(function (x) { return x.f; }),
|
|
249
|
+
emailTo: emailTo.value, allowUnverified: Object.keys(allow), webhookKind: kind.value || undefined, webhookUrl: hook.value, sendWhen: sendWhen.value
|
|
250
|
+
};
|
|
251
|
+
api('/api/schedules/jobs', 'POST', body).then(function (r) {
|
|
252
|
+
state.editing = null;
|
|
253
|
+
loadSchedules('Schedule "' + r.saved + '" saved. Click "Run now" to try it, and "Turn on" to run it automatically.');
|
|
254
|
+
}).catch(function (e) {
|
|
255
|
+
if (e.data && e.data.recipients) { msg.appendChild(el('div', { className: 'error', text: e.message })); showRecipients(e.data.recipients); }
|
|
256
|
+
else msg.appendChild(el('div', { className: 'error', text: errorText(e) }));
|
|
257
|
+
});
|
|
258
|
+
} }),
|
|
259
|
+
el('button', { className: 'btn', text: 'Cancel', onclick: function () { state.editing = null; renderSchedules(); } })));
|
|
260
|
+
kind.addEventListener('change', syncHook);
|
|
261
|
+
setTimeout(syncHook, 0);
|
|
262
|
+
return form;
|
|
263
|
+
}
|
|
264
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// ---------- start ----------
|
|
2
|
+
api('/api/state').then(function (st) {
|
|
3
|
+
if (st.connected) { state.signedIn = st.signedInAs !== undefined && st.signedInAs !== null; showApp(st.tenant, st.signedInAs); } else showConnect(st);
|
|
4
|
+
}).catch(function (e) {
|
|
5
|
+
document.body.textContent = '';
|
|
6
|
+
document.body.appendChild(el('div', { className: 'error', style: 'margin:40px', text: errorText(e) }));
|
|
7
|
+
});
|