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.
Files changed (333) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +917 -3
  3. package/SECURITY.md +56 -0
  4. package/dist/core/audit-readiness.d.ts +158 -0
  5. package/dist/core/audit-readiness.js +357 -0
  6. package/dist/core/audit-readiness.js.map +1 -0
  7. package/dist/core/certs.d.ts +68 -0
  8. package/dist/core/certs.js +132 -0
  9. package/dist/core/certs.js.map +1 -0
  10. package/dist/core/checks.d.ts +133 -0
  11. package/dist/core/checks.js +512 -0
  12. package/dist/core/checks.js.map +1 -0
  13. package/dist/core/cloud-rules.d.ts +20 -0
  14. package/dist/core/cloud-rules.js +44 -0
  15. package/dist/core/cloud-rules.js.map +1 -0
  16. package/dist/core/compare.d.ts +45 -0
  17. package/dist/core/compare.js +372 -0
  18. package/dist/core/compare.js.map +1 -0
  19. package/dist/core/conditions.d.ts +10 -0
  20. package/dist/core/conditions.js +201 -0
  21. package/dist/core/conditions.js.map +1 -0
  22. package/dist/core/credentials.d.ts +71 -0
  23. package/dist/core/credentials.js +211 -0
  24. package/dist/core/credentials.js.map +1 -0
  25. package/dist/core/datasets.d.ts +53 -0
  26. package/dist/core/datasets.js +596 -0
  27. package/dist/core/datasets.js.map +1 -0
  28. package/dist/core/definition.d.ts +32 -0
  29. package/dist/core/definition.js +301 -0
  30. package/dist/core/definition.js.map +1 -0
  31. package/dist/core/discover.d.ts +32 -0
  32. package/dist/core/discover.js +105 -0
  33. package/dist/core/discover.js.map +1 -0
  34. package/dist/core/engine.d.ts +18 -0
  35. package/dist/core/engine.js +290 -0
  36. package/dist/core/engine.js.map +1 -0
  37. package/dist/core/fields.d.ts +16 -0
  38. package/dist/core/fields.js +132 -0
  39. package/dist/core/fields.js.map +1 -0
  40. package/dist/core/governance-trail.d.ts +211 -0
  41. package/dist/core/governance-trail.js +557 -0
  42. package/dist/core/governance-trail.js.map +1 -0
  43. package/dist/core/http-transport.d.ts +66 -0
  44. package/dist/core/http-transport.js +247 -0
  45. package/dist/core/http-transport.js.map +1 -0
  46. package/dist/core/index.d.ts +13 -0
  47. package/dist/core/index.js +16 -0
  48. package/dist/core/index.js.map +1 -0
  49. package/dist/core/insights.d.ts +176 -0
  50. package/dist/core/insights.js +417 -0
  51. package/dist/core/insights.js.map +1 -0
  52. package/dist/core/joiner-evidence.d.ts +98 -0
  53. package/dist/core/joiner-evidence.js +254 -0
  54. package/dist/core/joiner-evidence.js.map +1 -0
  55. package/dist/core/lab/credential-map.d.ts +50 -0
  56. package/dist/core/lab/credential-map.js +163 -0
  57. package/dist/core/lab/credential-map.js.map +1 -0
  58. package/dist/core/lab/javadate.d.ts +7 -0
  59. package/dist/core/lab/javadate.js +307 -0
  60. package/dist/core/lab/javadate.js.map +1 -0
  61. package/dist/core/lab/jsonpath.d.ts +11 -0
  62. package/dist/core/lab/jsonpath.js +273 -0
  63. package/dist/core/lab/jsonpath.js.map +1 -0
  64. package/dist/core/lab/policy-preview.d.ts +43 -0
  65. package/dist/core/lab/policy-preview.js +78 -0
  66. package/dist/core/lab/policy-preview.js.map +1 -0
  67. package/dist/core/lab/rfc5646.d.ts +2 -0
  68. package/dist/core/lab/rfc5646.js +421 -0
  69. package/dist/core/lab/rfc5646.js.map +1 -0
  70. package/dist/core/lab/transform-impact.d.ts +63 -0
  71. package/dist/core/lab/transform-impact.js +138 -0
  72. package/dist/core/lab/transform-impact.js.map +1 -0
  73. package/dist/core/lab/transform-people.d.ts +61 -0
  74. package/dist/core/lab/transform-people.js +132 -0
  75. package/dist/core/lab/transform-people.js.map +1 -0
  76. package/dist/core/lab/transforms.d.ts +79 -0
  77. package/dist/core/lab/transforms.js +738 -0
  78. package/dist/core/lab/transforms.js.map +1 -0
  79. package/dist/core/lab/velocity.d.ts +33 -0
  80. package/dist/core/lab/velocity.js +874 -0
  81. package/dist/core/lab/velocity.js.map +1 -0
  82. package/dist/core/lab/workflow-health.d.ts +80 -0
  83. package/dist/core/lab/workflow-health.js +234 -0
  84. package/dist/core/lab/workflow-health.js.map +1 -0
  85. package/dist/core/lab/workflows.d.ts +87 -0
  86. package/dist/core/lab/workflows.js +568 -0
  87. package/dist/core/lab/workflows.js.map +1 -0
  88. package/dist/core/lifecycle-gaps.d.ts +192 -0
  89. package/dist/core/lifecycle-gaps.js +389 -0
  90. package/dist/core/lifecycle-gaps.js.map +1 -0
  91. package/dist/core/logs.d.ts +145 -0
  92. package/dist/core/logs.js +342 -0
  93. package/dist/core/logs.js.map +1 -0
  94. package/dist/core/lookup.d.ts +129 -0
  95. package/dist/core/lookup.js +289 -0
  96. package/dist/core/lookup.js.map +1 -0
  97. package/dist/core/model-insights.d.ts +247 -0
  98. package/dist/core/model-insights.js +474 -0
  99. package/dist/core/model-insights.js.map +1 -0
  100. package/dist/core/narrow.d.ts +23 -0
  101. package/dist/core/narrow.js +137 -0
  102. package/dist/core/narrow.js.map +1 -0
  103. package/dist/core/nerm.d.ts +154 -0
  104. package/dist/core/nerm.js +397 -0
  105. package/dist/core/nerm.js.map +1 -0
  106. package/dist/core/operations-watch.d.ts +232 -0
  107. package/dist/core/operations-watch.js +491 -0
  108. package/dist/core/operations-watch.js.map +1 -0
  109. package/dist/core/output/csv.d.ts +6 -0
  110. package/dist/core/output/csv.js +22 -0
  111. package/dist/core/output/csv.js.map +1 -0
  112. package/dist/core/output/html.d.ts +11 -0
  113. package/dist/core/output/html.js +66 -0
  114. package/dist/core/output/html.js.map +1 -0
  115. package/dist/core/output/xlsx.d.ts +3 -0
  116. package/dist/core/output/xlsx.js +130 -0
  117. package/dist/core/output/xlsx.js.map +1 -0
  118. package/dist/core/output/zip.d.ts +16 -0
  119. package/dist/core/output/zip.js +106 -0
  120. package/dist/core/output/zip.js.map +1 -0
  121. package/dist/core/ownership.d.ts +39 -0
  122. package/dist/core/ownership.js +100 -0
  123. package/dist/core/ownership.js.map +1 -0
  124. package/dist/core/patterns.d.ts +11 -0
  125. package/dist/core/patterns.js +31 -0
  126. package/dist/core/patterns.js.map +1 -0
  127. package/dist/core/preview.d.ts +96 -0
  128. package/dist/core/preview.js +173 -0
  129. package/dist/core/preview.js.map +1 -0
  130. package/dist/core/roles.d.ts +125 -0
  131. package/dist/core/roles.js +420 -0
  132. package/dist/core/roles.js.map +1 -0
  133. package/dist/core/tenant.d.ts +67 -0
  134. package/dist/core/tenant.js +194 -0
  135. package/dist/core/tenant.js.map +1 -0
  136. package/dist/core/threat-signals.d.ts +112 -0
  137. package/dist/core/threat-signals.js +250 -0
  138. package/dist/core/threat-signals.js.map +1 -0
  139. package/dist/core/threat-watch.d.ts +144 -0
  140. package/dist/core/threat-watch.js +282 -0
  141. package/dist/core/threat-watch.js.map +1 -0
  142. package/dist/core/transport.d.ts +82 -0
  143. package/dist/core/transport.js +312 -0
  144. package/dist/core/transport.js.map +1 -0
  145. package/dist/core/types.d.ts +137 -0
  146. package/dist/core/types.js +10 -0
  147. package/dist/core/types.js.map +1 -0
  148. package/dist/core/warnings.d.ts +236 -0
  149. package/dist/core/warnings.js +504 -0
  150. package/dist/core/warnings.js.map +1 -0
  151. package/dist/demo/tenant.d.ts +1572 -0
  152. package/dist/demo/tenant.js +1023 -0
  153. package/dist/demo/tenant.js.map +1 -0
  154. package/dist/node/attribute-history.d.ts +22 -0
  155. package/dist/node/attribute-history.js +86 -0
  156. package/dist/node/attribute-history.js.map +1 -0
  157. package/dist/node/changes.d.ts +20 -0
  158. package/dist/node/changes.js +78 -0
  159. package/dist/node/changes.js.map +1 -0
  160. package/dist/node/cli.d.ts +2 -0
  161. package/dist/node/cli.js +291 -0
  162. package/dist/node/cli.js.map +1 -0
  163. package/dist/node/config.d.ts +72 -0
  164. package/dist/node/config.js +203 -0
  165. package/dist/node/config.js.map +1 -0
  166. package/dist/node/credentials.d.ts +13 -0
  167. package/dist/node/credentials.js +24 -0
  168. package/dist/node/credentials.js.map +1 -0
  169. package/dist/node/delivery.d.ts +10 -0
  170. package/dist/node/delivery.js +105 -0
  171. package/dist/node/delivery.js.map +1 -0
  172. package/dist/node/doctor.d.ts +2 -0
  173. package/dist/node/doctor.js +151 -0
  174. package/dist/node/doctor.js.map +1 -0
  175. package/dist/node/drift.d.ts +31 -0
  176. package/dist/node/drift.js +56 -0
  177. package/dist/node/drift.js.map +1 -0
  178. package/dist/node/evidence.d.ts +42 -0
  179. package/dist/node/evidence.js +129 -0
  180. package/dist/node/evidence.js.map +1 -0
  181. package/dist/node/exceptions.d.ts +30 -0
  182. package/dist/node/exceptions.js +83 -0
  183. package/dist/node/exceptions.js.map +1 -0
  184. package/dist/node/history.d.ts +35 -0
  185. package/dist/node/history.js +74 -0
  186. package/dist/node/history.js.map +1 -0
  187. package/dist/node/index.d.ts +7 -0
  188. package/dist/node/index.js +8 -0
  189. package/dist/node/index.js.map +1 -0
  190. package/dist/node/keep.d.ts +9 -0
  191. package/dist/node/keep.js +39 -0
  192. package/dist/node/keep.js.map +1 -0
  193. package/dist/node/loader.d.ts +7 -0
  194. package/dist/node/loader.js +35 -0
  195. package/dist/node/loader.js.map +1 -0
  196. package/dist/node/log-files.d.ts +16 -0
  197. package/dist/node/log-files.js +93 -0
  198. package/dist/node/log-files.js.map +1 -0
  199. package/dist/node/monthly.d.ts +41 -0
  200. package/dist/node/monthly.js +108 -0
  201. package/dist/node/monthly.js.map +1 -0
  202. package/dist/node/oauth-login.d.ts +45 -0
  203. package/dist/node/oauth-login.js +121 -0
  204. package/dist/node/oauth-login.js.map +1 -0
  205. package/dist/node/packs.d.ts +32 -0
  206. package/dist/node/packs.js +43 -0
  207. package/dist/node/packs.js.map +1 -0
  208. package/dist/node/privileged-seen.d.ts +11 -0
  209. package/dist/node/privileged-seen.js +41 -0
  210. package/dist/node/privileged-seen.js.map +1 -0
  211. package/dist/node/recipients.d.ts +17 -0
  212. package/dist/node/recipients.js +51 -0
  213. package/dist/node/recipients.js.map +1 -0
  214. package/dist/node/runner.d.ts +51 -0
  215. package/dist/node/runner.js +298 -0
  216. package/dist/node/runner.js.map +1 -0
  217. package/dist/node/runtime.d.ts +12 -0
  218. package/dist/node/runtime.js +13 -0
  219. package/dist/node/runtime.js.map +1 -0
  220. package/dist/node/schedules.d.ts +87 -0
  221. package/dist/node/schedules.js +141 -0
  222. package/dist/node/schedules.js.map +1 -0
  223. package/dist/node/secrets.d.ts +37 -0
  224. package/dist/node/secrets.js +219 -0
  225. package/dist/node/secrets.js.map +1 -0
  226. package/dist/node/support.d.ts +14 -0
  227. package/dist/node/support.js +133 -0
  228. package/dist/node/support.js.map +1 -0
  229. package/dist/node/tenants.d.ts +93 -0
  230. package/dist/node/tenants.js +255 -0
  231. package/dist/node/tenants.js.map +1 -0
  232. package/dist/node/ui-page.d.ts +1 -0
  233. package/dist/node/ui-page.js +3 -0
  234. package/dist/node/ui-page.js.map +1 -0
  235. package/dist/node/ui-server.d.ts +48 -0
  236. package/dist/node/ui-server.js +2665 -0
  237. package/dist/node/ui-server.js.map +1 -0
  238. package/dist/node/write.d.ts +9 -0
  239. package/dist/node/write.js +53 -0
  240. package/dist/node/write.js.map +1 -0
  241. package/dist/reports/builtin.generated.d.ts +1 -0
  242. package/dist/reports/builtin.generated.js +49 -0
  243. package/dist/reports/builtin.generated.js.map +1 -0
  244. package/dist/reports/library.d.ts +6 -0
  245. package/dist/reports/library.js +18 -0
  246. package/dist/reports/library.js.map +1 -0
  247. package/launcher/IdentityScope.cmd +11 -0
  248. package/package.json +69 -4
  249. package/reports/access-profile-members.yaml +29 -0
  250. package/reports/access-profile-membership-counts.yaml +17 -0
  251. package/reports/access-profiles-without-owner.yaml +16 -0
  252. package/reports/access-request-audit-trail.yaml +36 -0
  253. package/reports/accounts-by-source.yaml +19 -0
  254. package/reports/active-identities-without-manager.yaml +22 -0
  255. package/reports/aggregation-failures.yaml +29 -0
  256. package/reports/aggregation-history.yaml +27 -0
  257. package/reports/all-sources.yaml +16 -0
  258. package/reports/application-accounts.yaml +32 -0
  259. package/reports/application-entitlements.yaml +31 -0
  260. package/reports/campaign-progress.yaml +23 -0
  261. package/reports/certification-decisions.yaml +31 -0
  262. package/reports/direct-reports-per-manager.yaml +20 -0
  263. package/reports/disabled-accounts-of-active-people.yaml +33 -0
  264. package/reports/duplicate-emails.yaml +16 -0
  265. package/reports/entitlement-holders.yaml +35 -0
  266. package/reports/entitlements-held-by-inactive-identities.yaml +31 -0
  267. package/reports/entitlements-without-owner.yaml +28 -0
  268. package/reports/identities-by-lifecycle-state.yaml +15 -0
  269. package/reports/identities-missing-key-attributes.yaml +27 -0
  270. package/reports/identities-with-processing-errors.yaml +19 -0
  271. package/reports/identity-attribute-mappings.yaml +27 -0
  272. package/reports/machine-accounts.yaml +28 -0
  273. package/reports/managers-and-direct-reports.yaml +23 -0
  274. package/reports/most-access.yaml +18 -0
  275. package/reports/new-identities.yaml +24 -0
  276. package/reports/old-passwords.yaml +35 -0
  277. package/reports/pending-reviews-by-reviewer.yaml +20 -0
  278. package/reports/person-access.yaml +31 -0
  279. package/reports/privileged-access.yaml +29 -0
  280. package/reports/provisioning-error-causes.yaml +27 -0
  281. package/reports/provisioning-errors.yaml +32 -0
  282. package/reports/provisioning-failures.yaml +28 -0
  283. package/reports/recent-access-requests.yaml +22 -0
  284. package/reports/recent-activity.yaml +32 -0
  285. package/reports/recent-leavers.yaml +34 -0
  286. package/reports/role-members.yaml +29 -0
  287. package/reports/role-membership-counts.yaml +18 -0
  288. package/reports/roles-without-owner.yaml +17 -0
  289. package/reports/sources-needing-attention.yaml +23 -0
  290. package/reports/stuck-access-requests.yaml +29 -0
  291. package/reports/team-access.yaml +30 -0
  292. package/reports/terminated-users-with-active-accounts.yaml +46 -0
  293. package/reports/uncorrelated-accounts.yaml +38 -0
  294. package/ui/js/00-setup.js +6 -0
  295. package/ui/js/01-small-helpers.js +143 -0
  296. package/ui/js/02-connection.js +150 -0
  297. package/ui/js/03-health-check.js +17 -0
  298. package/ui/js/04-library.js +135 -0
  299. package/ui/js/05-pickers.js +163 -0
  300. package/ui/js/06-report-view.js +157 -0
  301. package/ui/js/07-fields.js +85 -0
  302. package/ui/js/08-designer.js +360 -0
  303. package/ui/js/09-yaml.js +22 -0
  304. package/ui/js/10-instant-check.js +171 -0
  305. package/ui/js/11-lookup.js +161 -0
  306. package/ui/js/12-tenant.js +115 -0
  307. package/ui/js/13-source-configuration-and-diagnostics.js +64 -0
  308. package/ui/js/14-certifications.js +68 -0
  309. package/ui/js/15-monthly-report.js +24 -0
  310. package/ui/js/16-ownership.js +39 -0
  311. package/ui/js/17-compare-tenants.js +102 -0
  312. package/ui/js/18-audit.js +181 -0
  313. package/ui/js/19-insights.js +108 -0
  314. package/ui/js/20-role-mining.js +35 -0
  315. package/ui/js/21-share-reports.js +45 -0
  316. package/ui/js/22-partner-overview-all-customer-tenants.js +228 -0
  317. package/ui/js/23-in-app-guidance.js +217 -0
  318. package/ui/js/24-role-tools.js +220 -0
  319. package/ui/js/25-schedules.js +264 -0
  320. package/ui/js/26-start.js +7 -0
  321. package/ui/js/27-warnings.js +224 -0
  322. package/ui/js/28-audit-readiness.js +99 -0
  323. package/ui/js/29-lifecycle.js +182 -0
  324. package/ui/js/30-labs.js +265 -0
  325. package/ui/js/31-build.js +203 -0
  326. package/ui/js/32-lab-examples.js +148 -0
  327. package/ui/js/33-finder.js +89 -0
  328. package/ui/js/34-governance.js +129 -0
  329. package/ui/js/35-watch.js +266 -0
  330. package/ui/js/36-model.js +247 -0
  331. package/ui/js/37-logs-and-watch.js +224 -0
  332. package/ui/shell.html +112 -0
  333. package/ui/style.css +350 -0
