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