@keycloak/keycloak-admin-ui 26.2.1 → 26.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/.vite/manifest.json +28 -28
- package/lib/{CreateFlow-C8ou3z3D.js → CreateFlow-D4uM_8WC.js} +2 -2
- package/lib/{CreateFlow-C8ou3z3D.js.map → CreateFlow-D4uM_8WC.js.map} +1 -1
- package/lib/{DetailOrganization-ChDFPj6w.js → DetailOrganization-COJeYoGE.js} +2 -2
- package/lib/{DetailOrganization-ChDFPj6w.js.map → DetailOrganization-COJeYoGE.js.map} +1 -1
- package/lib/{ExecutorForm-CqhYZ9zD.js → ExecutorForm-BxTSytPh.js} +2 -2
- package/lib/{ExecutorForm-CqhYZ9zD.js.map → ExecutorForm-BxTSytPh.js.map} +1 -1
- package/lib/{FlowDetails-BYnrUM6B.js → FlowDetails-nR6R7QwB.js} +6 -4
- package/lib/{FlowDetails-BYnrUM6B.js.map → FlowDetails-nR6R7QwB.js.map} +1 -1
- package/lib/{NewOrganization-IjGiIFRg.js → NewOrganization-C8OgoMUL.js} +2 -2
- package/lib/{NewOrganization-IjGiIFRg.js.map → NewOrganization-C8OgoMUL.js.map} +1 -1
- package/lib/PermissionConfigurationDetails-0hvEwSNW.js +704 -0
- package/lib/PermissionConfigurationDetails-0hvEwSNW.js.map +1 -0
- package/lib/{PermissionDetails-FszJtVpG.js → PermissionDetails-ATEUBMrD.js} +2 -2
- package/lib/{PermissionDetails-FszJtVpG.js.map → PermissionDetails-ATEUBMrD.js.map} +1 -1
- package/lib/{RealmSection-BkVmYRIb.js → RealmSection-DEj7Pofo.js} +2 -2
- package/lib/{RealmSection-BkVmYRIb.js.map → RealmSection-DEj7Pofo.js.map} +1 -1
- package/lib/{ResourceDetails-Br81AEgO.js → ResourceDetails-C88S7tXu.js} +3 -3
- package/lib/{ResourceDetails-Br81AEgO.js.map → ResourceDetails-C88S7tXu.js.map} +1 -1
- package/lib/{ScopeDetails-nDvWwhgg.js → ScopeDetails-BLW92hEw.js} +2 -2
- package/lib/{ScopeDetails-nDvWwhgg.js.map → ScopeDetails-BLW92hEw.js.map} +1 -1
- package/lib/{ScopePicker-kvjSuh0C.js → ScopePicker-Cbywl8IC.js} +2 -2
- package/lib/{ScopePicker-kvjSuh0C.js.map → ScopePicker-Cbywl8IC.js.map} +1 -1
- package/lib/clients/keys/Keys.d.ts +2 -1
- package/lib/{index-CRHbhwXr.js → index-Bd4uRM2j.js} +5692 -5682
- package/lib/{index-CRHbhwXr.js.map → index-Bd4uRM2j.js.map} +1 -1
- package/lib/keycloak-admin-ui.js +1 -1
- package/package.json +3 -3
- package/lib/PermissionConfigurationDetails-B_xt8b5a.js +0 -702
- package/lib/PermissionConfigurationDetails-B_xt8b5a.js.map +0 -1
@@ -0,0 +1,704 @@
|
|
1
|
+
import { jsx as e, jsxs as T, Fragment as j } from "react/jsx-runtime";
|
2
|
+
import { u as q, a as ce, b as Y, b9 as le, ax as de, V as J, aq as pe, M as _, j as Q, k as me, F as W, Y as $, $ as ue, ba as R, bb as ye, A as X, B as F, l as V, bc as ge, bd as Pe, be as fe, bf as G, bg as he, bh as be, bi as ve, bj as Ce, bk as Te, bl as Se, bm as we, bn as xe, e as z, Q as Z, n as L, bo as H, aY as ee, bp as Ae, q as ie, I as se, J as te, K, O as oe, bq as ne, br as ae, ak as ke, at as Ie, al as Oe, aw as De, a7 as Ee, ao as Fe, bs as Ne, aa as Ve, ar as Ke, c as Re, P as Le, d as qe, bt as Me, bu as ze, bv as U, bw as Be } from "./index-Bd4uRM2j.js";
|
3
|
+
import { useEffect as je, useState as x, useMemo as He } from "react";
|
4
|
+
import { useTranslation as M } from "react-i18next";
|
5
|
+
import { useNavigate as $e, Link as Ge } from "react-router-dom";
|
6
|
+
import { S as Ue } from "./ScopePicker-Cbywl8IC.js";
|
7
|
+
const Ye = {
|
8
|
+
name: "",
|
9
|
+
description: "",
|
10
|
+
type: "group",
|
11
|
+
policies: [],
|
12
|
+
decisionStrategy: de.UNANIMOUS,
|
13
|
+
logic: le.POSITIVE
|
14
|
+
}, B = {
|
15
|
+
aggregate: xe,
|
16
|
+
client: we,
|
17
|
+
user: Se,
|
18
|
+
"client-scope": Te,
|
19
|
+
group: G,
|
20
|
+
regex: Ce,
|
21
|
+
role: ve,
|
22
|
+
time: be,
|
23
|
+
js: he,
|
24
|
+
default: G
|
25
|
+
}, Je = (a) => a in B, _e = ({
|
26
|
+
permissionClientId: a,
|
27
|
+
providers: l,
|
28
|
+
policies: w,
|
29
|
+
toggleDialog: t,
|
30
|
+
onAssign: n
|
31
|
+
}) => {
|
32
|
+
const { adminClient: o } = q(), { realmRepresentation: A } = ce(), { t: d } = M(), y = Y({
|
33
|
+
mode: "onChange",
|
34
|
+
defaultValues: Ye
|
35
|
+
}), { addAlert: k, addError: E } = J(), { handleSubmit: C, reset: b } = y, I = A?.adminPermissionsEnabled, P = pe({
|
36
|
+
control: y.control,
|
37
|
+
name: "type"
|
38
|
+
});
|
39
|
+
function r() {
|
40
|
+
return P && Je(P) ? B[P] : B.default;
|
41
|
+
}
|
42
|
+
const m = r();
|
43
|
+
je(() => {
|
44
|
+
if (P) {
|
45
|
+
const { name: c, description: v, decisionStrategy: O, logic: S } = y.getValues();
|
46
|
+
b({
|
47
|
+
type: P,
|
48
|
+
name: c,
|
49
|
+
description: v,
|
50
|
+
decisionStrategy: O,
|
51
|
+
logic: S
|
52
|
+
});
|
53
|
+
}
|
54
|
+
}, [P, b, y]);
|
55
|
+
const u = async (c) => {
|
56
|
+
const { groups: v, roles: O, policies: S, clients: D, ...s } = c, g = {
|
57
|
+
...s,
|
58
|
+
...v && v.length > 0 && { groups: v },
|
59
|
+
...O && O.length > 0 && { roles: O },
|
60
|
+
...S && S.length > 0 && { policies: S },
|
61
|
+
...D && D.length > 0 && { clients: D },
|
62
|
+
...s.type === "group" && (!v || v.length === 0) && { groups: [] },
|
63
|
+
...s.type === "client" && (!D || D.length === 0) && { clients: [] }
|
64
|
+
};
|
65
|
+
try {
|
66
|
+
const p = await o.clients.createPolicy(
|
67
|
+
{ id: a, type: P },
|
68
|
+
g
|
69
|
+
);
|
70
|
+
n(p), t(), k(d("createPolicySuccess"), z.success);
|
71
|
+
} catch (p) {
|
72
|
+
E("policySaveError", p);
|
73
|
+
}
|
74
|
+
};
|
75
|
+
return /* @__PURE__ */ e(
|
76
|
+
_,
|
77
|
+
{
|
78
|
+
"aria-label": d("createPermissionPolicy"),
|
79
|
+
variant: Q.medium,
|
80
|
+
header: /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(Pe, { component: fe.h1, children: d("createPermissionPolicy") }) }),
|
81
|
+
isOpen: !0,
|
82
|
+
onClose: t,
|
83
|
+
children: /* @__PURE__ */ T(
|
84
|
+
me,
|
85
|
+
{
|
86
|
+
id: "createPermissionPolicy-form",
|
87
|
+
onSubmit: (c) => {
|
88
|
+
c.stopPropagation(), C(u)(c);
|
89
|
+
},
|
90
|
+
isHorizontal: !0,
|
91
|
+
children: [
|
92
|
+
/* @__PURE__ */ T(W, { ...y, children: [
|
93
|
+
/* @__PURE__ */ e(
|
94
|
+
$,
|
95
|
+
{
|
96
|
+
name: "name",
|
97
|
+
label: d("name"),
|
98
|
+
rules: { required: d("required") }
|
99
|
+
}
|
100
|
+
),
|
101
|
+
/* @__PURE__ */ e($, { name: "description", label: d("description") }),
|
102
|
+
l && l.length > 0 && /* @__PURE__ */ e(
|
103
|
+
ue,
|
104
|
+
{
|
105
|
+
name: "type",
|
106
|
+
label: d("policyType"),
|
107
|
+
labelIcon: d("policyTypeHelpText"),
|
108
|
+
options: l.map((c) => ({
|
109
|
+
key: c.type,
|
110
|
+
value: R(c.type)
|
111
|
+
})),
|
112
|
+
controller: { defaultValue: "" }
|
113
|
+
}
|
114
|
+
),
|
115
|
+
/* @__PURE__ */ e(
|
116
|
+
m,
|
117
|
+
{
|
118
|
+
isPermissionClient: I,
|
119
|
+
permissionClientId: a
|
120
|
+
}
|
121
|
+
),
|
122
|
+
/* @__PURE__ */ e(ye, {})
|
123
|
+
] }),
|
124
|
+
/* @__PURE__ */ e(X, { children: /* @__PURE__ */ T("div", { className: "pf-v5-u-mt-md", children: [
|
125
|
+
/* @__PURE__ */ e(
|
126
|
+
F,
|
127
|
+
{
|
128
|
+
variant: V.primary,
|
129
|
+
className: "pf-v5-u-mr-md",
|
130
|
+
type: "submit",
|
131
|
+
"data-testid": "save",
|
132
|
+
isDisabled: w?.length === 0 && P === "aggregate",
|
133
|
+
children: d("save")
|
134
|
+
}
|
135
|
+
),
|
136
|
+
/* @__PURE__ */ e(F, { variant: "link", "data-testid": "cancel", onClick: t, children: d("cancel") })
|
137
|
+
] }) })
|
138
|
+
]
|
139
|
+
}
|
140
|
+
)
|
141
|
+
}
|
142
|
+
);
|
143
|
+
}, Qe = ({
|
144
|
+
toggleDialog: a,
|
145
|
+
onAssign: l,
|
146
|
+
open: w,
|
147
|
+
permissionClientId: t
|
148
|
+
}) => {
|
149
|
+
const { t: n } = M(), { adminClient: o } = q(), [A, d] = x([]), [y, k] = x(void 0), [E, C] = Z(), [b, I] = x([]);
|
150
|
+
L(
|
151
|
+
() => o.clients.listPolicyProviders({
|
152
|
+
id: t
|
153
|
+
}),
|
154
|
+
(r) => {
|
155
|
+
const m = r.filter((u) => u.type !== "resource" && u.type !== "scope").map((u) => u.name).filter((u) => u !== void 0);
|
156
|
+
I(H(m));
|
157
|
+
},
|
158
|
+
[t]
|
159
|
+
);
|
160
|
+
const P = async (r, m, u) => {
|
161
|
+
const c = {
|
162
|
+
id: t,
|
163
|
+
permission: "false",
|
164
|
+
first: r,
|
165
|
+
max: m
|
166
|
+
};
|
167
|
+
return u && (c.name = u), y && (c.type = y), await o.clients.listPolicies(c) || [];
|
168
|
+
};
|
169
|
+
return /* @__PURE__ */ e(
|
170
|
+
_,
|
171
|
+
{
|
172
|
+
variant: Q.medium,
|
173
|
+
title: n("assignExistingPolicies"),
|
174
|
+
isOpen: w,
|
175
|
+
onClose: a,
|
176
|
+
actions: [
|
177
|
+
/* @__PURE__ */ T(j, { children: [
|
178
|
+
/* @__PURE__ */ e(
|
179
|
+
F,
|
180
|
+
{
|
181
|
+
id: "modal-assignExistingPolicies",
|
182
|
+
"data-testid": "confirm",
|
183
|
+
variant: V.primary,
|
184
|
+
onClick: () => {
|
185
|
+
const r = A.map((m) => ({ policy: m }));
|
186
|
+
l(r), a();
|
187
|
+
},
|
188
|
+
isDisabled: A.length === 0,
|
189
|
+
children: n("assign")
|
190
|
+
},
|
191
|
+
"assign"
|
192
|
+
),
|
193
|
+
/* @__PURE__ */ e(
|
194
|
+
F,
|
195
|
+
{
|
196
|
+
id: "modal-cancelExistingPolicies",
|
197
|
+
"data-testid": "cancel",
|
198
|
+
variant: V.link,
|
199
|
+
onClick: () => {
|
200
|
+
d([]), a();
|
201
|
+
},
|
202
|
+
children: n("cancel")
|
203
|
+
},
|
204
|
+
"cancel"
|
205
|
+
)
|
206
|
+
] })
|
207
|
+
],
|
208
|
+
children: /* @__PURE__ */ e(
|
209
|
+
ee,
|
210
|
+
{
|
211
|
+
loader: P,
|
212
|
+
ariaLabelKey: n("chooseAPolicyType"),
|
213
|
+
searchPlaceholderKey: n("searchClientAuthorizationPolicy"),
|
214
|
+
isSearching: !0,
|
215
|
+
searchTypeComponent: /* @__PURE__ */ e(
|
216
|
+
se,
|
217
|
+
{
|
218
|
+
onSelect: (r, m) => {
|
219
|
+
k(m), C();
|
220
|
+
},
|
221
|
+
onOpenChange: C,
|
222
|
+
toggle: (r) => /* @__PURE__ */ e(
|
223
|
+
oe,
|
224
|
+
{
|
225
|
+
ref: r,
|
226
|
+
"data-testid": "filter-type-dropdown-existingPolicies",
|
227
|
+
id: "toggle-id-10",
|
228
|
+
onClick: C,
|
229
|
+
icon: /* @__PURE__ */ e(ae, {}),
|
230
|
+
statusIcon: /* @__PURE__ */ e(ne, {}),
|
231
|
+
children: y || n("allTypes")
|
232
|
+
}
|
233
|
+
),
|
234
|
+
isOpen: E,
|
235
|
+
children: /* @__PURE__ */ T(te, { children: [
|
236
|
+
/* @__PURE__ */ e(
|
237
|
+
K,
|
238
|
+
{
|
239
|
+
"data-testid": "filter-type-dropdown-existingPolicies-all",
|
240
|
+
onClick: () => k(void 0),
|
241
|
+
children: n("allTypes")
|
242
|
+
},
|
243
|
+
"all"
|
244
|
+
),
|
245
|
+
b.map((r) => /* @__PURE__ */ e(
|
246
|
+
K,
|
247
|
+
{
|
248
|
+
"data-testid": `filter-type-dropdown-existingPolicies-${r}`,
|
249
|
+
onClick: () => k(r),
|
250
|
+
children: r
|
251
|
+
},
|
252
|
+
r
|
253
|
+
))
|
254
|
+
] })
|
255
|
+
}
|
256
|
+
),
|
257
|
+
canSelectAll: !0,
|
258
|
+
onSelect: (r) => d(r),
|
259
|
+
columns: [
|
260
|
+
{ name: "name" },
|
261
|
+
{
|
262
|
+
name: "type",
|
263
|
+
cellFormatters: [Ae()]
|
264
|
+
},
|
265
|
+
{ name: "description" }
|
266
|
+
],
|
267
|
+
emptyState: /* @__PURE__ */ e(
|
268
|
+
ie,
|
269
|
+
{
|
270
|
+
message: n("emptyAssignExistingPolicies"),
|
271
|
+
instructions: n("emptyAssignExistingPoliciesInstructions")
|
272
|
+
}
|
273
|
+
)
|
274
|
+
},
|
275
|
+
y
|
276
|
+
)
|
277
|
+
}
|
278
|
+
);
|
279
|
+
}, We = ({
|
280
|
+
permissionClientId: a,
|
281
|
+
providers: l,
|
282
|
+
policies: w,
|
283
|
+
resourceType: t
|
284
|
+
}) => {
|
285
|
+
const { adminClient: n } = q(), { t: o } = M(), {
|
286
|
+
control: A,
|
287
|
+
getValues: d,
|
288
|
+
setValue: y,
|
289
|
+
trigger: k,
|
290
|
+
formState: { errors: E }
|
291
|
+
} = ke(), C = d("policies"), [b, I] = x(!1), [P, r] = x(!1), [m, u] = x([]), [c, v] = x(void 0), [O, S] = Z();
|
292
|
+
L(
|
293
|
+
() => C && C.length > 0 ? Promise.all(
|
294
|
+
C.map(
|
295
|
+
(i) => n.clients.findOnePolicy({
|
296
|
+
id: a,
|
297
|
+
type: i.type,
|
298
|
+
policyId: i.id
|
299
|
+
})
|
300
|
+
)
|
301
|
+
) : Promise.resolve([]),
|
302
|
+
(i) => {
|
303
|
+
const f = i.filter((h) => h);
|
304
|
+
u(f);
|
305
|
+
},
|
306
|
+
[w]
|
307
|
+
);
|
308
|
+
const D = H(
|
309
|
+
l ? l.filter((i) => i.type !== "resource" && i.type !== "scope").map((i) => i.name) : []
|
310
|
+
), s = (i) => {
|
311
|
+
const f = i.map(({ policy: h }) => ({
|
312
|
+
id: h.id
|
313
|
+
}));
|
314
|
+
y("policies", [
|
315
|
+
...d("policies") || [],
|
316
|
+
...f
|
317
|
+
]), k("policies"), u([
|
318
|
+
...m,
|
319
|
+
...i.map(({ policy: h }) => h)
|
320
|
+
]);
|
321
|
+
}, g = (i) => {
|
322
|
+
const f = m.filter(
|
323
|
+
(h) => h.id !== i.id
|
324
|
+
);
|
325
|
+
u(f), y(
|
326
|
+
"policies",
|
327
|
+
f.map((h) => ({
|
328
|
+
id: h.id,
|
329
|
+
name: h.name,
|
330
|
+
type: h.type,
|
331
|
+
description: h.description
|
332
|
+
}))
|
333
|
+
);
|
334
|
+
}, p = c ? m.filter(
|
335
|
+
(i) => R(i.type) === c
|
336
|
+
) : m;
|
337
|
+
return /* @__PURE__ */ T(
|
338
|
+
Ie,
|
339
|
+
{
|
340
|
+
label: o("policies"),
|
341
|
+
labelIcon: /* @__PURE__ */ e(
|
342
|
+
Ee,
|
343
|
+
{
|
344
|
+
helpText: o("permissionPoliciesHelp"),
|
345
|
+
fieldLabelId: "policies"
|
346
|
+
}
|
347
|
+
),
|
348
|
+
fieldId: "policies",
|
349
|
+
isRequired: !0,
|
350
|
+
children: [
|
351
|
+
/* @__PURE__ */ e(
|
352
|
+
Oe,
|
353
|
+
{
|
354
|
+
name: "policies",
|
355
|
+
control: A,
|
356
|
+
defaultValue: [],
|
357
|
+
rules: {
|
358
|
+
validate: (i) => !i || i.length === 0 ? !1 : i.every(({ id: f }) => f && f.trim().length > 0)
|
359
|
+
},
|
360
|
+
render: () => /* @__PURE__ */ T(j, { children: [
|
361
|
+
b && /* @__PURE__ */ e(
|
362
|
+
Qe,
|
363
|
+
{
|
364
|
+
permissionClientId: a,
|
365
|
+
open: b,
|
366
|
+
toggleDialog: () => I(!b),
|
367
|
+
onAssign: s
|
368
|
+
}
|
369
|
+
),
|
370
|
+
P && /* @__PURE__ */ e(
|
371
|
+
_e,
|
372
|
+
{
|
373
|
+
toggleDialog: () => r(!P),
|
374
|
+
permissionClientId: a,
|
375
|
+
providers: l,
|
376
|
+
policies: w,
|
377
|
+
resourceType: t,
|
378
|
+
onAssign: (i) => {
|
379
|
+
s([{ policy: i }]);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
),
|
383
|
+
/* @__PURE__ */ e(
|
384
|
+
F,
|
385
|
+
{
|
386
|
+
"data-testid": "select-assignedPolicy-button",
|
387
|
+
variant: "secondary",
|
388
|
+
onClick: () => {
|
389
|
+
I(!0);
|
390
|
+
},
|
391
|
+
children: o("assignExistingPolicies")
|
392
|
+
}
|
393
|
+
),
|
394
|
+
/* @__PURE__ */ e(
|
395
|
+
F,
|
396
|
+
{
|
397
|
+
"data-testid": "select-createNewPolicy-button",
|
398
|
+
className: "pf-v5-u-ml-md",
|
399
|
+
variant: "secondary",
|
400
|
+
onClick: () => {
|
401
|
+
r(!0);
|
402
|
+
},
|
403
|
+
children: o("createNewPolicy")
|
404
|
+
}
|
405
|
+
)
|
406
|
+
] })
|
407
|
+
}
|
408
|
+
),
|
409
|
+
m.length > 0 && /* @__PURE__ */ e(
|
410
|
+
ee,
|
411
|
+
{
|
412
|
+
loader: p,
|
413
|
+
ariaLabelKey: o("policies"),
|
414
|
+
searchPlaceholderKey: o("searchClientAuthorizationPolicy"),
|
415
|
+
isSearching: !0,
|
416
|
+
searchTypeComponent: /* @__PURE__ */ e(
|
417
|
+
se,
|
418
|
+
{
|
419
|
+
onSelect: (i, f) => {
|
420
|
+
v(f), S();
|
421
|
+
},
|
422
|
+
onOpenChange: S,
|
423
|
+
toggle: (i) => /* @__PURE__ */ e(
|
424
|
+
oe,
|
425
|
+
{
|
426
|
+
ref: i,
|
427
|
+
"data-testid": "filter-type-dropdown-existingPolicies",
|
428
|
+
id: "toggle-id-10",
|
429
|
+
onClick: S,
|
430
|
+
icon: /* @__PURE__ */ e(ae, {}),
|
431
|
+
statusIcon: /* @__PURE__ */ e(ne, {}),
|
432
|
+
children: c ? R(c) : o("allTypes")
|
433
|
+
}
|
434
|
+
),
|
435
|
+
isOpen: O,
|
436
|
+
children: /* @__PURE__ */ T(te, { children: [
|
437
|
+
/* @__PURE__ */ e(
|
438
|
+
K,
|
439
|
+
{
|
440
|
+
"data-testid": "filter-type-dropdown-existingPolicies-all",
|
441
|
+
onClick: () => v(void 0),
|
442
|
+
children: o("allTypes")
|
443
|
+
},
|
444
|
+
"all"
|
445
|
+
),
|
446
|
+
D.map((i) => /* @__PURE__ */ e(
|
447
|
+
K,
|
448
|
+
{
|
449
|
+
"data-testid": `filter-type-dropdown-existingPolicies-${i}`,
|
450
|
+
onClick: () => v(i),
|
451
|
+
children: i
|
452
|
+
},
|
453
|
+
i
|
454
|
+
))
|
455
|
+
] })
|
456
|
+
}
|
457
|
+
),
|
458
|
+
actionResolver: (i) => [
|
459
|
+
{
|
460
|
+
title: o("unAssignPolicy"),
|
461
|
+
onClick: () => g(i.data)
|
462
|
+
}
|
463
|
+
],
|
464
|
+
columns: [
|
465
|
+
{ name: "name", displayKey: o("name") },
|
466
|
+
{
|
467
|
+
name: "type",
|
468
|
+
displayKey: o("type"),
|
469
|
+
cellFormatters: [(i) => R(String(i || ""))]
|
470
|
+
},
|
471
|
+
{ name: "description", displayKey: o("description") }
|
472
|
+
],
|
473
|
+
emptyState: /* @__PURE__ */ e(
|
474
|
+
ie,
|
475
|
+
{
|
476
|
+
message: o("emptyAssignExistingPolicies"),
|
477
|
+
instructions: o("emptyAssignExistingPoliciesInstructions")
|
478
|
+
}
|
479
|
+
)
|
480
|
+
}
|
481
|
+
),
|
482
|
+
E.policies && /* @__PURE__ */ e(De, { message: o("requiredPolicies") })
|
483
|
+
]
|
484
|
+
}
|
485
|
+
);
|
486
|
+
};
|
487
|
+
function oi() {
|
488
|
+
const { adminClient: a } = q(), { t: l } = M(), { realm: w, permissionClientId: t, permissionId: n, resourceType: o } = Fe(), A = $e(), d = Y(), { handleSubmit: y, reset: k } = d, { addAlert: E, addError: C } = J(), [b, I] = x(), [P, r] = x(), [m, u] = x(), c = Ne({
|
489
|
+
clientId: t
|
490
|
+
}), v = He(
|
491
|
+
() => c.filter(({ type: s }) => s === o).flatMap(({ scopes: s = [] }) => s).map((s) => s || ""),
|
492
|
+
[c, o]
|
493
|
+
);
|
494
|
+
L(
|
495
|
+
async () => {
|
496
|
+
if (!t)
|
497
|
+
return {};
|
498
|
+
const [s, g] = await Promise.all([
|
499
|
+
a.clients.listPolicyProviders({ id: t }),
|
500
|
+
a.clients.listPolicies({
|
501
|
+
id: t,
|
502
|
+
permission: "false"
|
503
|
+
})
|
504
|
+
]);
|
505
|
+
return { providers: s, policies: g };
|
506
|
+
},
|
507
|
+
({ providers: s, policies: g }) => {
|
508
|
+
const p = s?.filter(
|
509
|
+
(i) => i.type !== "resource" && i.type !== "scope"
|
510
|
+
);
|
511
|
+
r(
|
512
|
+
H(
|
513
|
+
p,
|
514
|
+
(i) => i.type
|
515
|
+
)
|
516
|
+
), u(g || []);
|
517
|
+
},
|
518
|
+
[t]
|
519
|
+
), L(
|
520
|
+
async () => {
|
521
|
+
if (!n)
|
522
|
+
return {};
|
523
|
+
const [s, g, p, i] = await Promise.all([
|
524
|
+
a.clients.findOnePermission({
|
525
|
+
id: t,
|
526
|
+
type: "scope",
|
527
|
+
permissionId: n
|
528
|
+
}),
|
529
|
+
a.clients.getAssociatedResources({
|
530
|
+
id: t,
|
531
|
+
permissionId: n
|
532
|
+
}),
|
533
|
+
a.clients.getAssociatedPolicies({
|
534
|
+
id: t,
|
535
|
+
permissionId: n
|
536
|
+
}),
|
537
|
+
a.clients.getAssociatedScopes({
|
538
|
+
id: t,
|
539
|
+
permissionId: n
|
540
|
+
})
|
541
|
+
]);
|
542
|
+
if (!s)
|
543
|
+
throw new Error(l("notFound"));
|
544
|
+
return {
|
545
|
+
permission: s,
|
546
|
+
resources: g,
|
547
|
+
policies: p,
|
548
|
+
scopes: i
|
549
|
+
};
|
550
|
+
},
|
551
|
+
({ permission: s, resources: g, policies: p, scopes: i }) => {
|
552
|
+
const f = g?.map((N) => N.name) || [], h = p?.map((N) => N.id) || [], re = i?.map((N) => N.name) || [];
|
553
|
+
k({
|
554
|
+
...s,
|
555
|
+
resources: f,
|
556
|
+
policies: p,
|
557
|
+
scopes: i
|
558
|
+
}), I({
|
559
|
+
...s,
|
560
|
+
resources: f,
|
561
|
+
policies: h,
|
562
|
+
scopes: re
|
563
|
+
});
|
564
|
+
},
|
565
|
+
[t, n]
|
566
|
+
);
|
567
|
+
const O = async (s) => {
|
568
|
+
try {
|
569
|
+
const g = {
|
570
|
+
...s,
|
571
|
+
policies: s.policies?.map((p) => p.id),
|
572
|
+
scopes: s.scopes?.map((p) => p.name),
|
573
|
+
resourceType: o
|
574
|
+
};
|
575
|
+
if (n)
|
576
|
+
await a.clients.updatePermission(
|
577
|
+
{ id: t, type: "scope", permissionId: n },
|
578
|
+
g
|
579
|
+
);
|
580
|
+
else {
|
581
|
+
const p = await a.clients.createPermission(
|
582
|
+
{ id: t, type: "scope" },
|
583
|
+
g
|
584
|
+
);
|
585
|
+
I(p), A(
|
586
|
+
Be({
|
587
|
+
realm: w,
|
588
|
+
permissionClientId: t,
|
589
|
+
permissionId: p.id,
|
590
|
+
resourceType: o
|
591
|
+
})
|
592
|
+
);
|
593
|
+
}
|
594
|
+
E(
|
595
|
+
l(n ? "updatePermissionSuccess" : "createPermissionSuccess"),
|
596
|
+
z.success
|
597
|
+
);
|
598
|
+
} catch (g) {
|
599
|
+
C("permissionSaveError", g);
|
600
|
+
}
|
601
|
+
}, [S, D] = Ve({
|
602
|
+
titleKey: "deletePermission",
|
603
|
+
messageKey: l("deleteAdminPermissionConfirm", {
|
604
|
+
permission: b?.name
|
605
|
+
}),
|
606
|
+
continueButtonVariant: V.danger,
|
607
|
+
continueButtonLabel: "confirm",
|
608
|
+
onConfirm: async () => {
|
609
|
+
try {
|
610
|
+
await a.clients.delPermission({
|
611
|
+
id: t,
|
612
|
+
type: "scope",
|
613
|
+
permissionId: n
|
614
|
+
}), E(l("permissionDeletedSuccess"), z.success), A(
|
615
|
+
U({
|
616
|
+
realm: w,
|
617
|
+
permissionClientId: t,
|
618
|
+
tab: "permissions"
|
619
|
+
})
|
620
|
+
);
|
621
|
+
} catch (s) {
|
622
|
+
C("permissionDeletedError", s);
|
623
|
+
}
|
624
|
+
}
|
625
|
+
});
|
626
|
+
return b ? /* @__PURE__ */ T(j, { children: [
|
627
|
+
/* @__PURE__ */ e(D, {}),
|
628
|
+
/* @__PURE__ */ e(
|
629
|
+
Re,
|
630
|
+
{
|
631
|
+
titleKey: n ? b?.name : l("createPermission"),
|
632
|
+
subKey: n ? b?.description : l("createPermissionOfType", { resourceType: o }),
|
633
|
+
dropdownItems: n ? [
|
634
|
+
/* @__PURE__ */ e(
|
635
|
+
K,
|
636
|
+
{
|
637
|
+
"data-testid": "delete-permission",
|
638
|
+
onClick: () => S(),
|
639
|
+
children: l("delete")
|
640
|
+
},
|
641
|
+
"delete"
|
642
|
+
)
|
643
|
+
] : void 0
|
644
|
+
}
|
645
|
+
),
|
646
|
+
/* @__PURE__ */ e(Le, { variant: "light", children: /* @__PURE__ */ T(qe, { isHorizontal: !0, onSubmit: y(O), role: "anyone", children: [
|
647
|
+
/* @__PURE__ */ T(W, { ...d, children: [
|
648
|
+
/* @__PURE__ */ e(Me, { clientId: t }),
|
649
|
+
/* @__PURE__ */ e(
|
650
|
+
Ue,
|
651
|
+
{
|
652
|
+
clientId: t,
|
653
|
+
resourceTypeScopes: v ?? []
|
654
|
+
}
|
655
|
+
),
|
656
|
+
/* @__PURE__ */ e(ze, { resourceType: o }),
|
657
|
+
/* @__PURE__ */ e(
|
658
|
+
We,
|
659
|
+
{
|
660
|
+
permissionClientId: t,
|
661
|
+
providers: P,
|
662
|
+
policies: m,
|
663
|
+
resourceType: o
|
664
|
+
}
|
665
|
+
)
|
666
|
+
] }),
|
667
|
+
/* @__PURE__ */ e(X, { children: /* @__PURE__ */ T("div", { className: "pf-v5-u-mt-md", children: [
|
668
|
+
/* @__PURE__ */ e(
|
669
|
+
F,
|
670
|
+
{
|
671
|
+
variant: V.primary,
|
672
|
+
className: "pf-v5-u-mr-md",
|
673
|
+
type: "submit",
|
674
|
+
"data-testid": "save",
|
675
|
+
children: l("save")
|
676
|
+
}
|
677
|
+
),
|
678
|
+
/* @__PURE__ */ e(
|
679
|
+
F,
|
680
|
+
{
|
681
|
+
variant: "link",
|
682
|
+
"data-testid": "cancel",
|
683
|
+
component: (s) => /* @__PURE__ */ e(
|
684
|
+
Ge,
|
685
|
+
{
|
686
|
+
...s,
|
687
|
+
to: U({
|
688
|
+
realm: w,
|
689
|
+
permissionClientId: t,
|
690
|
+
tab: "permissions"
|
691
|
+
})
|
692
|
+
}
|
693
|
+
),
|
694
|
+
children: l("cancel")
|
695
|
+
}
|
696
|
+
)
|
697
|
+
] }) })
|
698
|
+
] }) })
|
699
|
+
] }) : /* @__PURE__ */ e(Ke, {});
|
700
|
+
}
|
701
|
+
export {
|
702
|
+
oi as default
|
703
|
+
};
|
704
|
+
//# sourceMappingURL=PermissionConfigurationDetails-0hvEwSNW.js.map
|