@things-factory/auth-ui 10.1.194 → 10.1.198

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 (44) hide show
  1. package/dist-client/bootstrap.js +4 -1
  2. package/dist-client/bootstrap.js.map +1 -1
  3. package/dist-client/components/my-login-history.js +14 -10
  4. package/dist-client/components/my-login-history.js.map +1 -1
  5. package/dist-client/components/role-template-picker.d.ts +5 -0
  6. package/dist-client/components/role-template-picker.js +41 -5
  7. package/dist-client/components/role-template-picker.js.map +1 -1
  8. package/dist-client/components/user-status-renderer.d.ts +9 -0
  9. package/dist-client/components/user-status-renderer.js +36 -0
  10. package/dist-client/components/user-status-renderer.js.map +1 -0
  11. package/dist-client/entity360/person-360.d.ts +13 -0
  12. package/dist-client/entity360/person-360.js +96 -0
  13. package/dist-client/entity360/person-360.js.map +1 -1
  14. package/dist-client/index.d.ts +1 -0
  15. package/dist-client/index.js +14 -1
  16. package/dist-client/index.js.map +1 -1
  17. package/dist-client/pages/audit/audit-page.d.ts +46 -0
  18. package/dist-client/pages/audit/audit-page.js +417 -0
  19. package/dist-client/pages/audit/audit-page.js.map +1 -0
  20. package/dist-client/pages/role/role-privilege-page.d.ts +38 -0
  21. package/dist-client/pages/role/role-privilege-page.js +441 -5
  22. package/dist-client/pages/role/role-privilege-page.js.map +1 -1
  23. package/dist-client/pages/role/role-task-review.test.d.ts +1 -0
  24. package/dist-client/pages/role/role-task-review.test.js +49 -0
  25. package/dist-client/pages/role/role-task-review.test.js.map +1 -0
  26. package/dist-client/pages/user/user-list-page.js +1 -31
  27. package/dist-client/pages/user/user-list-page.js.map +1 -1
  28. package/dist-client/route.js +3 -0
  29. package/dist-client/route.js.map +1 -1
  30. package/dist-client/tsconfig.tsbuildinfo +1 -1
  31. package/dist-client/utils/audit-words.d.ts +30 -0
  32. package/dist-client/utils/audit-words.js +57 -0
  33. package/dist-client/utils/audit-words.js.map +1 -0
  34. package/dist-client/utils/audit-words.test.d.ts +1 -0
  35. package/dist-client/utils/audit-words.test.js +47 -0
  36. package/dist-client/utils/audit-words.test.js.map +1 -0
  37. package/package.json +4 -4
  38. package/things-factory.config.js +1 -0
  39. package/translations/en.json +68 -1
  40. package/translations/es.json +68 -1
  41. package/translations/ja.json +68 -1
  42. package/translations/ko.json +68 -1
  43. package/translations/ms.json +68 -1
  44. package/translations/zh.json +68 -1
@@ -8,7 +8,7 @@ export * from './components/role-selector.js';
8
8
  export * from './components/domain-switch.js';
9
9
  export * from './components/invite-user.js';
