@wssto2/vue-core 0.5.4 → 0.6.0

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 (82) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +3 -1
  3. package/dist/{ActionRow.vue_vue_type_script_setup_true_lang-Bv-APkGf.js → ActionRow.vue_vue_type_script_setup_true_lang-D8NCXX4p.js} +1 -1
  4. package/dist/{Activity-DUjDaPfP.js → Activity-DGodh6BU.js} +4 -4
  5. package/dist/{Changes-B0tZO6BZ.js → Changes-38u4xY6e.js} +3 -3
  6. package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-o_Pj-JcD.js → CollectionPage.vue_vue_type_script_setup_true_lang-DPcCnrjr.js} +3 -3
  7. package/dist/{DateField.vue_vue_type_script_setup_true_lang-CDg31ZU7.js → DateField.vue_vue_type_script_setup_true_lang-BxUuUypB.js} +1 -1
  8. package/dist/{DeadLetters-IgVHao84.js → DeadLetters-CeHfhFHP.js} +6 -5
  9. package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-CSgT4ITL.js → FormGroup.vue_vue_type_script_setup_true_lang-CNb2CK01.js} +1 -1
  10. package/dist/{FormView.vue_vue_type_script_setup_true_lang-D31Hk3pJ.js → FormView.vue_vue_type_script_setup_true_lang-nyz8EkzM.js} +1 -1
  11. package/dist/{General-C40HxupS.js → General-BNTjPvat.js} +6 -6
  12. package/dist/{NewRolePage-Bhy8KJO1.js → NewRolePage-Btg7gzzH.js} +7 -6
  13. package/dist/{NumberField.vue_vue_type_script_setup_true_lang-BdS7BxuS.js → NumberField.vue_vue_type_script_setup_true_lang-C8um4ARi.js} +1 -1
  14. package/dist/PersonAccess.vue_vue_type_script_setup_true_lang-ClmawvYm.js +600 -0
  15. package/dist/{ProfilePage-Bf7dFzGd.js → ProfilePage-CoZyG11N.js} +9 -9
  16. package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-C6oloGIh.js → RoleEditor.vue_vue_type_script_setup_true_lang-Bs9bo0Zb.js} +30 -29
  17. package/dist/{RolePage-BjbvciTg.js → RolePage-CPlwZA6X.js} +37 -35
  18. package/dist/{RolesPage-DzVOgF4z.js → RolesPage-CdYdIHR4.js} +29 -27
  19. package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-DXe_iOS8.js → SegmentedField.vue_vue_type_script_setup_true_lang-B_hBL5f4.js} +1 -1
  20. package/dist/{SelectField.vue_vue_type_script_setup_true_lang-BN4vzvV9.js → SelectField.vue_vue_type_script_setup_true_lang-CBZhGNpm.js} +4 -4
  21. package/dist/ServiceAccountDialog.vue_vue_type_script_setup_true_lang-DuvSSBbX.js +126 -0
  22. package/dist/ServiceAccountRecord-BtaUZuWU.js +511 -0
  23. package/dist/ServiceAccountsList-CcRJvNaf.js +137 -0
  24. package/dist/{SessionList.vue_vue_type_script_setup_true_lang-PuWIK-Wa.js → SessionList.vue_vue_type_script_setup_true_lang-VvBB2EZz.js} +2 -2
  25. package/dist/{Sessions-CRUObe5G.js → Sessions-DkGNO1FO.js} +2 -2
  26. package/dist/{SettingsPage-C0qEC0uI.js → SettingsPage-D4G1HGbG.js} +8 -8
  27. package/dist/{SignIn-Uy0Jujzz.js → SignIn-DS1YymqD.js} +4 -4
  28. package/dist/{SignInPage-CpVZfrLZ.js → SignInPage-BrmL0PUw.js} +3 -3
  29. package/dist/{SignIns-Cp5Gx2dk.js → SignIns-C7l7IPHQ.js} +1 -1
  30. package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-Dj5Aq8QT.js → SwitchField.vue_vue_type_script_setup_true_lang-DXZK89A3.js} +1 -1
  31. package/dist/{TextField.vue_vue_type_script_setup_true_lang-BwfNNQEz.js → TextField.vue_vue_type_script_setup_true_lang-CX3LdZLK.js} +2 -2
  32. package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-aT1P8Xqr.js → TextareaField.vue_vue_type_script_setup_true_lang-BOtn_1GT.js} +1 -1
  33. package/dist/{TimeField.vue_vue_type_script_setup_true_lang-jPKPE1hc.js → TimeField.vue_vue_type_script_setup_true_lang-CbflIrq6.js} +1 -1
  34. package/dist/{UserRecord-DbSMnTbj.js → UserRecord-Du8M_kuk.js} +25 -25
  35. package/dist/{UsersList-9MicE2pG.js → UsersList-D3ydQice.js} +13 -13
  36. package/dist/access/api.d.ts +7 -8
  37. package/dist/access/context.d.ts +2 -7
  38. package/dist/access/feature.d.ts +0 -8
  39. package/dist/access/index.js +47 -15
  40. package/dist/collection/index.js +17 -16
  41. package/dist/form/index.js +586 -611
  42. package/dist/http-nz92KjdS.js +42 -0
  43. package/dist/i18n/index.js +32 -32
  44. package/dist/identity/index.d.ts +7 -0
  45. package/dist/identity/index.js +19 -15
  46. package/dist/identity/serviceaccounts/ApiKeysPanel.vue.d.ts +17 -0
  47. package/dist/identity/serviceaccounts/CreatedApiKeyDialog.vue.d.ts +53 -0
  48. package/dist/identity/serviceaccounts/NewApiKeyDialog.vue.d.ts +24 -0
  49. package/dist/identity/serviceaccounts/ServiceAccountDialog.vue.d.ts +22 -0
  50. package/dist/identity/serviceaccounts/ServiceAccountRecord.vue.d.ts +2 -0
  51. package/dist/identity/serviceaccounts/ServiceAccountsList.vue.d.ts +2 -0
  52. package/dist/identity/serviceaccounts/access.d.ts +4 -0
  53. package/dist/identity/serviceaccounts/api.d.ts +27 -0
  54. package/dist/identity/serviceaccounts/context.d.ts +14 -0
  55. package/dist/identity/serviceaccounts/feature.d.ts +23 -0
  56. package/dist/identity/serviceaccounts/form.d.ts +4 -0
  57. package/dist/identity/serviceaccounts/messages.d.ts +11 -0
  58. package/dist/identity/serviceaccounts/routes.d.ts +22 -0
  59. package/dist/{index-Ok29ucE3.js → index-Cmj9iZmT.js} +191 -168
  60. package/dist/{index-C-oM_Mnf.js → index-DH0MoFqg.js} +2 -2
  61. package/dist/index.d.ts +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/internal/copyText.d.ts +5 -0
  64. package/dist/modules/serviceaccount/entities.d.ts +127 -0
  65. package/dist/modules/serviceaccount/routes.d.ts +58 -0
  66. package/dist/modules/serviceaccount/schemas.d.ts +49 -0
  67. package/dist/{neighbors-Bv6vnWlW.js → neighbors-DNZuGlQH.js} +1 -1
  68. package/dist/notifications/index.js +1 -1
  69. package/dist/{options-Bu0XbEpN.js → options-e_CAfvDQ.js} +3 -3
  70. package/dist/phone/index.js +1 -1
  71. package/dist/refusals-COPr15XZ.js +135 -0
  72. package/dist/routes-CVckt7Pj.js +19 -0
  73. package/dist/state-BC1Fc6U2.js +154 -0
  74. package/dist/{status-C78NpXyB.js → status-C8XtnK6m.js} +7 -6
  75. package/dist/styles.css +1 -1
  76. package/dist/{suggestions-ClyLexMO.js → suggestions-cPjs5gQz.js} +1 -1
  77. package/dist/{useCommand-DyuPTosF.js → useCommand-CfG727e8.js} +1 -1
  78. package/dist/{useGroupSheet-C2NyqWRp.js → useGroupSheet-BVcNDWbP.js} +2 -2
  79. package/dist/useRecordDialog-D65FF85F.js +30 -0
  80. package/package.json +2 -2
  81. package/dist/http-CdQowFlW.js +0 -194
  82. package/dist/index-BdGnA1Jh.js +0 -765