@@ -0,0 +1,102 @@
1
+ // ---------- compare tenants (a Tenant tab) ----------
2
+ state.cp = { kinds: null };
3
+ function cmpKey(path) { return String(path).replace(/ \(.*$/, '').replace(/\[\d+\]/g, '[]'); }
4
+ function cmpIgnore(P, kind, setting, on) {
5
+ api('/api/compare/ignore', 'POST', { kind: kind, setting: setting, ignore: on }).then(function (r) {
6
+ P.info.ignore = r.ignore;
7
+ if (on && P.data) {
8
+ // Apply now to what is on screen; the next Compare applies it to the results and the exports.
9
+ P.data.kinds.forEach(function (k) {
10
+ if (k.kind !== kind) return;
11
+ var keep = [];
12
+ k.different.forEach(function (x) { var left = x.differences.filter(function (y) { return cmpKey(y.path) !== setting; }); if (left.length) keep.push({ name: x.name, differences: left }); else k.same++; });
13
+ k.different = keep;
14
+ });
15
+ }
16
+ renderTenant();
17
+ }, function (e) { toast(errorText(e)); });
18
+ }
19
+ function renderCompare2(w) {
20
+ var P = state.cp;
21
+ if (!P.info) {
22
+ w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading...'));
23
+ api('/api/compare').then(function (r) { P.info = r; if (!P.kinds) P.kinds = r.kinds.map(function (k) { return k.kind; }); renderTenant(); });
24
+ return;
25
+ }
26
+ if (!P.info.other) {
27
+ var base = el('input', { className: 'input', placeholder: 'production tenant, e.g. acme or https://acme.api.identitynow.com', autocomplete: 'off' });
28
+ var cid = el('input', { className: 'input', autocomplete: 'off' });
29
+ var sec = el('input', { className: 'input', type: 'password', autocomplete: 'off' });
30
+ var msg = el('div');
31
+ w.appendChild(el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', { text: 'Connect the other tenant' })),
32
+ el('p', { className: 'muted', style: 'margin-top:0', text: 'Compares ' + (P.info.tenant || 'this tenant') + ' with another tenant (for example sandbox with production) by object name. Read-only on both. The other tenant’s token is kept in memory only, never saved.' }),
33
+ el('div', { className: 'grid' }, el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Other tenant' }), base), el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Client ID (personal access token)' }), cid), el('label', { className: 'field' }, el('span', { className: 'lbl', text: 'Client secret' }), sec)),
34
+ el('button', { className: 'btn primary', style: 'margin-top:14px', onclick: function () {
35
+ msg.textContent = '';
36
+ api('/api/compare/connect', 'POST', { baseUrl: base.value, clientId: cid.value, clientSecret: sec.value }).then(function (r) { sec.value = ''; P.info.other = r.tenant; renderTenant(); }).catch(function (e) { msg.appendChild(el('div', { className: 'error', text: errorText(e) })); });
37
+ } }, 'Connect'), msg));
38
+ return;
39
+ }
40
+ var boxes = el('div', { className: 'bar' }, P.info.kinds.map(function (k) {
41
+ var c = el('input', { type: 'checkbox', checked: P.kinds.indexOf(k.kind) >= 0, 'aria-label': k.label });
42
+ c.addEventListener('change', function () { P.kinds = P.kinds.filter(function (x) { return x !== k.kind; }); if (c.checked) P.kinds.push(k.kind); renderTenant(); });
43
+ return el('label', { className: 'check' }, c, k.label);
44
+ }));
45
+ w.appendChild(el('section', { className: 'card' }, el('div', { className: 'card-h' }, el('h3', {}, 'Compare ', el('span', { className: 'pill blue', text: P.info.tenant }), ' with ', el('span', { className: 'pill blue', text: P.info.other })),
46
+ el('button', { className: 'btn ghost sm', onclick: function () { api('/api/compare/disconnect', 'POST', {}).then(function () { P.info.other = null; P.data = null; renderTenant(); }); } }, 'Disconnect other tenant')),
47
+ boxes,
48
+ el('p', { className: 'muted small', text: '"Where rules are used" compares which sources, transforms, identity profiles, identity attributes and provisioning policies use each rule: a rule used in one tenant and not the other is a deployment gap. Connector rules are compared in full, code included.' }),
49
+ (function () {
50
+ var c = el('input', { type: 'checkbox', checked: !!P.cloudRuleCode, 'aria-describedby': 'cloud-rule-note' });
51
+ c.addEventListener('change', function () { P.cloudRuleCode = c.checked; renderTenant(); });
52
+ return el('div', { className: 'note', style: 'margin-top:10px' },
53
+ el('label', { className: 'check', style: 'font-weight:600' }, c, 'Also compare cloud rule code'),
54
+ el('div', { id: 'cloud-rule-note', className: 'small', style: 'margin-top:4px', text: 'ISC has no plain read for cloud rules. With this on, IdentityScope starts one SP-Config export job of rules in each tenant, waits for it and compares the code. The export reads configuration and changes nothing, but it is a job you will see in the tenant, and the API client needs SP-Config access (the sp:config:read or sp:config:manage scope). Off by default; not used by change history or the drift check.' }));
55
+ })(),
56
+ el('div', { className: 'bar', style: 'margin-top:12px' },
57
+ el('button', { className: 'btn primary', disabled: !!P.busy || (!P.kinds.length && !P.cloudRuleCode), onclick: function () { runJobInto(P, '/api/compare/run', { kinds: P.kinds, cloudRuleCode: !!P.cloudRuleCode }, renderTenant); } }, icon('cols'), 'Compare'),
58
+ el('button', { className: 'btn ghost sm', onclick: function () { P.kinds = P.info.kinds.map(function (k) { return k.kind; }); renderTenant(); } }, 'All'),
59
+ el('button', { className: 'btn ghost sm', onclick: function () { P.kinds = []; renderTenant(); } }, 'None'))));
60
+ if (P.busy) { w.appendChild(busyBox(P.busy)); return; }
61
+ if (P.error) { w.appendChild(el('div', { className: 'error', text: P.error })); return; }
62
+ var d = P.data;
63
+ if (!d) return;
64
+ w.appendChild(el('div', { className: 'bar', style: 'justify-content:flex-end;margin-bottom:10px' }, downloads(P.job)));
65
+ w.appendChild(simpleTable(['Type', 'Only in ' + d.a, 'Only in ' + d.b, 'Different', 'Same'], d.kinds.map(function (k) {
66
+ return [k.label, k.error ? el('span', { className: 'chg lose', text: k.error }) : k.onlyA.length, k.error ? null : k.onlyB.length, k.error ? null : (k.different.length ? el('span', { className: 'chg lose', text: String(k.different.length) }) : 0), k.error ? null : k.same];
67
+ })));
68
+ var ignored = (P.info && P.info.ignore) || [];
69
+ if (ignored.length) {
70
+ w.appendChild(el('div', { className: 'note', style: 'margin:12px 0' }, el('b', { text: 'Ignored settings: ' }),
71
+ el('span', {}, ignored.map(function (key) {
72
+ var parts = key.split('|'), label = (P.info.kinds.filter(function (k) { return k.kind === parts[0]; })[0] || { label: parts[0] }).label;
73
+ return el('span', { className: 'chip', style: 'display:inline-flex;gap:6px;align-items:center;margin:2px 6px 2px 0' }, label + ': ', el('code', { text: parts.slice(1).join('|') }),
74
+ el('button', { className: 'linkbtn small', 'aria-label': 'Stop ignoring ' + parts.slice(1).join('|'), onclick: function () { cmpIgnore(P, parts[0], parts.slice(1).join('|'), false); } }, 'undo'));
75
+ })),
76
+ el('div', { className: 'small muted', text: 'Undo takes effect at the next Compare.' })));
77
+ }
78
+ d.kinds.forEach(function (k) {
79
+ if (k.error || (!k.onlyA.length && !k.onlyB.length && !k.different.length)) return;
80
+ var body = el('div');
81
+ if (k.onlyA.length) body.appendChild(el('p', {}, el('b', { text: 'Only in ' + d.a + ': ' }), k.onlyA.join(', ')));
82
+ if (k.onlyB.length) body.appendChild(el('p', {}, el('b', { text: 'Only in ' + d.b + ': ' }), k.onlyB.join(', ')));
83
+ if (k.different.length > 1) {
84
+ // Which settings differ most often: usually tenant-specific values (cluster, owner) worth ignoring.
85
+ var counts = {};
86
+ k.different.forEach(function (x) { var seen = {}; x.differences.forEach(function (y) { var key = cmpKey(y.path); if (!seen[key]) { seen[key] = 1; counts[key] = (counts[key] || 0) + 1; } }); });
87
+ var top = Object.keys(counts).sort(function (a, b) { return counts[b] - counts[a]; }).slice(0, 8);
88
+ body.appendChild(el('div', { className: 'note', style: 'margin:8px 0' }, el('b', { text: 'Most common differences: ' }),
89
+ el('div', {}, top.map(function (key) {
90
+ return el('div', { style: 'display:flex;gap:10px;align-items:center;margin:3px 0' }, el('code', { text: key }), el('span', { className: 'muted small', text: counts[key] + ' of ' + k.different.length }),
91
+ el('button', { className: 'btn ghost sm', 'aria-label': 'Ignore ' + key + ' for ' + k.label, onclick: function () { cmpIgnore(P, k.kind, key, true); } }, 'Ignore'));
92
+ })),
93
+ el('div', { className: 'small muted', text: 'Ignore a setting that is meant to differ between tenants (for example a cluster or an owner). It is remembered on this computer for future comparisons.' })));
94
+ }
95
+ k.different.forEach(function (x) {
96
+ body.appendChild(el('details', { className: 'adv', style: 'margin:8px 0' }, el('summary', { text: x.name + ' (' + x.differences.length + ' difference' + (x.differences.length > 1 ? 's' : '') + ')' }),
97
+ simpleTable(['Setting', d.a, d.b], x.differences.map(function (y) { return [y.path, y.a, y.b]; }))));
98
+ });
99
+ w.appendChild(section(k.label, null, body));
100
+ });
101
+ }
102
+
@@ -0,0 +1,181 @@
1
+ // ---------- Audit (Certifications, Separation of duties, Review coverage, Access outliers, Provisioning speed, Change history, Evidence pack) ----------
2
+ state.au = { tab: 'certs' };
3
+ function renderAudit() {
4
+ var outer = $('certs');
5
+ outer.textContent = '';
6
+ var w = el('div', { className: 'wrap', style: 'max-width:1240px' });
7
+ outer.appendChild(w);
8
+ w.appendChild(el('div', { className: 'rhead', style: 'margin-bottom:4px' }, el('span', { className: 'cat-ico', style: 'color:#be185d;background:#fce8f1' }, icon('cert')),
9
+ el('div', {}, el('h2', { text: 'Audit' }), el('p', { className: 'desc', text: 'Certifications, separation of duties, review coverage, access outliers, provisioning speed, configuration changes and a ready-made evidence pack for auditors. Read-only.' }))));
10
+ groupedTabs(w, 'au', AU_GROUPS, AU_TABS, state.au.tab, function (id) { state.au.tab = id; renderAudit(); });
11
+ if (state.au.tab === 'sod') renderSod(w);
12
+ else if (state.au.tab === 'changes') renderChanges(w);
13
+ else if (state.au.tab === 'evidence') renderEvidence(w);
14
+ else if (state.au.tab === 'coverage') renderCoverage(w);
15
+ else if (state.au.tab === 'outliers') renderOutliers(w);
16
+ else if (state.au.tab === 'speed') renderSpeed(w);
17
+ else if (state.au.tab === 'adminaccts') renderAdminAccounts(w);
18
+ else if (state.au.tab === 'exceptions') renderExceptions(w);
19
+ else if (state.au.tab === 'trail') renderRequestTrail(w);
20
+ else if (state.au.tab === 'chain') renderApproverChain(w);
21
+ else if (state.au.tab === 'leavertimes') renderLeaverTimes(w);
22
+ else if (state.au.tab === 'attrhist') renderAttrHistory(w);
23
+ else if (state.au.tab === 'owners') renderOwners(w);
24
+ else if (state.au.tab === 'outmodel') renderOutsideModel(w);
25
+ else if (state.au.tab === 'composition') renderComposition(w);
26
+ else if (state.au.tab === 'reassigned') renderReassigned(w);
27
+ else certsTab(w);
28
+ }
29
+ function moneyText(n, cur) { return n === null || n === undefined ? '—' : (cur ? cur + ' ' : '') + Number(n).toLocaleString('en-US', { minimumFractionDigits: 0, maximumFractionDigits: 2 }); }
30
+ function loadInsightSettings(then) {
31
+ api('/api/insights/settings').then(function (s) { state.ins = s; then(); }).catch(function (e) { toast(errorText(e)); });
32
+ }
33
+
34
+ // separation of duties
35
+ state.sd = {};
36
+ function renderSod(w) {
37
+ var S = state.sd;
38
+ if (!state.ins) { w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading...')); loadInsightSettings(renderAudit); return; }
39
+ if (!S.rules) S.rules = clone(state.ins.sod || []);
40
+ var msg = el('div');
41
+ var list = el('div');
42
+ var draw = function () {
43
+ list.textContent = '';
44
+ if (!S.rules.length) list.appendChild(el('div', { className: 'muted', style: 'margin-bottom:10px', text: 'No rules yet. Example: "Create vendor" and "Approve payment" should not be held by the same person.' }));
45
+ S.rules.forEach(function (r, i) {
46
+ var name = el('input', { className: 'input', value: r.name || '', placeholder: 'Rule name, e.g. Create and approve payments' });
47
+ name.addEventListener('input', function () { r.name = name.value; });
48
+ var desc = el('input', { className: 'input', value: r.description || '', placeholder: 'Why (optional), e.g. SOX control FIN-07' });
49
+ desc.addEventListener('input', function () { r.description = desc.value; });
50
+ list.appendChild(el('div', { className: 'card', style: 'margin-bottom:10px;padding:14px' },
51
+ el('div', { className: 'grid', style: 'grid-template-columns:1fr 1fr auto;align-items:end' },
52
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Rule' }), name),
53
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Reason' }), desc),
54
+ el('button', { className: 'btn ghost sm', title: 'Remove rule', onclick: function () { S.rules.splice(i, 1); draw(); } }, icon('trash'))),
55
+ el('div', { className: 'grid', style: 'grid-template-columns:1fr 1fr;margin-top:10px' },
56
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Side A: any of' }), tokenInput({ value: r.sideA || [], placeholder: 'Access name, e.g. SF Admin (Salesforce)', onChange: function (v) { r.sideA = v; } })),
57
+ el('label', { className: 'field', style: 'margin:0' }, el('span', { className: 'lbl', text: 'Side B: any of' }), tokenInput({ value: r.sideB || [], placeholder: 'Access name, e.g. Approve Payments', onChange: function (v) { r.sideB = v; } })))));
58
+ });
59
+ };
60
+ draw();
61
+ w.appendChild(section('Rules', S.rules.length, el('div', {},
62
+ el('p', { className: 'muted small', style: 'margin-top:0', text: 'A person breaks a rule when they hold at least one item of side A and one of side B. Use the name of an entitlement, access profile or role as ISC shows it; add the source in brackets to be exact: "Domain Admins (Active Directory)". Matching ignores case.' }),
63
+ list,
64
+ el('div', { className: 'bar' },
65
+ el('button', { className: 'btn', onclick: function () { S.rules.push({ name: '', sideA: [], sideB: [] }); draw(); } }, icon('plus'), 'Add rule'),
66
+ el('button', { className: 'btn', onclick: function () {
67
+ msg.textContent = '';
68
+ api('/api/sod/rules', 'PUT', { rules: S.rules }).then(function () { state.ins.sod = clone(S.rules); toast('Rules saved'); }).catch(function (e) { msg.appendChild(el('div', { className: 'error', text: errorText(e) })); });
69
+ } }, icon('save'), 'Save rules'),
70
+ el('span', { style: 'flex:1' }),
71
+ el('button', { className: 'btn primary', disabled: !!S.busy, onclick: function () {
72
+ msg.textContent = '';
73
+ api('/api/sod/rules', 'PUT', { rules: S.rules }).then(function () { state.ins.sod = clone(S.rules); runJobInto(S, '/api/sod/run', {}, renderAudit); }).catch(function (e) { msg.appendChild(el('div', { className: 'error', text: errorText(e) })); });
74
+ } }, icon('play'), S.data ? 'Check again' : 'Save and check')),
75
+ msg)));
76
+ if (S.busy) { w.appendChild(busyBox(S.busy)); return; }
77
+ if (S.error) { w.appendChild(el('div', { className: 'error', text: S.error })); return; }
78
+ var d = S.data;
79
+ if (!d) return;
80
+ d.notes.forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
81
+ w.appendChild(el('div', { className: 'banner ' + (d.violations.length ? 'bad' : 'ok') }, el('b', { text: d.violations.length ? fmtNum(d.violations.length) + ' violation' + (d.violations.length > 1 ? 's' : '') : 'No violations' }), el('span', { className: 'muted', text: fmtNum(d.peopleChecked) + ' people checked' }), el('span', { style: 'flex:1' }), downloads(S.job)));
82
+ w.appendChild(section('Per rule', null, simpleTable(['Rule', 'Reason', 'People'], d.rules.map(function (r) { return [r.name, r.description, r.violations ? el('span', { className: 'chg lose', text: String(r.violations) }) : 0]; }))));
83
+ if (d.violations.length) w.appendChild(section('People who break a rule', d.violations.length, simpleTable(['Rule', 'Person', 'Username', 'Lifecycle state', 'Holds (side A)', 'Holds (side B)'], d.violations.slice(0, 2000).map(function (v) {
84
+ return [v.rule, el('button', { className: 'btn link', style: 'padding:0', text: v.person, onclick: function () { openPerson(v.personId); } }), v.username, v.lifecycleState, v.heldA.join(', '), v.heldB.join(', ')];
85
+ }))));
86
+ }
87
+
88
+ // configuration change history
89
+ state.ch = {};
90
+ function changeTable(d, labels) {
91
+ var box = el('div');
92
+ box.appendChild(simpleTable(['Type', labels[1], labels[0], 'Changed', 'Unchanged'], d.kinds.map(function (k) {
93
+ return [k.label, k.error ? el('span', { className: 'chg lose', text: k.error }) : (k.onlyB.length ? el('span', { className: 'chg gain', text: String(k.onlyB.length) }) : 0), k.error ? null : (k.onlyA.length ? el('span', { className: 'chg lose', text: String(k.onlyA.length) }) : 0), k.error ? null : (k.different.length ? el('span', { className: 'chg lose', text: String(k.different.length) }) : 0), k.error ? null : k.same];
94
+ })));
95
+ d.kinds.forEach(function (k) {
96
+ if (k.error || (!k.onlyA.length && !k.onlyB.length && !k.different.length)) return;
97
+ var body = el('div');
98
+ if (k.onlyB.length) body.appendChild(el('p', {}, el('b', { text: labels[1] + ': ' }), k.onlyB.join(', ')));
99
+ if (k.onlyA.length) body.appendChild(el('p', {}, el('b', { text: labels[0] + ': ' }), k.onlyA.join(', ')));
100
+ k.different.forEach(function (x) {
101
+ body.appendChild(el('details', { className: 'adv', style: 'margin:8px 0' }, el('summary', { text: x.name + ' (' + x.differences.length + ' change' + (x.differences.length > 1 ? 's' : '') + ')' }),
102
+ simpleTable(['Setting', labels[2], labels[3]], x.differences.map(function (y) { return [y.path, y.a, y.b]; }))));
103
+ });
104
+ box.appendChild(section(k.label, null, body));
105
+ });
106
+ return box;
107
+ }
108
+ function renderChanges(w) {
109
+ // What changed between two snapshots, then drift from the approved baseline (the release that went live).
110
+ var top = el('div');
111
+ w.appendChild(top);
112
+ renderChangesBetween(top);
113
+ var drift = el('div', { style: 'margin-top:26px' }, el('h3', { style: 'margin:0 0 8px', text: 'Drift from an approved baseline' }));
114
+ w.appendChild(drift);
115
+ renderDrift(drift);
116
+ }
117
+ function renderChangesBetween(w) {
118
+ var H = state.ch;
119
+ if (!H.days) {
120
+ w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading...'));
121
+ api('/api/changes').then(function (r) { H.days = r.days; H.from = r.days[1] || r.days[0] || ''; H.to = r.days[0] || ''; renderAudit(); }).catch(function (e) { w.appendChild(el('div', { className: 'error', text: errorText(e) })); });
122
+ return;
123
+ }
124
+ var snapBtn = el('button', { className: 'btn' + (H.days.length ? '' : ' primary'), disabled: !!H.busy, onclick: function () {
125
+ runJobInto(H, '/api/changes/snapshot', {}, function () { if (!H.busy && !H.error) { H.days = null; H.diff = null; } renderAudit(); });
126
+ } }, icon('save'), 'Take a snapshot now');
127
+ w.appendChild(el('div', { className: 'bar', style: 'margin-bottom:14px' }, el('span', { className: 'muted', style: 'flex:1', text: 'A snapshot keeps the settings of sources, transforms, identity profiles, roles, access profiles and workflows on this computer (secrets hidden). Scheduled instant checks save one every day by themselves. Compare two days to see what changed.' }), snapBtn));
128
+ if (H.busy) { w.appendChild(busyBox(H.busy)); return; }
129
+ if (H.error) w.appendChild(el('div', { className: 'error', text: H.error }));
130
+ if (H.days.length < 2) {
131
+ w.appendChild(el('div', { className: 'empty' }, el('b', { text: H.days.length ? 'One snapshot so far (' + H.days[0] + ')' : 'No snapshots yet' }), 'Take a snapshot now and another one later (or schedule the instant check daily); then pick two days to compare.'));
132
+ return;
133
+ }
134
+ var mk = function (v, set, label) { var s = el('select', { className: 'input', style: 'width:auto', 'aria-label': label }, H.days.map(function (d) { return el('option', { value: d, text: d }); })); s.value = v; s.addEventListener('change', function () { set(s.value); }); return s; };
135
+ w.appendChild(el('section', { className: 'card' }, el('div', { className: 'bar' }, el('span', { text: 'What changed from' }), mk(H.from, function (v) { H.from = v; }, 'From snapshot'), el('span', { text: 'to' }), mk(H.to, function (v) { H.to = v; }, 'To snapshot'),
136
+ el('button', { className: 'btn primary', onclick: function () {
137
+ H.diff = 'loading'; renderAudit();
138
+ api('/api/changes/diff?from=' + H.from + '&to=' + H.to).then(function (r) { H.diff = r; renderAudit(); }).catch(function (e) { H.diff = null; H.error = errorText(e); renderAudit(); });
139
+ } }, icon('cols'), 'Show changes'),
140
+ el('span', { className: 'muted small', text: H.days.length + ' snapshots kept' }))));
141
+ if (H.diff === 'loading') { w.appendChild(busyBox('Comparing...')); return; }
142
+ if (H.diff) {
143
+ var n = H.diff.kinds.reduce(function (s, k) { return s + k.onlyA.length + k.onlyB.length + k.different.length; }, 0);
144
+ w.appendChild(el('div', { className: 'banner ' + (n ? 'warn' : 'ok') }, el('b', { text: n ? fmtNum(n) + ' change' + (n > 1 ? 's' : '') + ' from ' + H.diff.from + ' to ' + H.diff.to : 'Nothing changed from ' + H.diff.from + ' to ' + H.diff.to })));
145
+ w.appendChild(changeTable(H.diff, ['Removed', 'Added', H.diff.from, H.diff.to]));
146
+ }
147
+ }
148
+
149
+ // evidence pack
150
+ state.ev = { days: 365 };
151
+ function renderEvidence(w) {
152
+ var E = state.ev;
153
+ if (!E.sections) {
154
+ w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading...'));
155
+ api('/api/evidence').then(function (r) { E.sections = r.sections; E.chosen = r.sections.map(function (s) { return s.id; }); renderAudit(); });
156
+ return;
157
+ }
158
+ var period = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Period' }, [[90, 'Last 90 days'], [180, 'Last 180 days'], [365, 'Last year'], [730, 'Last 2 years']].map(function (o) { return el('option', { value: String(o[0]), text: o[1] }); }));
159
+ period.value = String(E.days);
160
+ period.addEventListener('change', function () { E.days = Number(period.value); });
161
+ w.appendChild(section('What goes into the pack', null, el('div', {},
162
+ el('p', { className: 'muted small', style: 'margin-top:0', text: 'One zip for your auditors: an Excel file per part, a README saying when, by whom and from which tenant it was produced, and SHA-256 fingerprints (SHA256SUMS.txt) so they can check nothing was changed afterwards. Nothing is sent anywhere; you download it.' }),
163
+ el('div', { className: 'checklist' }, E.sections.map(function (s) {
164
+ var c = el('input', { type: 'checkbox', checked: E.chosen.indexOf(s.id) >= 0 });
165
+ c.addEventListener('change', function () { E.chosen = E.chosen.filter(function (x) { return x !== s.id; }); if (c.checked) E.chosen.push(s.id); });
166
+ return el('label', { className: 'cl-item' }, c, el('span', {}, el('b', { text: s.label }), el('span', { className: 'muted small', text: ' — ' + s.description })));
167
+ })),
168
+ el('div', { className: 'bar', style: 'margin-top:12px' }, el('span', { text: 'Period for leavers and requests' }), period, el('span', { style: 'flex:1' }),
169
+ el('button', { className: 'btn primary', disabled: !!E.busy, onclick: function () { runJobInto(E, '/api/evidence/run', { sections: E.chosen, days: E.days }, renderAudit); } }, icon('play'), 'Build the pack')))));
170
+ if (E.busy) { w.appendChild(busyBox(E.busy)); return; }
171
+ if (E.error) { w.appendChild(el('div', { className: 'error', text: E.error })); return; }
172
+ var d = E.data;
173
+ if (!d) return;
174
+ var bad = d.files.filter(function (f) { return f.error; }).length;
175
+ w.appendChild(el('div', { className: 'banner ' + (bad ? 'warn' : 'ok') }, el('b', { text: (d.files.length - bad) + ' of ' + d.files.length + ' parts ready' }), el('span', { className: 'muted', text: d.fileName }), el('span', { style: 'flex:1' }),
176
+ el('a', { className: 'btn primary sm', href: '/api/evidence/' + E.job + '/download?k=' + encodeURIComponent(KEY), download: '' }, icon('download'), 'Download zip')));
177
+ w.appendChild(section('Contents', d.files.length, simpleTable(['Part', 'File', 'Rows', 'SHA-256 fingerprint'], d.files.map(function (f) {
178
+ return [f.section, f.error ? el('span', { className: 'chg lose', text: 'not included' }) : f.name, f.rows === null ? null : fmtNum(f.rows), f.error ? f.error : el('code', { className: 'small', text: f.sha256.slice(0, 16) + '…' })];
179
+ }))));
180
+ }
181
+
@@ -0,0 +1,108 @@
1
+ // ---------- Insights (Monthly report, License reclaim, Access requests) ----------
2
+ state.inz = { tab: 'monthly' };
3
+ function renderInsights() {
4
+ var outer = $('monthly');
5
+ outer.textContent = '';
6
+ var w = el('div', { className: 'wrap', style: 'max-width:1240px' });
7
+ outer.appendChild(w);
8
+ w.appendChild(el('div', { className: 'rhead', style: 'margin-bottom:4px' }, el('span', { className: 'cat-ico', style: 'color:#0e7c66;background:#e3f5f0' }, icon('sigma')),
9
+ el('div', {}, el('h2', { text: 'Insights' }), el('p', { className: 'desc', text: 'The monthly report for management, licenses you could reclaim, and how access requests flow. Read-only.' }))));
10
+ var tabs = el('div', { className: 'tabs' });
11
+ [['monthly', 'Monthly report', 'file'], ['reclaim', 'License reclaim', 'down'], ['requests', 'Access requests', 'inbox']].forEach(function (t) {
12
+ tabs.appendChild(el('button', { className: 'tab' + (state.inz.tab === t[0] ? ' active' : ''), onclick: function () { state.inz.tab = t[0]; if (t[0] === 'monthly') state.mr.data = null; renderInsights(); } }, icon(t[2]), t[1]));
13
+ });
14
+ w.appendChild(tabs);
15
+ if (state.inz.tab === 'reclaim') renderReclaim(w);
16
+ else if (state.inz.tab === 'requests') renderRequests(w);
17
+ else monthlyTab(w);
18
+ }
19
+
20
+ // license reclaim
21
+ state.rc = {};
22
+ function renderReclaim(w) {
23
+ var R = state.rc;
24
+ if (!state.ins) { w.appendChild(el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading...')); loadInsightSettings(renderInsights); return; }
25
+ var cfg = state.ins.reclaim || {};
26
+ if (!R.form) R.form = { dormantDays: cfg.dormantDays || 90, currency: cfg.currency || '', leaverStates: (cfg.leaverStates || ['inactive', 'terminated']).slice(), sources: clone(cfg.sources || {}) };
27
+ var F = R.form;
28
+ var sources = R.sources;
29
+ if (!sources) loadPick('sources').then(function (list) { R.sources = list; if (state.page === 'monthly' && state.inz.tab === 'reclaim') renderInsights(); }).catch(function (e) { toast(errorText(e)); });
30
+ var msg = el('div');
31
+ var days = el('input', { className: 'input', type: 'number', min: '7', value: String(F.dormantDays), style: 'width:100px', 'aria-label': 'Dormant after (days)' });
32
+ days.addEventListener('input', function () { F.dormantDays = Number(days.value); });
33
+ var cur = el('input', { className: 'input', value: F.currency, placeholder: 'USD', style: 'width:90px', 'aria-label': 'Currency' });
34
+ cur.addEventListener('input', function () { F.currency = cur.value; });
35
+ var rows = (sources || []).map(function (s) {
36
+ var one = F.sources[s.label] || {};
37
+ var cost = el('input', { className: 'input', type: 'number', min: '0', step: '0.01', 'aria-label': 'Cost per account per month for ' + s.label, value: one.cost === undefined ? '' : String(one.cost), placeholder: 'e.g. 12.50', style: 'width:120px' });
38
+ cost.addEventListener('input', function () { F.sources[s.label] = F.sources[s.label] || {}; F.sources[s.label].cost = cost.value === '' ? undefined : Number(cost.value); });
39
+ var ll = el('input', { className: 'input', 'aria-label': 'Last login attribute for ' + s.label, value: one.lastLogin || '', placeholder: s.hint && /active directory/i.test(s.hint) ? 'lastLogonTimestamp' : 'attribute name', style: 'width:220px' });
40
+ ll.addEventListener('input', function () { F.sources[s.label] = F.sources[s.label] || {}; F.sources[s.label].lastLogin = ll.value; });
41
+ return [s.label, s.hint, cost, ll];
42
+ });
43
+ w.appendChild(el('details', { className: 'card adv', open: !Object.keys(cfg.sources || {}).length || null }, el('summary', { style: 'font-weight:600', text: 'Settings: cost per account and sign-in dates' }),
44
+ el('p', { className: 'muted small', text: 'Cost: what one account on the application costs per month (license or subscription), to estimate savings. Sign-in attribute: the account attribute that holds the last sign-in date, for example lastLogonTimestamp for Active Directory. It must be in the source’s account schema in ISC. Leave both empty for sources you do not pay for.' }),
45
+ el('div', { className: 'bar', style: 'margin-bottom:10px' }, el('span', { text: 'Dormant after' }), days, el('span', { text: 'days without sign-in. Currency' }), cur,
46
+ el('span', { text: 'People have left when lifecycle state is' }), tokenInput({ value: F.leaverStates, onChange: function (v) { F.leaverStates = v; } })),
47
+ sources ? simpleTable(['Source', 'Type', 'Monthly cost per account', 'Sign-in date attribute'], rows) : el('div', { className: 'progress' }, el('span', { className: 'spinner' }), 'Loading sources...'),
48
+ el('div', { className: 'bar', style: 'margin-top:10px' }, el('button', { className: 'btn', onclick: function () {
49
+ msg.textContent = '';
50
+ api('/api/reclaim/settings', 'PUT', F).then(function () { return loadInsightSettings(function () { R.form = null; toast('Settings saved'); renderInsights(); }); }).catch(function (e) { msg.appendChild(el('div', { className: 'error', text: errorText(e) })); });
51
+ } }, icon('save'), 'Save settings')), msg));
52
+ w.appendChild(el('div', { className: 'bar', style: 'margin:14px 0' }, el('span', { className: 'muted', style: 'flex:1', text: 'Finds enabled accounts of people who left and accounts nobody signed in with for a long time, so licenses can be taken back. Disabling them is up to you in ISC.' }),
53
+ el('button', { className: 'btn primary', disabled: !!R.busy, onclick: function () { runJobInto(R, '/api/reclaim/run', {}, renderInsights); } }, icon('play'), R.data ? 'Look again' : 'Find licenses to reclaim')));
54
+ if (R.busy) { w.appendChild(busyBox(R.busy)); return; }
55
+ if (R.error) { w.appendChild(el('div', { className: 'error', text: R.error })); return; }
56
+ var d = R.data;
57
+ if (!d) return;
58
+ d.notes.forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
59
+ var T = d.totals;
60
+ w.appendChild(el('div', { className: 'bigstats' },
61
+ el('div', { className: 'bigstat' + (T.accounts ? ' lose' : '') }, el('b', { text: fmtNum(T.accounts) }), el('span', { text: 'accounts to reclaim' })),
62
+ el('div', { className: 'bigstat' }, el('b', { text: fmtNum(T.leaver) }), el('span', { text: 'held by people who left' })),
63
+ el('div', { className: 'bigstat' }, el('b', { text: fmtNum(T.dormant) }), el('span', { text: 'no sign-in for ' + d.dormantDays + '+ days' })),
64
+ el('div', { className: 'bigstat' + (T.monthly ? ' gain' : '') }, el('b', { text: T.priced ? moneyText(T.monthly, d.currency) : '—' }), el('span', { text: 'possible saving per month' })),
65
+ el('div', { className: 'bigstat' + (T.yearly ? ' gain' : '') }, el('b', { text: T.priced ? moneyText(T.yearly, d.currency) : '—' }), el('span', { text: 'per year' }))));
66
+ w.appendChild(section('By application', d.sources.length, simpleTable(['Source', 'People who left', 'Dormant', 'Cost per account', 'Per month', 'Per year'], d.sources.map(function (s) {
67
+ return [el('button', { className: 'btn link', style: 'padding:0', text: s.source, onclick: function () { R.only = R.only === s.source ? null : s.source; renderInsights(); } }), s.leaver, s.dormant, moneyText(s.costPerAccount, d.currency), moneyText(s.monthly, d.currency), moneyText(s.yearly, d.currency)];
68
+ }))));
69
+ var list = d.rows.filter(function (r) { return !R.only || r.source === R.only; });
70
+ w.appendChild(section(R.only ? 'Accounts on ' + R.only : 'Accounts', list.length, el('div', {}, el('div', { className: 'bar', style: 'justify-content:flex-end;margin-bottom:8px' }, R.only ? el('button', { className: 'btn ghost sm', onclick: function () { R.only = null; renderInsights(); } }, 'Show all') : null, downloads(R.job)),
71
+ simpleTable(['Source', 'Account', 'Person', 'Why', 'Last sign-in', 'Privileged'], list.slice(0, 2000).map(function (r) {
72
+ return [r.source, r.account, r.person, el('span', { className: 'chg ' + (r.reason === 'Person has left' ? 'lose' : 'off'), text: r.reason + (r.lifecycleState && r.reason === 'Person has left' ? ' (' + r.lifecycleState + ')' : '') }), r.lastLogin ? r.lastLogin.slice(0, 10) + ' (' + r.daysSince + ' days)' : null, yesNo(r.privileged, true)];
73
+ })))));
74
+ }
75
+
76
+ // access requests
77
+ state.rq = { days: 90 };
78
+ function renderRequests(w) {
79
+ var Q = state.rq;
80
+ var period = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Period' }, [[30, 'Last 30 days'], [90, 'Last 90 days'], [180, 'Last 180 days'], [365, 'Last year']].map(function (o) { return el('option', { value: String(o[0]), text: o[1] }); }));
81
+ period.value = String(Q.days);
82
+ period.addEventListener('change', function () { Q.days = Number(period.value); });
83
+ w.appendChild(el('div', { className: 'bar', style: 'margin-bottom:14px' }, el('span', { className: 'muted', style: 'flex:1', text: 'How long requests wait for approval, which approvers are slow or have requests waiting, and which access is requested and rejected most. An admin sign-in sees everyone’s requests.' }), period,
84
+ el('button', { className: 'btn primary', disabled: !!Q.busy, onclick: function () { runJobInto(Q, '/api/requests/run', { days: Q.days }, renderInsights); } }, icon('play'), Q.data ? 'Read again' : 'Read requests')));
85
+ if (Q.busy) { w.appendChild(busyBox(Q.busy)); return; }
86
+ if (Q.error) { w.appendChild(el('div', { className: 'error', text: Q.error })); return; }
87
+ var d = Q.data;
88
+ if (!d) return;
89
+ d.notes.forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
90
+ var T = d.totals;
91
+ var hrs = function (h) { return h === null ? '—' : h < 48 ? h + ' h' : Math.round(h / 24 * 10) / 10 + ' days'; };
92
+ w.appendChild(el('div', { className: 'bigstats' },
93
+ el('div', { className: 'bigstat' }, el('b', { text: fmtNum(T.requests) }), el('span', { text: 'requests in ' + d.days + ' days' })),
94
+ el('div', { className: 'bigstat' }, el('b', { text: hrs(T.medianHoursToApprove) }), el('span', { text: 'typical wait for an approval' })),
95
+ el('div', { className: 'bigstat' }, el('b', { text: hrs(T.medianHoursToComplete) }), el('span', { text: 'typical time to get the access' })),
96
+ el('div', { className: 'bigstat' }, el('b', { text: fmtNum(T.rejected) }), el('span', { text: 'rejected' })),
97
+ el('div', { className: 'bigstat' + (T.open ? ' lose' : '') }, el('b', { text: fmtNum(T.open) }), el('span', { text: 'still open' })),
98
+ el('div', { className: 'bigstat' + (T.failed ? ' lose' : '') }, el('b', { text: fmtNum(T.failed) }), el('span', { text: 'failed' }))));
99
+ if (d.weekly.length > 1) w.appendChild(section('Requests per week', null, el('div', { style: 'color:var(--accent)' }, sparkline(d.weekly.map(function (x) { return { value: x.requests }; }), 900, 60), el('div', { className: 'muted small', text: d.weekly[0].week + ' to ' + d.weekly[d.weekly.length - 1].week }))));
100
+ w.appendChild(section('Approvers', d.approvers.length, el('div', {}, el('div', { className: 'bar', style: 'justify-content:flex-end;margin-bottom:8px' }, downloads(Q.job)),
101
+ simpleTable(['Approver', 'Decisions', 'Approved', 'Rejected', 'Typical time to decide', 'Waiting now', 'Oldest waiting'], d.approvers.map(function (a) {
102
+ return [a.name, a.decisions, a.approved, a.rejected, hrs(a.medianHours), a.pending ? el('span', { className: 'chg lose', text: String(a.pending) }) : 0, a.oldestPendingDays === null ? null : a.oldestPendingDays + ' days'];
103
+ })))));
104
+ w.appendChild(section('Most requested access', d.items.length, simpleTable(['Access', 'Type', 'Requests', 'Completed', 'Rejected', 'Reject rate'], d.items.slice(0, 100).map(function (i) {
105
+ return [i.name, i.type, i.requests, i.completed, i.rejected, i.rejectRate === null ? null : (i.rejectRate >= 50 && i.rejected > 1 ? el('span', { className: 'chg lose', text: i.rejectRate + '%' }) : i.rejectRate + '%')];
106
+ }))));
107
+ }
108
+
@@ -0,0 +1,35 @@
1
+ // ---------- role mining (a Role tools tab) ----------
2
+ state.mn = { attribute: 'department', minGroup: 5, minShare: 80 };
3
+ function renderMining(w) {
4
+ var M = state.mn;
5
+ var attrs = identityAttrs();
6
+ var names = attrs.map(function (a) { return a.name; });
7
+ if (names.indexOf(M.attribute) < 0) names.unshift(M.attribute);
8
+ var attr = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Group people by' }, names.map(function (n) { return el('option', { value: n, text: n }); }));
9
+ attr.value = M.attribute;
10
+ attr.addEventListener('change', function () { M.attribute = attr.value; });
11
+ var minG = el('input', { className: 'input', type: 'number', min: '1', value: String(M.minGroup), style: 'width:80px', 'aria-label': 'Smallest group size' });
12
+ minG.addEventListener('input', function () { M.minGroup = Number(minG.value); });
13
+ var share = el('select', { className: 'input', style: 'width:auto', 'aria-label': 'Held by at least' }, [60, 70, 80, 90, 100].map(function (n) { return el('option', { value: String(n), text: n + '%' }); }));
14
+ share.value = String(M.minShare);
15
+ share.addEventListener('change', function () { M.minShare = Number(share.value); });
16
+ w.appendChild(el('section', { className: 'card' },
17
+ el('p', { className: 'muted', style: 'margin-top:0', text: 'Groups people by an identity attribute (department, job title, location...) and lists the entitlements most of each group already hold. Those are candidates for a birthright role with that attribute as membership criteria. Items an existing role already gives are marked.' }),
18
+ el('div', { className: 'bar' }, el('span', { text: 'Group people by' }), attr, el('span', { text: 'groups of at least' }), minG, el('span', { text: 'people, access held by at least' }), share,
19
+ el('button', { className: 'btn primary', disabled: !!M.busy, onclick: function () { runJobInto(M, '/api/mining/run', { attribute: M.attribute, minGroup: M.minGroup, minShare: M.minShare }, renderRoles); } }, icon('play'), 'Find candidate roles'))));
20
+ if (M.busy) { w.appendChild(busyBox(M.busy)); return; }
21
+ if (M.error) { w.appendChild(el('div', { className: 'error', text: M.error })); return; }
22
+ var d = M.data;
23
+ if (!d) return;
24
+ d.notes.forEach(function (n) { w.appendChild(el('div', { className: 'note', text: n })); });
25
+ var fresh = d.candidates.filter(function (c) { return c.newItems > 0; }).length;
26
+ w.appendChild(el('div', { className: 'banner ' + (fresh ? 'warn' : 'ok') }, el('b', { text: fresh ? fresh + ' group' + (fresh > 1 ? 's have' : ' has') + ' common access no role gives yet' : 'No new candidate roles' }), el('span', { className: 'muted', text: fmtNum(d.peopleChecked) + ' active people in ' + fmtNum(d.groups) + ' groups' }), el('span', { style: 'flex:1' }), downloads(M.job)));
27
+ d.candidates.slice(0, 60).forEach(function (c) {
28
+ w.appendChild(section(d.attribute + ' = ' + c.value, fmtNum(c.members) + (c.members === 1 ? ' person' : ' people'), el('div', {},
29
+ simpleTable(['Entitlement', 'Source', 'Held by', 'Already in a role'], c.items.map(function (i) {
30
+ return [i.name, i.source, i.holders + ' (' + i.share + '%)', i.covered ? el('span', { className: 'chg gain', text: 'Yes' }) : el('span', { className: 'chg lose', text: 'No' })];
31
+ })),
32
+ c.newItems ? el('p', { className: 'muted small', text: 'Candidate role: members where ' + d.attribute + ' is "' + c.value + '", with the ' + c.newItems + ' item' + (c.newItems > 1 ? 's' : '') + ' marked No. Check it first with "Preview a role change".' }) : null)));
33
+ });
34
+ }
35
+
@@ -0,0 +1,45 @@
1
+ // ---------- share reports (report packs) ----------
2
+ function sharePanel() {
3
+ var m = $('main');
4
+ m.textContent = '';
5
+ var w = el('div', { className: 'wrap', style: 'max-width:980px' });
6
+ m.appendChild(w);
7
+ pageHead(w, 'copy', '#334155', '#eef1f5', 'Share reports', 'Export reports to one file and import packs from colleagues or other companies. A pack holds report definitions only, never data or credentials.');
8
+ var mine = state.reports.filter(function (r) { return r.custom; });
9
+ var chosen = mine.map(function (r) { return r.definition.id; });
10
+ var exportList = el('div', { className: 'checklist' }, (mine.length ? mine : state.reports.slice(0, 0)).map(function (r) {
11
+ var c = el('input', { type: 'checkbox', checked: true });
12
+ c.addEventListener('change', function () { chosen = chosen.filter(function (x) { return x !== r.definition.id; }); if (c.checked) chosen.push(r.definition.id); });
13
+ return el('label', { className: 'cl-item' }, c, el('span', { text: r.definition.name + ' (' + r.definition.id + ')' }));
14
+ }));
15
+ w.appendChild(section('Export my reports', mine.length, mine.length ? el('div', {}, exportList, el('button', { className: 'btn primary', style: 'margin-top:12px', onclick: function () {
16
+ if (!chosen.length) { toast('Choose at least one report'); return; }
17
+ var a = el('a', { href: '/api/packs/download?ids=' + encodeURIComponent(chosen.join(',')) + '&k=' + encodeURIComponent(KEY), download: '' });
18
+ document.body.appendChild(a); a.click(); a.remove();
19
+ } }, icon('download'), 'Download pack')) : el('div', { className: 'muted', text: 'You have no reports of your own yet. Use New report or Customize on a ready-made report.' })));
20
+ var box = el('div');
21
+ var file = el('input', { type: 'file', accept: '.json,application/json' });
22
+ file.addEventListener('change', function () {
23
+ var f = file.files && file.files[0];
24
+ if (!f) return;
25
+ if (f.size > 1500000) { box.textContent = ''; box.appendChild(el('div', { className: 'error', text: 'The file is too large for a report pack.' })); return; }
26
+ f.text().then(function (text) {
27
+ return api('/api/packs/preview', 'POST', { text: text }).then(function (p) {
28
+ box.textContent = '';
29
+ var pick = p.entries.filter(function (e) { return e.status === 'new' || e.status === 'replaces yours'; }).map(function (e) { return e.id; });
30
+ box.appendChild(simpleTable(['', 'Report', 'ID', 'What happens'], p.entries.map(function (e) {
31
+ var ok = e.status === 'new' || e.status === 'replaces yours';
32
+ var c = el('input', { type: 'checkbox', checked: ok, disabled: !ok });
33
+ c.addEventListener('change', function () { pick = pick.filter(function (x) { return x !== e.id; }); if (c.checked) pick.push(e.id); });
34
+ var what = e.status === 'new' ? el('span', { className: 'chg gain', text: 'Added' }) : e.status === 'replaces yours' ? el('span', { className: 'chg lose', text: 'Replaces your report with this ID' }) : e.status === 'built in' ? el('span', { className: 'chg off', text: 'Skipped: same ID as a ready-made report' }) : el('span', { className: 'chg lose', text: 'Skipped: ' + e.problems.join('; ') });
35
+ return [c, e.name, e.id, what];
36
+ })));
37
+ box.appendChild(el('button', { className: 'btn primary', style: 'margin-top:12px', onclick: function () {
38
+ api('/api/packs/import', 'POST', { text: text, ids: pick }).then(function (r) { toast(r.saved.length + ' report' + (r.saved.length === 1 ? '' : 's') + ' added'); loadLibrary(); }).catch(function (e) { box.appendChild(el('div', { className: 'error', text: errorText(e) })); });
39
+ } }, icon('plus'), 'Add the chosen reports'));
40
+ });
41
+ }).catch(function (e) { box.textContent = ''; box.appendChild(el('div', { className: 'error', text: errorText(e) })); });
42
+ });
43
+ w.appendChild(section('Import a pack', null, el('div', {}, el('p', { className: 'muted small', style: 'margin-top:0', text: 'Choose a .json pack file. You see every report before anything is added. Ready-made reports are never replaced.' }), file, box)));
44
+ }
45
+