10
10
  export async function setAuthManagementMenus(options) {
11
- const { role = true, appliance = true, application = true, user = true, authProvider = true, domain = true, attribute = true } = options || {};
11
+ const { role = true, appliance = true, application = true, user = true, authProvider = true, domain = true, attribute = true, audit = true } = options || {};
12
12
  if (await hasPrivilege({ privilege: 'mutation', category: 'user', domainOwnerGranted: true, superUserGranted: true })) {
13
13
  role &&
14
14
  store.dispatch({
@@ -66,6 +66,19 @@ export async function setAuthManagementMenus(options) {
66
66
  }
67
67
  });
68
68
  }
69
+ /* The audit asks its own privilege - the domain owner does not pass on ownership (ADR-0141 §5). */
70
+ if (audit && (await hasPrivilege({ privilege: 'query', category: 'audit', superUserGranted: true }))) {
71
+ store.dispatch({
72
+ type: ADD_MORENDA,
73
+ morenda: {
74
+ icon: html ` <md-icon>policy</md-icon> `,
75
+ name: html ` <ox-i18n msgid="audit.title"></ox-i18n> `,
76
+ action: () => {
77
+ navigate('audit');
78
+ }
79
+ }
80
+ });
81
+ }
69
82
  if (await hasPrivilege({ domainOwnerGranted: true, superUserGranted: true })) {
70
83
  domain &&
71
84
  store.dispatch({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,g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AAM;YACJ,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI,CAAA,+BAA+B;oBACzC,IAAI,EAAE,IAAI,CAAA,sDAAsD;oBAChE,MAAM,EAAE,GAAG,EAAE;wBACX,QAAQ,CAAC,SAAS,CAAC,CAAA;oBACrB,CAAC;iBACF;aACF,CAAC,CAAA;QAEJ,SAAS;YACP,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI,CAAA,8BAA8B;oBACxC,IAAI,EAAE,IAAI,CAAA,yDAAyD;oBACnE,MAAM,EAAE,GAAG,EAAE;wBACX,QAAQ,CAAC,YAAY,CAAC,CAAA;oBACxB,CAAC;iBACF;aACF,CAAC,CAAA;IACN,CAAC;AACH,CAAC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\n\nimport { html } from 'lit-html'\n\nimport { navigate, store } from '@operato/shell'\nimport { ADD_MORENDA } from '@things-factory/more-base/client'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\n\nexport * from './components/role-selector.js'\nexport * from './components/domain-switch.js'\nexport * from './components/invite-user.js'\n\nexport type AuthManagementMenuOptions = {\n role?: boolean\n appliance?: boolean\n application?: boolean\n user?: boolean\n authProvider?: boolean\n domain?: boolean\n attribute?: boolean\n}\n\nexport async function setAuthManagementMenus(options?: any) {\n const {\n role = true,\n appliance = true,\n application = true,\n user = true,\n authProvider = true,\n domain = true,\n attribute = true\n } = options || {}\n\n if (\n await hasPrivilege({ privilege: 'mutation', category: 'user', domainOwnerGranted: true, superUserGranted: true })\n ) {\n role &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>how_to_reg</md-icon> `,\n name: html` <ox-i18n msgid=\"text.role_management\"></ox-i18n> `,\n action: () => {\n navigate('roles')\n }\n }\n })\n\n appliance &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>devices</md-icon> `,\n name: html` <ox-i18n msgid=\"text.appliance\"></ox-i18n> `,\n action: () => {\n navigate('appliance-home')\n }\n }\n })\n\n application &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>apps</md-icon> `,\n name: html` <ox-i18n msgid=\"text.application management\"></ox-i18n> `,\n action: () => {\n navigate('applications')\n }\n }\n })\n\n user &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>people</md-icon> `,\n name: html` <ox-i18n msgid=\"text.user management\"></ox-i18n> `,\n action: () => {\n navigate('users')\n }\n }\n })\n\n authProvider &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>id_card</md-icon> `,\n name: html` <ox-i18n msgid=\"text.auth-provider management\"></ox-i18n> `,\n action: () => {\n navigate('auth-providers')\n }\n }\n })\n }\n\n if (await hasPrivilege({ domainOwnerGranted: true, superUserGranted: true })) {\n domain &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>supervised_user_circle</md-icon> `,\n name: html` <ox-i18n msgid=\"text.domain owners\"></ox-i18n> `,\n action: () => {\n navigate('domain-owners')\n }\n }\n })\n }\n\n if (await hasPrivilege({ superUserGranted: true })) {\n domain &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>business</md-icon> `,\n name: html` <ox-i18n msgid=\"text.domain management\"></ox-i18n> `,\n action: () => {\n navigate('domains')\n }\n }\n })\n\n attribute &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>dataset</md-icon> `,\n name: html` <ox-i18n msgid=\"text.attribute management\"></ox-i18n> `,\n action: () => {\n navigate('attributes')\n }\n }\n })\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO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GAAG,EAAE;oBACX,QAAQ,CAAC,OAAO,CAAC,CAAA;gBACnB,CAAC;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,MAAM,YAAY,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7E,MAAM;YACJ,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI,CAAA,6CAA6C;oBACvD,IAAI,EAAE,IAAI,CAAA,kDAAkD;oBAC5D,MAAM,EAAE,GAAG,EAAE;wBACX,QAAQ,CAAC,eAAe,CAAC,CAAA;oBAC3B,CAAC;iBACF;aACF,CAAC,CAAA;IACN,CAAC;IAED,IAAI,MAAM,YAAY,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACnD,MAAM;YACJ,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI,CAAA,+BAA+B;oBACzC,IAAI,EAAE,IAAI,CAAA,sDAAsD;oBAChE,MAAM,EAAE,GAAG,EAAE;wBACX,QAAQ,CAAC,SAAS,CAAC,CAAA;oBACrB,CAAC;iBACF;aACF,CAAC,CAAA;QAEJ,SAAS;YACP,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,IAAI,CAAA,8BAA8B;oBACxC,IAAI,EAAE,IAAI,CAAA,yDAAyD;oBACnE,MAAM,EAAE,GAAG,EAAE;wBACX,QAAQ,CAAC,YAAY,CAAC,CAAA;oBACxB,CAAC;iBACF;aACF,CAAC,CAAA;IACN,CAAC;AACH,CAAC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\n\nimport { html } from 'lit-html'\n\nimport { navigate, store } from '@operato/shell'\nimport { ADD_MORENDA } from '@things-factory/more-base/client'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\n\nexport * from './components/role-selector.js'\nexport * from './components/domain-switch.js'\nexport * from './components/invite-user.js'\n\nexport type AuthManagementMenuOptions = {\n role?: boolean\n appliance?: boolean\n application?: boolean\n user?: boolean\n authProvider?: boolean\n domain?: boolean\n attribute?: boolean\n audit?: boolean\n}\n\nexport async function setAuthManagementMenus(options?: any) {\n const {\n role = true,\n appliance = true,\n application = true,\n user = true,\n authProvider = true,\n domain = true,\n attribute = true,\n audit = true\n } = options || {}\n\n if (\n await hasPrivilege({ privilege: 'mutation', category: 'user', domainOwnerGranted: true, superUserGranted: true })\n ) {\n role &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>how_to_reg</md-icon> `,\n name: html` <ox-i18n msgid=\"text.role_management\"></ox-i18n> `,\n action: () => {\n navigate('roles')\n }\n }\n })\n\n appliance &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>devices</md-icon> `,\n name: html` <ox-i18n msgid=\"text.appliance\"></ox-i18n> `,\n action: () => {\n navigate('appliance-home')\n }\n }\n })\n\n application &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>apps</md-icon> `,\n name: html` <ox-i18n msgid=\"text.application management\"></ox-i18n> `,\n action: () => {\n navigate('applications')\n }\n }\n })\n\n user &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>people</md-icon> `,\n name: html` <ox-i18n msgid=\"text.user management\"></ox-i18n> `,\n action: () => {\n navigate('users')\n }\n }\n })\n\n authProvider &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>id_card</md-icon> `,\n name: html` <ox-i18n msgid=\"text.auth-provider management\"></ox-i18n> `,\n action: () => {\n navigate('auth-providers')\n }\n }\n })\n }\n\n /* The audit asks its own privilege - the domain owner does not pass on ownership (ADR-0141 §5). */\n if (audit && (await hasPrivilege({ privilege: 'query', category: 'audit', superUserGranted: true }))) {\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>policy</md-icon> `,\n name: html` <ox-i18n msgid=\"audit.title\"></ox-i18n> `,\n action: () => {\n navigate('audit')\n }\n }\n })\n }\n\n if (await hasPrivilege({ domainOwnerGranted: true, superUserGranted: true })) {\n domain &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>supervised_user_circle</md-icon> `,\n name: html` <ox-i18n msgid=\"text.domain owners\"></ox-i18n> `,\n action: () => {\n navigate('domain-owners')\n }\n }\n })\n }\n\n if (await hasPrivilege({ superUserGranted: true })) {\n domain &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>business</md-icon> `,\n name: html` <ox-i18n msgid=\"text.domain management\"></ox-i18n> `,\n action: () => {\n navigate('domains')\n }\n }\n })\n\n attribute &&\n store.dispatch({\n type: ADD_MORENDA,\n morenda: {\n icon: html` <md-icon>dataset</md-icon> `,\n name: html` <ox-i18n msgid=\"text.attribute management\"></ox-i18n> `,\n action: () => {\n navigate('attributes')\n }\n }\n })\n }\n}\n"]}
@@ -0,0 +1,46 @@
1
+ import '@material/web/icon/icon.js';
2
+ import '@operato/data-grist';
3
+ import type { CSSResultGroup } from 'lit';
4
+ import { PageView } from '@operato/shell';
5
+ import type { FetchOption } from '@operato/data-grist';
6
+ declare const AuditPageBase: (new (...args: any[]) => {
7
+ __preferenceProviders: {
8
+ [element: string]: import("@operato/p13n").PagePreferenceProvider;
9
+ };
10
+ getPagePreferenceProvider(element: string): import("@operato/p13n").PagePreferenceProvider | undefined;
11
+ }) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
12
+ export declare class AuditPage extends AuditPageBase {
13
+ static styles: CSSResultGroup;
14
+ mode: 'CARD' | 'GRID' | 'LIST';
15
+ private view;
16
+ private days;
17
+ private from;
18
+ private to;
19
+ private actor?;
20
+ private door?;
21
+ private outcome;
22
+ private health?;
23
+ private grist;
24
+ get context(): {
25
+ title: string;
26
+ help: string;
27
+ filter: {
28
+ handler: () => void;
29
+ };
30
+ };
31
+ render(): import("lit-html").TemplateResult<1>;
32
+ private renderControls;
33
+ private renderHealth;
34
+ private show;
35
+ private lastDays;
36
+ private pick;
37
+ private narrow;
38
+ pageUpdated(_changes: any, _lifecycle: any): Promise<void>;
39
+ private readHealth;
40
+ private configOf;
41
+ fetchHandler({ page, limit }: FetchOption): Promise<{
42
+ total: any;
43
+ records: any;
44
+ }>;
45
+ }
46
+ export {};
@@ -0,0 +1,417 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@operato/data-grist';
4
+ import gql from 'graphql-tag';
5
+ import { css, html, nothing } from 'lit';
6
+ import { customElement, property, query, state } from 'lit/decorators.js';
7
+ import { keyed } from 'lit/directives/keyed.js';
8
+ import { client } from '@operato/graphql';
9
+ import { i18next, localize } from '@operato/i18n';
10
+ import { p13n } from '@operato/p13n';
11
+ import { PageView } from '@operato/shell';
12
+ import { ButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
13
+ import { isMobileDevice } from '@operato/utils';
14
+ import { statusRenderer } from '../../components/user-status-renderer.js';
15
+ import { doorWords, lastDays, recordWords } from '../../utils/audit-words.js';
16
+ const PERIODS = [7, 30, 90];
17
+ const VIEWS = ['people', 'doors', 'records'];
18
+ const OUTCOMES = ['', 'denied', 'error', 'failed'];
19
+ const AuditPageBase = p13n(localize(i18next)(PageView));
20
+ function dateInputValue(date) {
21
+ const pad = (n) => String(n).padStart(2, '0');
22
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
23
+ }
24
+ let AuditPage = class AuditPage extends AuditPageBase {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.mode = isMobileDevice() ? 'LIST' : 'GRID';
28
+ this.view = 'people';
29
+ this.days = 30;
30
+ this.from = lastDays(30).from;
31
+ this.to = new Date();
32
+ this.outcome = '';
33
+ }
34
+ static { this.styles = [
35
+ WorkSurfacePageStyles,
36
+ ScrollbarStyles,
37
+ CommonGristStyles,
38
+ CommonHeaderStyles,
39
+ ButtonStyles,
40
+ css `
41
+ .filters {
42
+ flex-wrap: wrap;
43
+ }
44
+
45
+ [group] {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: var(--spacing-tiny, 2px);
49
+ }
50
+
51
+ button[aria-pressed='true'] {
52
+ background-color: var(--md-sys-color-secondary-container);
53
+ color: var(--md-sys-color-on-secondary-container);
54
+ }
55
+
56
+ input[type='date'] {
57
+ height: var(--context-action-height, 28px);
58
+ box-sizing: border-box;
59
+ border: 1px solid var(--md-sys-color-outline-variant);
60
+ border-radius: var(--md-sys-shape-corner-small, 4px);
61
+ background: var(--md-sys-color-surface-container-lowest);
62
+ color: var(--md-sys-color-on-surface);
63
+ font: inherit;
64
+ font-size: var(--ui-t-body, 13px);
65
+ padding: 0 var(--spacing-small, 4px);
66
+ }
67
+
68
+ [narrowed] {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: var(--spacing-small, 4px);
72
+ font-size: var(--ui-t-body, 13px);
73
+ color: var(--md-sys-color-on-surface);
74
+ }
75
+
76
+ [health] {
77
+ margin-left: auto;
78
+ font-size: var(--ui-t-body, 13px);
79
+ color: var(--ui-crit, var(--md-sys-color-error));
80
+ }
81
+ `
82
+ ]; }
83
+ get context() {
84
+ return {
85
+ title: i18next.t('audit.title'),
86
+ help: 'auth/audit',
87
+ filter: {
88
+ handler: () => this.grist.toggleHeadroom()
89
+ }
90
+ };
91
+ }
92
+ render() {
93
+ return html `${keyed(this.view, html `<ox-grist class="page-fill" .mode=${this.mode} .config=${this.configOf(this.view)} .fetchHandler=${this.fetchHandler.bind(this)}>
94
+ <div slot="headroom" class="header">
95
+ <div class="filters">${this.renderControls()}</div>
96
+ </div>
97
+ </ox-grist>`)}`;
98
+ }
99
+ renderControls() {
100
+ const t = i18next.t.bind(i18next);
101
+ const pressed = (on) => (on ? 'true' : 'false');
102
+ return html `
103
+ <div group>
104
+ ${VIEWS.map(view => html `<button quiet aria-pressed=${pressed(this.view === view)} @click=${() => this.show(view)}>${t(`audit.view.${view}`)}</button>`)}
105
+ </div>
106
+
107
+ <div group>
108
+ ${PERIODS.map(days => html `<button quiet aria-pressed=${pressed(this.days === days)} @click=${() => this.lastDays(days)}>${t('audit.period.days', { count: days })}</button>`)}
109
+ <input type="date" aria-label=${t('audit.period.from')} .value=${dateInputValue(this.from)} @change=${(e) => this.pick('from', e)} />
110
+ <span>~</span>
111
+ <input type="date" aria-label=${t('audit.period.to')} .value=${dateInputValue(this.to)} @change=${(e) => this.pick('to', e)} />
112
+ </div>
113
+
114
+ ${this.view === 'records'
115
+ ? html `<div group>
116
+ ${OUTCOMES.map(outcome => html `<button quiet aria-pressed=${pressed(this.outcome === outcome)} @click=${() => this.narrow({ outcome })}>${t(outcome ? `audit.outcome.${outcome}` : 'audit.outcome.all')}</button>`)}
117
+ </div>`
118
+ : nothing}
119
+ ${this.view === 'records' && this.actor
120
+ ? html `<span narrowed>${this.actor.name}<button quiet small @click=${() => this.narrow({ actor: undefined })}>${t('audit.button.all-people')}</button></span>`
121
+ : nothing}
122
+ ${this.view === 'records' && this.door
123
+ ? html `<span narrowed>${doorWords(t, this.door)}<button quiet small @click=${() => this.narrow({ door: undefined })}>${t('audit.button.all-privileges')}</button></span>`
124
+ : nothing}
125
+ ${this.renderHealth()}
126
+ `;
127
+ }
128
+ /* Only what is wrong is said: failures, or that they could not be counted. Never a 0 for "unknown". */
129
+ renderHealth() {
130
+ const health = this.health;
131
+ if (health === 'unknown')
132
+ return html `<span health>${i18next.t('audit.health.unknown')}</span>`;
133
+ if (!health?.failures)
134
+ return nothing;
135
+ return html `<span health>${i18next.t('audit.health.failures', { count: health.failures, since: new Date(health.since).toLocaleString() })}</span>`;
136
+ }
137
+ show(view) {
138
+ this.view = view;
139
+ }
140
+ lastDays(days) {
141
+ const { from, to } = lastDays(days);
142
+ this.days = days;
143
+ this.from = from;
144
+ this.to = to;
145
+ this.grist?.fetch();
146
+ }
147
+ pick(which, event) {
148
+ const value = event.target.value;
149
+ if (!value)
150
+ return;
151
+ const [year, month, day] = value.split('-').map(Number);
152
+ this[which] = which === 'from' ? new Date(year, month - 1, day, 0, 0, 0) : new Date(year, month - 1, day, 23, 59, 59, 999);
153
+ this.days = null;
154
+ this.grist?.fetch();
155
+ }
156
+ narrow(change) {
157
+ Object.assign(this, change);
158
+ if (this.view !== 'records')
159
+ this.view = 'records';
160
+ else
161
+ this.grist?.fetch();
162
+ }
163
+ async pageUpdated(_changes, _lifecycle) {
164
+ if (this.active) {
165
+ await this.updateComplete;
166
+ this.grist?.fetch();
167
+ this.readHealth();
168
+ }
169
+ }
170
+ async readHealth() {
171
+ try {
172
+ const response = await client.query({ query: gql `{ auditHealth { failures since } }`, fetchPolicy: 'no-cache' });
173
+ this.health = response.errors?.length || !response.data?.auditHealth ? 'unknown' : response.data.auditHealth;
174
+ }
175
+ catch {
176
+ this.health = 'unknown';
177
+ }
178
+ }
179
+ configOf(view) {
180
+ const t = i18next.t.bind(i18next);
181
+ const number = (name, header, click) => ({
182
+ type: 'integer',
183
+ name,
184
+ header,
185
+ record: { align: 'right', editable: false },
186
+ width: 90,
187
+ ...(click ? { handlers: { click: (_c, _d, _col, record) => record && click(record) } } : {})
188
+ });
189
+ if (view === 'people') {
190
+ const person = (record) => ({ id: record.id, name: record.name || record.email });
191
+ return {
192
+ rows: { appendable: false, selectable: false },
193
+ pagination: { infinite: true },
194
+ columns: [
195
+ { type: 'gutter', gutterName: 'sequence' },
196
+ {
197
+ type: 'string',
198
+ name: 'name',
199
+ header: t('field.name'),
200
+ record: { editable: false },
201
+ width: 140,
202
+ handlers: { click: (_c, _d, _col, record) => record && this.narrow({ actor: person(record), door: undefined, outcome: '' }) }
203
+ },
204
+ { type: 'string', name: 'email', header: t('field.email'), record: { editable: false }, width: 200 },
205
+ { type: 'string', name: 'roles', header: t('field.roles'), record: { editable: false }, width: 200 },
206
+ { type: 'string', name: 'status', header: t('field.status'), record: { editable: false, align: 'center', renderer: statusRenderer(() => 0) }, width: 80 },
207
+ { type: 'datetime', name: 'lastCheckinAt', header: t('audit.field.last-checkin'), record: { editable: false }, width: 160 },
208
+ number('checkins', t('audit.field.checkins')),
209
+ number('failedSignins', t('audit.field.failed-signins'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'failed' })),
210
+ number('granted', t('audit.field.granted'), record => this.narrow({ actor: person(record), door: undefined, outcome: '' })),
211
+ number('denied', t('audit.field.denied'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'denied' }))
212
+ ]
213
+ };
214
+ }
215
+ if (view === 'doors') {
216
+ return {
217
+ rows: { appendable: false, selectable: false },
218
+ pagination: { infinite: true },
219
+ columns: [
220
+ { type: 'gutter', gutterName: 'sequence' },
221
+ {
222
+ type: 'string',
223
+ name: 'doorWords',
224
+ header: t('audit.field.privilege'),
225
+ record: { editable: false },
226
+ width: 240,
227
+ handlers: { click: (_c, _d, _col, record) => record && this.narrow({ door: record.door, actor: undefined, outcome: '' }) }
228
+ },
229
+ number('people', t('audit.field.people')),
230
+ number('granted', t('audit.field.granted'), record => this.narrow({ door: record.door, actor: undefined, outcome: '' })),
231
+ number('denied', t('audit.field.denied'), record => this.narrow({ door: record.door, actor: undefined, outcome: 'denied' }))
232
+ ]
233
+ };
234
+ }
235
+ return {
236
+ rows: { appendable: false, selectable: false },
237
+ pagination: { pages: [50, 100, 200] },
238
+ columns: [
239
+ { type: 'gutter', gutterName: 'sequence' },
240
+ { type: 'datetime', name: 'createdAt', header: t('audit.field.time'), record: { editable: false }, width: 160 },
241
+ { type: 'string', name: 'actorName', header: t('audit.field.actor'), record: { editable: false }, width: 120 },
242
+ { type: 'string', name: 'operation', header: t('audit.field.request'), record: { editable: false }, width: 200 },
243
+ { type: 'string', name: 'what', header: t('audit.field.actions'), record: { editable: false }, width: 360 },
244
+ { type: 'string', name: 'ip', header: t('audit.field.address'), record: { editable: false }, width: 120 },
245
+ { type: 'integer', name: 'durationMs', header: t('audit.field.duration'), record: { editable: false, align: 'right' }, width: 80 }
246
+ ]
247
+ };
248
+ }
249
+ async fetchHandler({ page, limit }) {
250
+ const t = i18next.t.bind(i18next);
251
+ const period = { from: this.from.toISOString(), to: this.to.toISOString() };
252
+ if (this.view === 'people') {
253
+ const response = await client.query({
254
+ query: gql `
255
+ query ($from: DateTimeISO!, $to: DateTimeISO!) {
256
+ auditPeople(from: $from, to: $to) {
257
+ user {
258
+ id
259
+ name
260
+ email
261
+ status
262
+ }
263
+ roles
264
+ lastCheckinAt
265
+ checkins
266
+ failedSignins
267
+ granted
268
+ denied
269
+ }
270
+ }
271
+ `,
272
+ variables: period,
273
+ fetchPolicy: 'no-cache'
274
+ });
275
+ const people = response.data?.auditPeople || [];
276
+ const records = people
277
+ .map((one) => ({
278
+ ...one,
279
+ id: one.user.id,
280
+ name: one.user.name,
281
+ email: one.user.email,
282
+ roles: one.roles.join(', '),
283
+ status: one.user.status
284
+ }))
285
+ .sort((a, b) => String(b.lastCheckinAt || '').localeCompare(String(a.lastCheckinAt || '')));
286
+ return { total: records.length, records };
287
+ }
288
+ if (this.view === 'doors') {
289
+ const response = await client.query({
290
+ query: gql `
291
+ query ($from: DateTimeISO!, $to: DateTimeISO!) {
292
+ auditDoors(from: $from, to: $to) {
293
+ door
294
+ people
295
+ granted
296
+ denied
297
+ }
298
+ }
299
+ `,
300
+ variables: period,
301
+ fetchPolicy: 'no-cache'
302
+ });
303
+ /* The doors used come first; the rest keep the server's order. */
304
+ const used = (one) => one.granted + one.denied;
305
+ const records = (response.data?.auditDoors || [])
306
+ .map((one) => ({ ...one, doorWords: doorWords(t, one.door) }))
307
+ .sort((a, b) => used(b) - used(a));
308
+ return { total: records.length, records };
309
+ }
310
+ const response = await client.query({
311
+ query: gql `
312
+ query ($filter: AuditRecordFilter!) {
313
+ auditRecords(filter: $filter) {
314
+ items {
315
+ request {
316
+ id
317
+ createdAt
318
+ actor {
319
+ id
320
+ name
321
+ email
322
+ }
323
+ ip
324
+ channel
325
+ operationType
326
+ operationName
327
+ fields
328
+ route
329
+ durationMs
330
+ }
331
+ actions {
332
+ kind
333
+ door
334
+ decision
335
+ outcome
336
+ code
337
+ count
338
+ objectId
339
+ detail
340
+ }
341
+ }
342
+ total
343
+ }
344
+ }
345
+ `,
346
+ variables: {
347
+ filter: {
348
+ ...period,
349
+ actorId: this.actor?.id,
350
+ door: this.door,
351
+ outcome: this.outcome || undefined,
352
+ page,
353
+ limit
354
+ }
355
+ },
356
+ fetchPolicy: 'no-cache'
357
+ });
358
+ const list = response.data?.auditRecords;
359
+ return {
360
+ total: list?.total || 0,
361
+ records: (list?.items || []).map(({ request, actions }) => ({
362
+ id: request.id,
363
+ createdAt: request.createdAt,
364
+ actorName: request.actor?.name || request.actor?.email || '',
365
+ what: recordWords(t, actions),
366
+ operation: request.channel === 'graphql' ? [request.operationType, request.fields || request.operationName].filter(Boolean).join(' ') : request.route || '',
367
+ ip: request.ip,
368
+ durationMs: request.durationMs
369
+ }))
370
+ };
371
+ }
372
+ };
373
+ __decorate([
374
+ property({ type: String }),
375
+ __metadata("design:type", String)
376
+ ], AuditPage.prototype, "mode", void 0);
377
+ __decorate([
378
+ state(),
379
+ __metadata("design:type", String)
380
+ ], AuditPage.prototype, "view", void 0);
381
+ __decorate([
382
+ state(),
383
+ __metadata("design:type", Object)
384
+ ], AuditPage.prototype, "days", void 0);
385
+ __decorate([
386
+ state(),
387
+ __metadata("design:type", Date)
388
+ ], AuditPage.prototype, "from", void 0);
389
+ __decorate([
390
+ state(),
391
+ __metadata("design:type", Date)
392
+ ], AuditPage.prototype, "to", void 0);
393
+ __decorate([
394
+ state(),
395
+ __metadata("design:type", Object)
396
+ ], AuditPage.prototype, "actor", void 0);
397
+ __decorate([
398
+ state(),
399
+ __metadata("design:type", String)
400
+ ], AuditPage.prototype, "door", void 0);
401
+ __decorate([
402
+ state(),
403
+ __metadata("design:type", String)
404
+ ], AuditPage.prototype, "outcome", void 0);
405
+ __decorate([
406
+ state(),
407
+ __metadata("design:type", Object)
408
+ ], AuditPage.prototype, "health", void 0);
409
+ __decorate([
410
+ query('ox-grist'),
411
+ __metadata("design:type", Function)
412
+ ], AuditPage.prototype, "grist", void 0);
413
+ AuditPage = __decorate([
414
+ customElement('audit-page')
415
+ ], AuditPage);
416
+ export { AuditPage };
417
+ //# sourceMappingURL=audit-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-page.js","sourceRoot":"","sources":["../../../client/pages/audit/audit-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/C,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AACzE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAY7E,MAAM,OAAO,GAAG,CAAC,CAAC,EA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O,CAAC;gBAC7B,SAAS,EAAE,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;gBAC3J,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;SACJ,CAAA;IACH,CAAC;;AA7T2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uCAAoE;AAE9E;IAAhB,KAAK,EAAE;;uCAA8B;AACrB;IAAhB,KAAK,EAAE;;uCAAiC;AACxB;IAAhB,KAAK,EAAE;8BAAe,IAAI;uCAAoB;AAC9B;IAAhB,KAAK,EAAE;8BAAa,IAAI;qCAAa;AACrB;IAAhB,KAAK,EAAE;;wCAA6C;AACpC;IAAhB,KAAK,EAAE;;uCAAsB;AACb;IAAhB,KAAK,EAAE;;0CAA8B;AACrB;IAAhB,KAAK,EAAE;;yCAAiE;AAE9C;IAA1B,KAAK,CAAC,UAAU,CAAC;;wCAA0B;AA9DjC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAiXrB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport type { CSSResultGroup } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { p13n } from '@operato/p13n'\nimport { PageView } from '@operato/shell'\nimport { ButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport type { DataGrist, FetchOption } from '@operato/data-grist'\n\nimport { statusRenderer } from '../../components/user-status-renderer.js'\nimport { doorWords, lastDays, recordWords } from '../../utils/audit-words.js'\n\n/**\n * 감사 기록 (ADR-0141 §6.1) - who did what in this domain, read three ways: by person, by privilege,\n * and the requests one by one. A person's or a privilege's numbers open the requests behind them.\n *\n * Reading only. The audit has no door that changes a row (§4-6), so this screen has no action.\n */\n\ntype View = 'people' | 'doors' | 'records'\ntype Outcome = '' | 'denied' | 'error' | 'failed'\n\nconst PERIODS = [7, 30, 90]\nconst VIEWS: View[] = ['people', 'doors', 'records']\nconst OUTCOMES: Outcome[] = ['', 'denied', 'error', 'failed']\n\nconst AuditPageBase = p13n(localize(i18next)(PageView))\n\nfunction dateInputValue(date: Date) {\n const pad = (n: number) => String(n).padStart(2, '0')\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n}\n\n@customElement('audit-page')\nexport class AuditPage extends AuditPageBase {\n static styles: CSSResultGroup = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ButtonStyles,\n css`\n .filters {\n flex-wrap: wrap;\n }\n\n [group] {\n display: flex;\n align-items: center;\n gap: var(--spacing-tiny, 2px);\n }\n\n button[aria-pressed='true'] {\n background-color: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n\n input[type='date'] {\n height: var(--context-action-height, 28px);\n box-sizing: border-box;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: var(--md-sys-color-surface-container-lowest);\n color: var(--md-sys-color-on-surface);\n font: inherit;\n font-size: var(--ui-t-body, 13px);\n padding: 0 var(--spacing-small, 4px);\n }\n\n [narrowed] {\n display: flex;\n align-items: center;\n gap: var(--spacing-small, 4px);\n font-size: var(--ui-t-body, 13px);\n color: var(--md-sys-color-on-surface);\n }\n\n [health] {\n margin-left: auto;\n font-size: var(--ui-t-body, 13px);\n color: var(--ui-crit, var(--md-sys-color-error));\n }\n `\n ]\n\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'LIST' : 'GRID'\n\n @state() private view: View = 'people'\n @state() private days: number | null = 30\n @state() private from: Date = lastDays(30).from\n @state() private to: Date = new Date()\n @state() private actor?: { id: string; name: string }\n @state() private door?: string\n @state() private outcome: Outcome = ''\n @state() private health?: { failures: number; since: string } | 'unknown'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('audit.title'),\n help: 'auth/audit',\n filter: {\n handler: () => this.grist.toggleHeadroom()\n }\n }\n }\n\n render() {\n return html`${keyed(\n this.view,\n html`<ox-grist class=\"page-fill\" .mode=${this.mode} .config=${this.configOf(this.view)} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">${this.renderControls()}</div>\n </div>\n </ox-grist>`\n )}`\n }\n\n private renderControls() {\n const t = i18next.t.bind(i18next)\n const pressed = (on: boolean) => (on ? 'true' : 'false')\n\n return html`\n <div group>\n ${VIEWS.map(view => html`<button quiet aria-pressed=${pressed(this.view === view)} @click=${() => this.show(view)}>${t(`audit.view.${view}`)}</button>`)}\n </div>\n\n <div group>\n ${PERIODS.map(days => html`<button quiet aria-pressed=${pressed(this.days === days)} @click=${() => this.lastDays(days)}>${t('audit.period.days', { count: days })}</button>`)}\n <input type=\"date\" aria-label=${t('audit.period.from')} .value=${dateInputValue(this.from)} @change=${(e: Event) => this.pick('from', e)} />\n <span>~</span>\n <input type=\"date\" aria-label=${t('audit.period.to')} .value=${dateInputValue(this.to)} @change=${(e: Event) => this.pick('to', e)} />\n </div>\n\n ${this.view === 'records'\n ? html`<div group>\n ${OUTCOMES.map(outcome => html`<button quiet aria-pressed=${pressed(this.outcome === outcome)} @click=${() => this.narrow({ outcome })}>${t(outcome ? `audit.outcome.${outcome}` : 'audit.outcome.all')}</button>`)}\n </div>`\n : nothing}\n ${this.view === 'records' && this.actor\n ? html`<span narrowed>${this.actor.name}<button quiet small @click=${() => this.narrow({ actor: undefined })}>${t('audit.button.all-people')}</button></span>`\n : nothing}\n ${this.view === 'records' && this.door\n ? html`<span narrowed>${doorWords(t, this.door)}<button quiet small @click=${() => this.narrow({ door: undefined })}>${t('audit.button.all-privileges')}</button></span>`\n : nothing}\n ${this.renderHealth()}\n `\n }\n\n /* Only what is wrong is said: failures, or that they could not be counted. Never a 0 for \"unknown\". */\n private renderHealth() {\n const health = this.health\n if (health === 'unknown') return html`<span health>${i18next.t('audit.health.unknown')}</span>`\n if (!health?.failures) return nothing\n return html`<span health>${i18next.t('audit.health.failures', { count: health.failures, since: new Date(health.since).toLocaleString() })}</span>`\n }\n\n private show(view: View) {\n this.view = view\n }\n\n private lastDays(days: number) {\n const { from, to } = lastDays(days)\n this.days = days\n this.from = from\n this.to = to\n this.grist?.fetch()\n }\n\n private pick(which: 'from' | 'to', event: Event) {\n const value = (event.target as HTMLInputElement).value\n if (!value) return\n const [year, month, day] = value.split('-').map(Number)\n this[which] = which === 'from' ? new Date(year, month - 1, day, 0, 0, 0) : new Date(year, month - 1, day, 23, 59, 59, 999)\n this.days = null\n this.grist?.fetch()\n }\n\n private narrow(change: { actor?: { id: string; name: string }; door?: string; outcome?: Outcome }) {\n Object.assign(this, change)\n if (this.view !== 'records') this.view = 'records'\n else this.grist?.fetch()\n }\n\n async pageUpdated(_changes: any, _lifecycle: any) {\n if (this.active) {\n await this.updateComplete\n this.grist?.fetch()\n this.readHealth()\n }\n }\n\n private async readHealth() {\n try {\n const response = await client.query({ query: gql`{ auditHealth { failures since } }`, fetchPolicy: 'no-cache' })\n this.health = response.errors?.length || !response.data?.auditHealth ? 'unknown' : response.data.auditHealth\n } catch {\n this.health = 'unknown'\n }\n }\n\n private configOf(view: View) {\n const t = i18next.t.bind(i18next)\n const number = (name: string, header: string, click?: (record: any) => void) => ({\n type: 'integer',\n name,\n header,\n record: { align: 'right', editable: false },\n width: 90,\n ...(click ? { handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && click(record) } } : {})\n })\n\n if (view === 'people') {\n const person = (record: any) => ({ id: record.id, name: record.name || record.email })\n return {\n rows: { appendable: false, selectable: false },\n pagination: { infinite: true },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'name',\n header: t('field.name'),\n record: { editable: false },\n width: 140,\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && this.narrow({ actor: person(record), door: undefined, outcome: '' }) }\n },\n { type: 'string', name: 'email', header: t('field.email'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'roles', header: t('field.roles'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'status', header: t('field.status'), record: { editable: false, align: 'center', renderer: statusRenderer(() => 0) }, width: 80 },\n { type: 'datetime', name: 'lastCheckinAt', header: t('audit.field.last-checkin'), record: { editable: false }, width: 160 },\n number('checkins', t('audit.field.checkins')),\n number('failedSignins', t('audit.field.failed-signins'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'failed' })),\n number('granted', t('audit.field.granted'), record => this.narrow({ actor: person(record), door: undefined, outcome: '' })),\n number('denied', t('audit.field.denied'), record => this.narrow({ actor: person(record), door: undefined, outcome: 'denied' }))\n ]\n }\n }\n\n if (view === 'doors') {\n return {\n rows: { appendable: false, selectable: false },\n pagination: { infinite: true },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'doorWords',\n header: t('audit.field.privilege'),\n record: { editable: false },\n width: 240,\n handlers: { click: (_c: any, _d: any, _col: any, record: any) => record && this.narrow({ door: record.door, actor: undefined, outcome: '' }) }\n },\n number('people', t('audit.field.people')),\n number('granted', t('audit.field.granted'), record => this.narrow({ door: record.door, actor: undefined, outcome: '' })),\n number('denied', t('audit.field.denied'), record => this.narrow({ door: record.door, actor: undefined, outcome: 'denied' }))\n ]\n }\n }\n\n return {\n rows: { appendable: false, selectable: false },\n pagination: { pages: [50, 100, 200] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'datetime', name: 'createdAt', header: t('audit.field.time'), record: { editable: false }, width: 160 },\n { type: 'string', name: 'actorName', header: t('audit.field.actor'), record: { editable: false }, width: 120 },\n { type: 'string', name: 'operation', header: t('audit.field.request'), record: { editable: false }, width: 200 },\n { type: 'string', name: 'what', header: t('audit.field.actions'), record: { editable: false }, width: 360 },\n { type: 'string', name: 'ip', header: t('audit.field.address'), record: { editable: false }, width: 120 },\n { type: 'integer', name: 'durationMs', header: t('audit.field.duration'), record: { editable: false, align: 'right' }, width: 80 }\n ]\n }\n }\n\n async fetchHandler({ page, limit }: FetchOption) {\n const t = i18next.t.bind(i18next)\n const period = { from: this.from.toISOString(), to: this.to.toISOString() }\n\n if (this.view === 'people') {\n const response = await client.query({\n query: gql`\n query ($from: DateTimeISO!, $to: DateTimeISO!) {\n auditPeople(from: $from, to: $to) {\n user {\n id\n name\n email\n status\n }\n roles\n lastCheckinAt\n checkins\n failedSignins\n granted\n denied\n }\n }\n `,\n variables: period,\n fetchPolicy: 'no-cache'\n })\n const people = response.data?.auditPeople || []\n const records = people\n .map((one: any) => ({\n ...one,\n id: one.user.id,\n name: one.user.name,\n email: one.user.email,\n roles: one.roles.join(', '),\n status: one.user.status\n }))\n .sort((a: any, b: any) => String(b.lastCheckinAt || '').localeCompare(String(a.lastCheckinAt || '')))\n return { total: records.length, records }\n }\n\n if (this.view === 'doors') {\n const response = await client.query({\n query: gql`\n query ($from: DateTimeISO!, $to: DateTimeISO!) {\n auditDoors(from: $from, to: $to) {\n door\n people\n granted\n denied\n }\n }\n `,\n variables: period,\n fetchPolicy: 'no-cache'\n })\n /* The doors used come first; the rest keep the server's order. */\n const used = (one: any) => one.granted + one.denied\n const records = (response.data?.auditDoors || [])\n .map((one: any) => ({ ...one, doorWords: doorWords(t, one.door) }))\n .sort((a: any, b: any) => used(b) - used(a))\n return { total: records.length, records }\n }\n\n const response = await client.query({\n query: gql`\n query ($filter: AuditRecordFilter!) {\n auditRecords(filter: $filter) {\n items {\n request {\n id\n createdAt\n actor {\n id\n name\n email\n }\n ip\n channel\n operationType\n operationName\n fields\n route\n durationMs\n }\n actions {\n kind\n door\n decision\n outcome\n code\n count\n objectId\n detail\n }\n }\n total\n }\n }\n `,\n variables: {\n filter: {\n ...period,\n actorId: this.actor?.id,\n door: this.door,\n outcome: this.outcome || undefined,\n page,\n limit\n }\n },\n fetchPolicy: 'no-cache'\n })\n\n const list = response.data?.auditRecords\n return {\n total: list?.total || 0,\n records: (list?.items || []).map(({ request, actions }: any) => ({\n id: request.id,\n createdAt: request.createdAt,\n actorName: request.actor?.name || request.actor?.email || '',\n what: recordWords(t, actions),\n operation: request.channel === 'graphql' ? [request.operationType, request.fields || request.operationName].filter(Boolean).join(' ') : request.route || '',\n ip: request.ip,\n durationMs: request.durationMs\n }))\n }\n }\n}\n"]}
@@ -50,6 +50,14 @@ export declare class RolePrivilegePage extends RolePrivilegePage_base {
50
50
  private loadError;
51
51
  private saving;
52
52
  private dirty;
53
+ private view;
54
+ /** The role laid against every task - computed by the server from the saved privileges (`Role.taskCoverage`). */
55
+ private coverage;
56
+ private showUnheldTasks;
57
+ /** null until asked for; [] when this person may not read templates (`roleTemplates` asks user:mutation). */
58
+ private templates;
59
+ private templateId;
60
+ private gap;
53
61
  /**
54
62
  * 부모 도메인의 역할은 여기서 못 고친다 — `updateRole` 의 범위가 `domain.id` 하나다.
55
63
  * 목록이 상속으로 보여 주므로 관리자가 여기까지 온다. 읽기 전용으로 두고 어디로 가야 하는지
@@ -117,6 +125,36 @@ export declare class RolePrivilegePage extends RolePrivilegePage_base {
117
125
  * `privilege.category.*` 57개와 「읽기/쓰기」가 사람 말이다.
118
126
  */
119
127
  private renderGranted;
128
+ private viewButton;
129
+ private showView;
130
+ /**
131
+ * **The role by task** (ADR-0139 decision 11) — which of each task's privileges this role holds, as the server
132
+ * computes it from the saved privileges.
133
+ *
134
+ * It says what the role holds, nothing more: 「전부」 is not "this person can do the work" (another role, the
135
+ * data's own scope or an approval line decide that too), and 「일부」 is not a fault — a privilege several tasks
136
+ * share makes each of them 「일부」. So nothing here offers to add or take away; the privileges view and the
137
+ * template view do that.
138
+ */
139
+ private renderTasks;
140
+ private renderTask;
141
+ /**
142
+ * **The role against a template the administrator picks** (ADR-0139 decision 11) — whatever the role is called.
143
+ *
144
+ * The template of the role's name is picked to begin with; a role named in the site's own words (경영지원, 인사급여)
145
+ * has no such pair, and the administrator picks one. The role is never renamed to make a pair: an approval line
146
+ * holds the role. What the role holds beyond the template is shown as wider, not wrong — the site may have widened it
147
+ * on purpose — and nothing takes it away. What it lacks can be added; adding is the same top-up the template button
148
+ * on the role list runs (`createRoleFromTemplate` onto this role's name).
149
+ */
150
+ private renderTemplate;
151
+ private renderSentences;
152
+ /** A privilege in words — the sentence the privileges view draws, or its module and axis when there is none. */
153
+ private sentenceOf;
154
+ private fetchTemplates;
155
+ private pickTemplate;
156
+ /** Adds what the role lacks against the picked template — after showing what it adds. */
157
+ private addMissing;
120
158
  /**
121
159
  * 한 줄 — 문장과 [떼기].
122
160
  *