@@ -1,765 +0,0 @@
1
- import { route as x } from "./client/index.js";
2
- import { d as Re, p as Te } from "./feature-DdUAfyi4.js";
3
- import { d as Ne } from "./context-Ch1r4fdN.js";
4
- import { d as Se } from "./defineRoutes-BGAdiIrt.js";
5
- import { useI18n as H } from "vue-i18n";
6
- import { hasInjectionContext as Oe, inject as Ae, defineComponent as X, ref as O, computed as T, watch as re, openBlock as m, createBlock as N, unref as n, withCtx as h, createElementVNode as S, createElementBlock as g, toDisplayString as j, createCommentVNode as A, createVNode as E, Fragment as K, renderList as B, createSlots as ge, renderSlot as De, createTextVNode as V, useTemplateRef as ie } from "vue";
7
- import { i as te } from "./error-Bb_dr_Ay.js";
8
- import { u as Ke } from "./describeError-BqGAUZgX.js";
9
- import { _ as J } from "./Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
10
- import { _ as z } from "./FormGroup.vue_vue_type_script_setup_true_lang-CSgT4ITL.js";
11
- import { g as U } from "./options-Bu0XbEpN.js";
12
- import { _ as Pe } from "./AlertDialog.vue_vue_type_script_setup_true_lang-whA4WLdl.js";
13
- import { t as ae } from "./toast-CqSDTWRX.js";
14
- import { _ as ue } from "./AccessGate.vue_vue_type_script_setup_true_lang-DZ9GcLC1.js";
15
- import { _ as Be } from "./AsyncSection.vue_vue_type_script_setup_true_lang-B0NfvG3B.js";
16
- import { _ as Ue } from "./EmptyState.vue_vue_type_script_setup_true_lang-50p-Mp8I.js";
17
- import { u as Fe } from "./useLoad-W4tfxmm5.js";
18
- import { _ as Ge, a as Me } from "./SelectField.vue_vue_type_script_setup_true_lang-BN4vzvV9.js";
19
- import { _ as Ve } from "./SegmentedField.vue_vue_type_script_setup_true_lang-DXe_iOS8.js";
20
- import { u as ze, _ as He } from "./useCommand-DyuPTosF.js";
21
- import { u as We } from "./platform-Dx6STiwY.js";
22
- import { _ as Ie } from "./IconTile.vue_vue_type_script_setup_true_lang-_FXvaj93.js";
23
- import { u as Qe } from "./mediaQuery-CygcXmFW.js";
24
- import { _ as Ye } from "./Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js";
25
- const D = {
26
- rolesList: x("GET", "/v1/iam/roles", { permission: "iam.role:view" }),
27
- rolesShow: x("GET", "/v1/iam/roles/:ref", { permission: "iam.role:view" }),
28
- rolesHolders: x("GET", "/v1/iam/roles/:ref/holders", { permission: "iam.role:view" }),
29
- rolesCompare: x("GET", "/v1/iam/roles/:ref/compare", { permission: "iam.role:view" }),
30
- rolesCreate: x("POST", "/v1/iam/roles", { permission: "iam.role:manage" }),
31
- rolesUpdate: x("PUT", "/v1/iam/roles/:ref", { permission: "iam.role:manage" }),
32
- rolesDelete: x("DELETE", "/v1/iam/roles/:ref", { permission: "iam.role:delete" }),
33
- rolesReplace: x("POST", "/v1/iam/roles/:ref/replace", { permission: "iam.role:manage" }),
34
- bindable: x("GET", "/v1/iam/bindable-roles"),
35
- subjectsAccess: x("GET", "/v1/iam/users/:id/access", { permission: "iam.user:view" }),
36
- subjectsScopes: x("GET", "/v1/iam/users/:id/scopes", { permission: "iam.user:manage" }),
37
- subjectsBind: x("POST", "/v1/iam/users/:id/bindings", { permission: "iam.user:manage" }),
38
- subjectsUnbind: x("DELETE", "/v1/iam/users/:id/bindings/:binding_id", { permission: "iam.user:manage" }),
39
- me: x.raw("GET", "/v1/me/access")
40
- }, [ye, Z] = Ne("vue-core.access"), F = {
41
- viewRoles: "iam.role:view",
42
- manageRoles: "iam.role:manage",
43
- deleteRoles: "iam.role:delete",
44
- viewAccess: "iam.user:view",
45
- manageBindings: "iam.user:manage"
46
- }, de = Se({
47
- roles: { name: "access.roles", path: "/iam/roles", component: () => import("./RolesPage-DzVOgF4z.js"), meta: { access: F.viewRoles, titleKey: "core.access.title" } },
48
- newRole: { name: "access.roles.new", path: "/iam/roles/new", component: () => import("./NewRolePage-Bhy8KJO1.js"), meta: { access: F.manageRoles, titleKey: "core.access.new_title" } },
49
- role: {
50
- name: "access.role",
51
- path: "/iam/roles/:ref",
52
- component: () => import("./RolePage-BjbvciTg.js"),
53
- // A role's ref (its key, or the id of a custom one) swaps in place when a link leads to another role.
54
- meta: { access: F.viewRoles, titleKey: "core.access.title", remountOnParam: "ref" }
55
- }
56
- }), na = {
57
- access: F.viewAccess,
58
- section: { labelKey: "core.access.person_roles", icon: "shieldStarFill" }
59
- };
60
- function la(s) {
61
- return Re({
62
- id: "access",
63
- routes: de.records,
64
- context: Te(ye, {
65
- catalogue: s.catalogue,
66
- subjectRoute: s.subjectRoute ?? (() => null),
67
- constraints: s.roleConstraints ?? [],
68
- problems: s.problems ?? {},
69
- subjects: s.subjects ?? {},
70
- scopes: s.scopes ?? null
71
- }),
72
- navigation: s.destination ? [{ destination: s.destination, to: de.roles, within: ["access.role", "access.roles.new"] }] : []
73
- });
74
- }
75
- const G = "system", me = ["view", "create", "update", "manage", "delete"], fe = (s) => {
76
- const l = me.indexOf(s);
77
- return l === -1 ? me.length : l;
78
- }, oe = (s) => s.system ? G : s.module, he = (s) => s.resource === "" ? s.module : `${s.module}_${s.resource.replace(/\./g, "_")}`;
79
- function ca(s) {
80
- const l = /* @__PURE__ */ new Map();
81
- for (const [c, t] of Object.entries(s)) {
82
- const o = l.get(oe(t)) ?? /* @__PURE__ */ new Map(), a = he(t);
83
- o.set(a, [...o.get(a) ?? [], { ...t, id: c }]), l.set(oe(t), o);
84
- }
85
- return [...l.keys()].sort((c, t) => +(c === G) - +(t === G) || c.localeCompare(t)).map((c) => ({
86
- key: c,
87
- screens: [...l.get(c) ?? []].map(([t, o]) => ({ key: t, permissions: o.sort((a, u) => fe(a.verb) - fe(u.verb) || a.verb.localeCompare(u.verb)) })).sort((t, o) => t.key.localeCompare(o.key))
88
- }));
89
- }
90
- function Je(s, l) {
91
- const e = /* @__PURE__ */ new Set(), c = (t) => {
92
- for (const o of s[t]?.requires ?? [])
93
- e.has(o) || (e.add(o), c(o));
94
- };
95
- return c(l), [...e];
96
- }
97
- function Xe(s, l) {
98
- const e = /* @__PURE__ */ new Set(), c = (t) => {
99
- for (const [o, a] of Object.entries(s))
100
- e.has(o) || !a.requires.includes(t) || (e.add(o), c(o));
101
- };
102
- return c(l), [...e];
103
- }
104
- function Ze(s, l, e) {
105
- const c = Object.entries(s).filter(([o, a]) => a.ownable === e && o in l), t = c.find(([, o]) => o.verb === "view") ?? c[0];
106
- return t ? l[t[0]] ?? null : null;
107
- }
108
- function es(s, l, e) {
109
- for (const c of [e, ...Je(s, e)]) {
110
- if (c in l || !(c in s)) continue;
111
- const t = s[c]?.ownable;
112
- l[c] = t ? Ze(s, l, t) ?? "own" : "all";
113
- }
114
- }
115
- function ra(s, l, e) {
116
- for (const c of [e, ...Xe(s, e)]) delete l[c];
117
- }
118
- function ia(s, l, e, c) {
119
- for (const [t, o] of Object.entries(s)) o.ownable === e && t in l && (l[t] = c);
120
- }
121
- function ua(s, l) {
122
- const e = new Set(Object.keys(l));
123
- for (const c of e) es(s, l, c);
124
- return Object.keys(l).filter((c) => !e.has(c));
125
- }
126
- function W() {
127
- const { t: s, te: l } = H(), { catalogue: e, constraints: c } = Z(), t = (a, u) => {
128
- const $ = a.find((p) => l(p));
129
- return $ ? s($) : u;
130
- }, o = (a) => t([`access.levels.${a}`, `core.access.levels.${a}`], a);
131
- return {
132
- roleName: (a) => a.key ? t([`access.roles.${a.key}`], a.name) : a.name,
133
- permissionLabel: (a) => t(e[a]?.labelKey ? [e[a].labelKey] : [], a),
134
- permissionDescription: (a) => t(e[a]?.descriptionKey ? [e[a].descriptionKey] : [], ""),
135
- groupLabel: (a) => t([`access.modules.${a}`, ...a === G ? ["core.access.system_group"] : []], a),
136
- screenLabel: (a) => t([`access.resources.${a}`], a),
137
- ownableLabel: (a) => t([`access.ownable.${a.replace(/\./g, "_")}`], a),
138
- qualifierLabel: (a) => s(`core.access.qualifier.${a}`),
139
- qualifierHint: (a) => s(`core.access.qualifier_hint.${a}`),
140
- qualifierNoun: (a) => s(`core.access.qualifier_noun.${a}`),
141
- levelLabel: o,
142
- /** A place: the level and its name (`Dealer · Auto Zagreb`); the root, which has no name, by its level. */
143
- scopeLabel: (a) => a.name ? `${o(a.level)} · ${a.name}` : o(a.level),
144
- /** A role's constraint as the application worded it (`Used only`); an attribute or value it gave no text for stays as `attribute: value`. */
145
- constraintLabel: (a) => {
146
- const u = c.find((p) => p.attribute === a.attribute)?.options ?? [], $ = a.values.map((p) => u.find((q) => q.value === p)?.labelKey);
147
- return $.every((p) => p !== void 0 && l(p)) ? $.map((p) => s(p)).join(", ") : `${a.attribute}: ${a.values.join(", ")}`;
148
- },
149
- roleKind: (a) => s(`core.access.role_kind.${a.computed ? "computed" : a.predefined ? "predefined" : "custom"}`)
150
- };
151
- }
152
- function ss(s) {
153
- if (!te(s) || s.code !== "authz.invalid") return [];
154
- const l = s.params?.problems;
155
- return Array.isArray(l) ? l.flatMap((e) => {
156
- if (typeof e != "object" || e === null || typeof e.code != "string") return [];
157
- const { code: c, permission: t, detail: o } = e;
158
- return [{ code: c, ...typeof t == "string" ? { permission: t } : {}, ...typeof o == "string" ? { detail: o } : {} }];
159
- }) : [];
160
- }
161
- function we() {
162
- const { t: s, te: l } = H(), e = Ke(), c = Oe() ? Ae(ye, null) : null, t = c ? W() : null;
163
- return (o, a) => {
164
- const u = ss(o);
165
- if (u.length === 0) return e(o, a);
166
- const $ = u.map((p) => {
167
- const q = [c?.problems[p.code], `core.access.problems.${p.code}`].find((r) => r && l(r)), R = { code: p.code, permission: p.permission ? t?.permissionLabel(p.permission) ?? p.permission : "", detail: p.detail ?? "" };
168
- return s(q ?? "core.access.problems.unknown", R);
169
- });
170
- return [...new Set($)].join(" ");
171
- };
172
- }
173
- function as() {
174
- const s = we();
175
- return (l, e) => te(e) && e.code?.startsWith("authz.") ? s(e) : void 0;
176
- }
177
- function M(s, l) {
178
- if (l === "user") return D;
179
- const e = s[l];
180
- if (!e) throw new Error(`vue-core access: no routes for ${l} subjects; pass accessFeature({ subjects: { ${l}: { base, bindable } } })`);
181
- return {
182
- bindable: x("GET", e.bindable),
183
- subjectsAccess: x("GET", `${e.base}/:id/access`),
184
- subjectsScopes: x("GET", `${e.base}/:id/scopes`),
185
- subjectsBind: x("POST", `${e.base}/:id/bindings`),
186
- subjectsUnbind: x("DELETE", `${e.base}/:id/bindings/:binding_id`)
187
- };
188
- }
189
- function os(s, l = {}) {
190
- return {
191
- roles: async (e) => (await s.request(D.rolesList, void 0, e)).data.roles,
192
- role: async (e, c) => (await s.request(D.rolesShow, { ref: e }, c)).data,
193
- holders: async (e, c) => (await s.request(D.rolesHolders, { ref: e }, c)).data.holders,
194
- compare: async (e, c, t) => (await s.request(D.rolesCompare, { ref: e, with: c }, t)).data,
195
- create: async (e) => (await s.request(D.rolesCreate, e)).data,
196
- update: async (e) => (await s.request(D.rolesUpdate, e)).data,
197
- remove: async (e) => void await s.request(D.rolesDelete, { ref: e }),
198
- replace: async (e, c) => (await s.request(D.rolesReplace, { ref: e, with: c })).data.rebound,
199
- access: async (e, c) => (await s.request(M(l, e.kind).subjectsAccess, { id: e.id }, c)).data,
200
- scopes: async (e, c) => (await s.request(M(l, e.kind).subjectsScopes, { id: e.id }, c)).data,
201
- bindable: async (e, c, t, o) => (await s.request(M(l, e.kind).bindable, { level: c, scope_id: t ?? 0 }, o)).data.roles,
202
- bind: async (e, c) => (await s.request(M(l, e.kind).subjectsBind, { id: e.id, ...c })).data,
203
- unbind: async (e, c) => void await s.request(M(l, e.kind).subjectsUnbind, { id: e.id, binding_id: c })
204
- };
205
- }
206
- const ke = () => os(We().http, Z().subjects);
207
- function ts(s) {
208
- const l = /* @__PURE__ */ new Map();
209
- for (const t of s.places) l.set(t.level, t.parent_level);
210
- const e = (t) => {
211
- const o = [t], a = new Set(o);
212
- for (let u = l.get(t); u !== void 0 && u !== s.root_level && l.has(u) && !a.has(u); u = l.get(u))
213
- o.unshift(u), a.add(u);
214
- return o;
215
- }, c = [...l.keys()].map((t) => ({ level: t, chain: e(t) })).sort((t, o) => o.chain.length - t.chain.length || t.level.localeCompare(o.level));
216
- return s.root ? [...c, { level: s.root_level, chain: [] }] : c;
217
- }
218
- const ns = (s) => s.filter((l) => l.chain.length > 0).sort((l, e) => l.chain.length - e.chain.length)[0] ?? s[0] ?? null;
219
- function pe(s, l, e, c) {
220
- const t = l.chain[e], o = l.chain[e + 1];
221
- return s.places.filter(
222
- (a) => a.level === t && (e === 0 || a.parent_level === l.chain[e - 1] && a.parent_id === c[e - 1]) && (o === void 0 || s.places.some((u) => u.level === o && u.parent_id === a.id))
223
- );
224
- }
225
- const ls = {
226
- class: "flex min-w-0 flex-col gap-group-gap",
227
- "data-test": "add-role-sheet"
228
- }, cs = {
229
- key: 0,
230
- class: "px-row-inset text-body text-content-destructive",
231
- role: "alert",
232
- "data-test": "scopes-failed"
233
- }, rs = {
234
- key: 1,
235
- class: "px-row-inset text-body text-content-muted",
236
- "data-test": "no-places"
237
- }, is = {
238
- key: 0,
239
- class: "px-row-inset text-body text-content-muted",
240
- "data-test": "roles-loading"
241
- }, us = {
242
- key: 1,
243
- class: "px-row-inset text-body text-content-destructive",
244
- role: "alert",
245
- "data-test": "roles-failed"
246
- }, ds = {
247
- key: 2,
248
- class: "px-row-inset text-body text-content-muted",
249
- "data-test": "roles-none"
250
- }, ms = {
251
- key: 3,
252
- "data-test": "bindable-roles"
253
- }, fs = { class: "px-row-inset pb-1.5 text-footnote uppercase tracking-wide text-content-muted" }, ps = {
254
- key: 4,
255
- "data-test": "chosen-role"
256
- }, vs = /* @__PURE__ */ X({
257
- __name: "AddRoleDialog",
258
- props: {
259
- subject: {},
260
- subjectLabel: {}
261
- },
262
- emits: ["added"],
263
- setup(s, { expose: l, emit: e }) {
264
- const c = s, t = e, { t: o } = H(), a = W(), u = ke(), { catalogue: $, scopes: p } = Z(), R = ze({
265
- defaults: () => ({ level: null, place: null, role: null }),
266
- validator: {
267
- safeParse(i) {
268
- const f = i, d = [
269
- ...f.level === null || f.level !== v.value?.root_level && f.place === null ? [{ path: ["level"], message: o("core.access.add.choose_place") }] : [],
270
- ...f.role === null ? [{ path: ["role"], message: o("core.access.add.choose_role") }] : []
271
- ];
272
- return d.length === 0 ? { success: !0, data: { level: f.level, place: f.place, role: f.role } } : { success: !1, error: { issues: d } };
273
- }
274
- },
275
- failureMessage: as(),
276
- run: (i) => u.bind(c.subject, { role_ref: i.role, level: i.level, scope_id: i.place }),
277
- done: (i) => {
278
- ae.success(o("core.access.added")), t("added", i);
279
- }
280
- }), r = R.form.values, v = O(null), y = O(!1), b = O([]), _ = O([]), L = O(!1), w = O(!1), k = T(() => v.value ? ts(v.value) : []), C = T(() => k.value.find((i) => i.level === r.level) ?? null), ne = T(() => k.value.length > 1), $e = T(() => {
281
- const i = v.value, f = C.value;
282
- return i && f ? f.chain.map((d, P) => ({ name: d, places: pe(i, f, P, b.value) })) : [];
283
- }), xe = T(() => {
284
- const i = C.value?.chain.length ?? 0, f = i ? b.value[i - 1] : null;
285
- return v.value?.places.find((d) => d.level === C.value?.level && d.id === f)?.name ?? null;
286
- }), ee = T(() => C.value !== null && C.value.chain.every((i, f) => b.value[f] != null));
287
- function le(i) {
288
- r.level = i, b.value = [], r.place = null;
289
- }
290
- function ce(i, f) {
291
- const d = b.value.slice(0, i);
292
- d[i] = f, b.value = d;
293
- }
294
- re([() => r.level, b, v], () => {
295
- const i = v.value, f = C.value;
296
- if (!(!i || !f)) {
297
- for (let d = 0; d < f.chain.length; d++) {
298
- if (b.value[d] != null) continue;
299
- const P = pe(i, f, d, b.value);
300
- P.length === 1 && P[0] && ce(d, P[0].id);
301
- break;
302
- }
303
- r.place = f.chain.length === 0 ? null : b.value[f.chain.length - 1] ?? null;
304
- }
305
- }, { deep: !0 });
306
- async function je() {
307
- if (r.role = null, _.value = [], w.value = !1, !C.value || !ee.value) return;
308
- L.value = !0;
309
- const i = `${r.level}:${r.place}`;
310
- try {
311
- const f = await u.bindable(c.subject, C.value.level, r.place);
312
- i === `${r.level}:${r.place}` && (_.value = f);
313
- } catch {
314
- i === `${r.level}:${r.place}` && (w.value = !0);
315
- } finally {
316
- L.value = !1;
317
- }
318
- }
319
- re([() => r.level, () => r.place, ee], () => void je());
320
- const qe = T(() => _.value.map((i) => ({ value: i.ref, label: a.roleName(i), description: a.roleKind(i) }))), I = T(() => _.value.find((i) => i.ref === r.role) ?? null), Le = T(() => {
321
- const i = /* @__PURE__ */ new Map();
322
- for (const f of I.value?.grants ?? []) {
323
- const d = $[f.permission]?.ownable;
324
- d && (!i.has(d) || f.permission.endsWith(":view")) && i.set(d, f.qualifier);
325
- }
326
- return [...i].map(([f, d]) => ({ ownable: f, qualifier: d }));
327
- }), Ee = T(() => a.scopeLabel({ level: r.level ?? v.value?.root_level ?? "", name: xe.value }));
328
- async function Ce() {
329
- v.value = null, y.value = !1, b.value = [], _.value = [], R.present();
330
- try {
331
- v.value = p ? await p(c.subject, new AbortController().signal) : await u.scopes(c.subject);
332
- } catch {
333
- y.value = !0;
334
- return;
335
- }
336
- const i = ns(k.value);
337
- i && le(i.level);
338
- }
339
- return l({ present: Ce }), (i, f) => (m(), N(n(He), {
340
- command: n(R),
341
- title: n(o)("core.access.add_role"),
342
- subtitle: c.subjectLabel,
343
- size: "lg",
344
- "confirm-label": n(o)("core.access.add.confirm")
345
- }, {
346
- default: h(() => [
347
- S("div", ls, [
348
- y.value ? (m(), g("p", cs, j(n(o)("core.access.add.scopes_failed")), 1)) : v.value && k.value.length === 0 ? (m(), g("p", rs, j(n(o)("core.access.add.no_places")), 1)) : A("", !0),
349
- ne.value ? (m(), N(n(z), {
350
- key: 2,
351
- header: n(o)("core.access.add.scope_header")
352
- }, {
353
- default: h(() => [
354
- E(n(Ve), {
355
- "model-value": n(r).level,
356
- label: n(o)("core.access.add.scope_level"),
357
- options: k.value.map((d) => ({ value: d.level, label: n(a).levelLabel(d.level) })),
358
- "onUpdate:modelValue": f[0] || (f[0] = (d) => le(d))
359
- }, null, 8, ["model-value", "label", "options"]),
360
- (m(!0), g(K, null, B($e.value, (d, P) => (m(), N(n(Ge), {
361
- key: d.name,
362
- "model-value": b.value[P] ?? null,
363
- label: n(a).levelLabel(d.name),
364
- options: d.places.map((Q) => ({ value: Q.id, label: Q.name })),
365
- "onUpdate:modelValue": (Q) => ce(P, Q)
366
- }, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"]))), 128))
367
- ]),
368
- _: 1
369
- }, 8, ["header"])) : A("", !0),
370
- ee.value ? (m(), g(K, { key: 3 }, [
371
- L.value ? (m(), g("p", is, j(n(o)("core.access.add.roles_loading")), 1)) : w.value ? (m(), g("p", us, j(n(o)("core.access.add.roles_failed")), 1)) : _.value.length === 0 ? (m(), g("p", ds, j(n(o)("core.access.add.no_roles")), 1)) : (m(), g("div", ms, [
372
- S("p", fs, j(n(o)("core.access.add.role")), 1),
373
- E(n(Me), {
374
- options: qe.value,
375
- "model-value": n(r).role,
376
- onSelect: f[1] || (f[1] = (d) => n(r).role = d)
377
- }, null, 8, ["options", "model-value"])
378
- ]))
379
- ], 64)) : A("", !0),
380
- I.value ? (m(), g("div", ps, [
381
- E(n(z), {
382
- header: n(o)("core.access.add.role_gives"),
383
- footer: n(o)("core.access.add.role_gives_footer")
384
- }, {
385
- default: h(() => [
386
- E(n(U), {
387
- layout: "setting",
388
- label: n(a).roleName(I.value),
389
- sub: I.value.description
390
- }, null, 8, ["label", "sub"]),
391
- (m(!0), g(K, null, B(Le.value, (d) => (m(), N(n(U), {
392
- key: d.ownable,
393
- layout: "setting",
394
- label: n(a).ownableLabel(d.ownable),
395
- value: `${n(a).qualifierNoun(d.qualifier)} · ${Ee.value}`
396
- }, null, 8, ["label", "value"]))), 128))
397
- ]),
398
- _: 1
399
- }, 8, ["header", "footer"])
400
- ])) : A("", !0)
401
- ])
402
- ]),
403
- _: 1
404
- }, 8, ["command", "title", "subtitle", "confirm-label"]));
405
- }
406
- }), bs = {
407
- class: "text-right text-footnote text-content-muted compact:text-left",
408
- "data-test": "binding-scope"
409
- }, _s = /* @__PURE__ */ X({
410
- __name: "BindingRow",
411
- props: {
412
- binding: {}
413
- },
414
- setup(s) {
415
- const l = s, e = W(), c = T(() => [e.roleKind(l.binding.role), ...l.binding.role.attrs.map(e.constraintLabel)].join(" · "));
416
- return (t, o) => (m(), N(n(U), {
417
- layout: "setting",
418
- "stack-on-compact": "",
419
- label: n(e).roleName(l.binding.role),
420
- sub: c.value
421
- }, ge({
422
- leading: h(() => [
423
- E(n(Ie), {
424
- tone: l.binding.role.predefined ? "anchor" : "brand",
425
- icon: "shieldStarFill"
426
- }, null, 8, ["tone"])
427
- ]),
428
- default: h(() => [
429
- S("span", bs, j(n(e).scopeLabel(l.binding.scope)), 1)
430
- ]),
431
- _: 2
432
- }, [
433
- t.$slots.trailing ? {
434
- name: "trailing",
435
- fn: h(() => [
436
- De(t.$slots, "trailing")
437
- ]),
438
- key: "0"
439
- } : void 0
440
- ]), 1032, ["label", "sub"]));
441
- }
442
- }), ve = { own: 0, own_location: 1, all: 2 }, be = (s, l) => ve[l] > ve[s] ? l : s, Y = (s) => `${s.level}:${s.id ?? ""}`, se = ["view", "create", "update", "manage", "delete"], _e = (s) => se.includes(s) ? se.indexOf(s) : se.length;
443
- function gs(s, l) {
444
- const e = /* @__PURE__ */ new Map();
445
- for (const t of l) {
446
- if (t.grants.length === 0) continue;
447
- const o = s[t.permission], [a = t.permission, u = ""] = t.permission.split(":"), $ = o ? oe(o) : a.split(".")[0] ?? a, p = o ? he(o) : a.replace(/\./g, "_"), q = o?.ownable != null, R = e.get($) ?? /* @__PURE__ */ new Map(), r = R.get(p) ?? { key: p, actions: [], sources: [], qualifier: null, scopes: [], ownable: !1, allUnavailable: !0 };
448
- r.actions.push({ permission: t.permission, verb: o?.verb ?? u, unavailable: t.unavailable, grants: t.grants }), r.ownable || (r.ownable = q), r.allUnavailable && (r.allUnavailable = t.unavailable);
449
- for (const v of t.grants) {
450
- const y = q ? v.qualifier : "all";
451
- r.scopes.some((_) => Y(_) === Y(v.scope)) || r.scopes.push(v.scope), q && (r.qualifier = r.qualifier ? be(r.qualifier, y) : y);
452
- const b = r.sources.find((_) => _.roleName === v.role_name && Y(_.scope) === Y(v.scope));
453
- b ? q && (r.sources[r.sources.indexOf(b)] = { ...b, qualifier: be(b.qualifier, y) }) : r.sources.push({ roleKey: v.role_key, roleName: v.role_name, qualifier: y, scope: v.scope });
454
- }
455
- R.set(p, r), e.set($, R);
456
- }
457
- return [...e.keys()].sort((t, o) => +(t === G) - +(o === G) || t.localeCompare(o)).map((t) => ({
458
- key: t,
459
- screens: [...e.get(t)?.values() ?? []].map((o) => ({
460
- ...o,
461
- actions: [...o.actions].sort((a, u) => _e(a.verb) - _e(u.verb) || a.verb.localeCompare(u.verb)),
462
- // the root (the place without an id) first: what applies everywhere is what a reader looks for
463
- scopes: [...o.scopes].sort((a, u) => +(u.id === null) - +(a.id === null))
464
- })).sort((o, a) => o.key.localeCompare(a.key))
465
- }));
466
- }
467
- const ys = {
468
- class: "flex min-w-0 flex-col gap-group-gap",
469
- "data-test": "effective-access"
470
- }, hs = { class: "px-row-inset text-title3 font-semibold text-content-strong" }, ws = {
471
- class: "block",
472
- "data-test": "effective-actions"
473
- }, ks = {
474
- class: "block",
475
- "data-test": "effective-sources"
476
- }, $s = {
477
- key: 0,
478
- class: "mt-2 flex flex-col gap-1.5 border-l border-border-separator pl-3",
479
- "data-test": "effective-why"
480
- }, xs = ["data-permission"], js = { class: "text-content" }, qs = {
481
- key: 0,
482
- class: "ml-2 text-content-muted"
483
- }, Ls = {
484
- key: 0,
485
- class: "contents",
486
- "data-test": "effective-unavailable"
487
- }, Es = {
488
- class: "text-right text-footnote text-content-muted compact:text-left",
489
- "data-test": "effective-reach"
490
- }, Cs = ["data-test"], Rs = {
491
- key: 0,
492
- class: "contents",
493
- "data-test": "effective-show-all"
494
- }, Ts = /* @__PURE__ */ X({
495
- __name: "EffectiveAccess",
496
- props: {
497
- effective: {},
498
- name: {}
499
- },
500
- setup(s) {
501
- const l = s, { t: e } = H(), { catalogue: c } = Z(), t = W(), o = Qe(), a = T(() => gs(c, l.effective)), u = O(!1), $ = T(() => o.value && !u.value ? a.value.slice(0, 3) : a.value), p = O({}), q = (v) => v.actions.map((y) => t.permissionLabel(y.permission)).join(" · "), R = (v) => v.sources.map((y) => {
502
- const b = t.roleName({ key: y.roleKey, name: y.roleName });
503
- return v.ownable ? `${b} (${t.qualifierNoun(y.qualifier).toLowerCase()})` : b;
504
- }).join(", "), r = (v) => [v.qualifier ? t.qualifierNoun(v.qualifier) : "", v.scopes.map((y) => t.scopeLabel(y)).join(", ")].filter(Boolean).join(" · ");
505
- return (v, y) => (m(), g("section", ys, [
506
- S("h2", hs, j(n(e)("core.access.effective.title", { name: l.name })), 1),
507
- a.value.length === 0 ? (m(), N(n(z), {
508
- key: 0,
509
- footer: n(e)("core.access.effective.footer")
510
- }, {
511
- default: h(() => [
512
- E(n(U), {
513
- layout: "setting",
514
- label: n(e)("core.access.effective.empty")
515
- }, null, 8, ["label"])
516
- ]),
517
- _: 1
518
- }, 8, ["footer"])) : (m(), g(K, { key: 1 }, [
519
- (m(!0), g(K, null, B($.value, (b) => (m(), N(n(z), {
520
- key: b.key,
521
- header: n(t).groupLabel(b.key),
522
- footer: b === $.value[$.value.length - 1] ? n(e)("core.access.effective.footer") : void 0
523
- }, {
524
- default: h(() => [
525
- (m(!0), g(K, null, B(b.screens, (_) => (m(), N(n(U), {
526
- key: _.key,
527
- layout: "setting",
528
- "stack-on-compact": "",
529
- label: n(t).screenLabel(_.key)
530
- }, {
531
- sub: h(() => [
532
- S("span", ws, j(q(_)), 1),
533
- S("span", ks, j(n(e)("core.access.effective.from_roles", { roles: R(_) })), 1),
534
- p.value[_.key] ? (m(), g("ul", $s, [
535
- (m(!0), g(K, null, B(_.actions, (L) => (m(), g("li", {
536
- key: L.permission,
537
- "data-permission": L.permission
538
- }, [
539
- S("span", js, j(n(t).permissionLabel(L.permission)), 1),
540
- L.unavailable ? (m(), g("span", qs, j(n(e)("core.access.effective.unavailable")), 1)) : A("", !0),
541
- (m(!0), g(K, null, B(L.grants, (w) => (m(), g("span", {
542
- key: `${w.binding_id}-${w.scope.level}-${w.scope.id ?? 0}`,
543
- class: "block text-content-muted"
544
- }, j(n(e)("core.access.effective.why_row", {
545
- role: n(t).roleName({ key: w.role_key, name: w.role_name }),
546
- whose: n(t).qualifierNoun(_.ownable ? w.qualifier : "all"),
547
- scope: n(t).scopeLabel(w.scope)
548
- })), 1))), 128))
549
- ], 8, xs))), 128))
550
- ])) : A("", !0)
551
- ]),
552
- default: h(() => [
553
- _.allUnavailable ? (m(), g("span", Ls, [
554
- E(n(Ye), { tone: "warning" }, {
555
- default: h(() => [
556
- V(j(n(e)("core.access.effective.unavailable")), 1)
557
- ]),
558
- _: 1
559
- })
560
- ])) : A("", !0),
561
- S("span", Es, j(r(_)), 1),
562
- S("span", {
563
- class: "contents",
564
- "data-test": `why-${_.key}`
565
- }, [
566
- E(n(J), {
567
- prominence: "secondary",
568
- size: "sm",
569
- onClick: (L) => p.value[_.key] = !p.value[_.key]
570
- }, {
571
- default: h(() => [
572
- V(j(p.value[_.key] ? n(e)("core.access.effective.hide_why") : n(e)("core.access.effective.show_why")), 1)
573
- ]),
574
- _: 2
575
- }, 1032, ["onClick"])
576
- ], 8, Cs)
577
- ]),
578
- _: 2
579
- }, 1032, ["label"]))), 128))
580
- ]),
581
- _: 2
582
- }, 1032, ["header", "footer"]))), 128)),
583
- n(o) && a.value.length > 3 ? (m(), g("span", Rs, [
584
- E(n(J), {
585
- prominence: "secondary",
586
- class: "self-center",
587
- onClick: y[0] || (y[0] = (b) => u.value = !u.value)
588
- }, {
589
- default: h(() => [
590
- V(j(u.value ? n(e)("core.access.effective.fewer_modules") : n(e)("core.access.effective.all_modules", { count: a.value.length })), 1)
591
- ]),
592
- _: 1
593
- })
594
- ])) : A("", !0)
595
- ], 64))
596
- ]));
597
- }
598
- }), Ns = {
599
- class: "flex min-w-0 flex-col gap-group-gap",
600
- "data-test": "access-panel"
601
- }, Ss = ["data-test"], Os = {
602
- class: "contents",
603
- "data-test": "add-role"
604
- }, da = /* @__PURE__ */ X({
605
- __name: "PersonAccess",
606
- props: {
607
- subject: {},
608
- name: {},
609
- subjectLabel: {}
610
- },
611
- emits: ["loaded"],
612
- setup(s, { expose: l, emit: e }) {
613
- const c = s, t = e, { t: o } = H(), a = W(), u = we(), $ = ke(), p = O(!1), q = Fe(async ({ signal: L, abandon: w }) => {
614
- p.value = !1;
615
- try {
616
- const k = await $.access(c.subject, { signal: L });
617
- return t("loaded", k.bindings.length), k;
618
- } catch (k) {
619
- if (!te(k) || k.kind !== "notFound") throw k;
620
- return p.value = !0, w();
621
- }
622
- }, { watch: () => c.subject.id }), R = ie("addDialog"), r = ie("removeDialog");
623
- async function v(L) {
624
- await $.unbind(c.subject, L.id), ae.success(o("core.access.removed")), await q.reload();
625
- }
626
- const y = (L) => ae.error(u(L, { fallback: o("core.access.remove_failed") })), b = O(null), _ = T(() => b.value ? o("core.access.remove_body", { name: c.name, role: a.roleName(b.value.role), scope: a.scopeLabel(b.value.scope) }) : "");
627
- return l({ reload: q.reload }), (L, w) => (m(), g("div", Ns, [
628
- p.value ? (m(), N(n(Ue), {
629
- key: 0,
630
- title: n(o)("core.resource.not_found.title"),
631
- description: n(o)("core.resource.not_found.body"),
632
- icon: "errorWarningLine",
633
- "data-test": "access-not-found"
634
- }, null, 8, ["title", "description"])) : (m(), N(n(Be), {
635
- key: 1,
636
- state: n(q).state.value,
637
- "skeleton-rows": 6,
638
- "is-empty": () => !1,
639
- onRetry: w[1] || (w[1] = (k) => n(q).reload())
640
- }, {
641
- default: h(({ value: k }) => [
642
- E(n(z), {
643
- header: n(o)("core.access.person_roles"),
644
- footer: n(o)("core.access.roles_footer")
645
- }, {
646
- default: h(() => [
647
- k.bindings.length === 0 ? (m(), N(n(U), {
648
- key: 0,
649
- layout: "setting",
650
- label: n(o)("core.access.no_roles_title"),
651
- sub: n(o)("core.access.no_roles_description")
652
- }, null, 8, ["label", "sub"])) : A("", !0),
653
- (m(!0), g(K, null, B(k.bindings, (C) => (m(), N(_s, {
654
- key: C.id,
655
- binding: C
656
- }, ge({ _: 2 }, [
657
- k.can_manage ? {
658
- name: "trailing",
659
- fn: h(() => [
660
- E(n(ue), {
661
- permission: n(F).manageBindings
662
- }, {
663
- default: h(() => [
664
- S("span", {
665
- class: "contents",
666
- "data-test": `remove-binding-${C.id}`
667
- }, [
668
- E(n(J), {
669
- tone: "critical",
670
- prominence: "secondary",
671
- size: "sm",
672
- onClick: (ne) => (b.value = C, r.value?.present(C))
673
- }, {
674
- default: h(() => [
675
- V(j(n(o)("core.access.remove")), 1)
676
- ]),
677
- _: 1
678
- }, 8, ["onClick"])
679
- ], 8, Ss)
680
- ]),
681
- _: 2
682
- }, 1032, ["permission"])
683
- ]),
684
- key: "0"
685
- } : void 0
686
- ]), 1032, ["binding"]))), 128)),
687
- k.can_manage ? (m(), N(n(ue), {
688
- key: 1,
689
- permission: n(F).manageBindings
690
- }, {
691
- default: h(() => [
692
- E(n(U), { layout: "stacked" }, {
693
- default: h(() => [
694
- S("span", Os, [
695
- E(n(J), {
696
- prominence: "secondary",
697
- icon: "addLine",
698
- onClick: w[0] || (w[0] = (C) => R.value?.present())
699
- }, {
700
- default: h(() => [
701
- V(j(n(o)("core.access.add_role")), 1)
702
- ]),
703
- _: 1
704
- })
705
- ])
706
- ]),
707
- _: 1
708
- })
709
- ]),
710
- _: 1
711
- }, 8, ["permission"])) : A("", !0)
712
- ]),
713
- _: 2
714
- }, 1032, ["header", "footer"]),
715
- E(Ts, {
716
- effective: k.effective,
717
- name: c.name
718
- }, null, 8, ["effective", "name"])
719
- ]),
720
- _: 1
721
- }, 8, ["state"])),
722
- E(vs, {
723
- ref_key: "addDialog",
724
- ref: R,
725
- subject: c.subject,
726
- "subject-label": c.subjectLabel ?? c.name,
727
- onAdded: w[2] || (w[2] = (k) => n(q).reload())
728
- }, null, 8, ["subject", "subject-label"]),
729
- E(n(Pe), {
730
- ref_key: "removeDialog",
731
- ref: r,
732
- tone: "critical",
733
- title: n(o)("core.access.remove_title"),
734
- message: _.value,
735
- "confirm-label": n(o)("core.access.remove"),
736
- action: v,
737
- onFailed: y
738
- }, null, 8, ["title", "message", "confirm-label"])
739
- ]));
740
- }
741
- });
742
- export {
743
- _s as _,
744
- ke as a,
745
- F as b,
746
- de as c,
747
- Z as d,
748
- oe as e,
749
- as as f,
750
- es as g,
751
- ua as h,
752
- we as i,
753
- da as j,
754
- la as k,
755
- D as l,
756
- Xe as m,
757
- na as n,
758
- Ze as o,
759
- ca as p,
760
- Je as q,
761
- ra as r,
762
- ia as s,
763
- ss as t,
764
- W as u
765
- };