@jini-ai/user-management 0.2.0 → 0.3.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/CHANGELOG.md +43 -0
- package/dist/admin/people.rules.js +2 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/principal-kind-policy.d.ts +30 -0
- package/dist/core/principal-kind-policy.js +28 -0
- package/dist/core/types.d.ts +7 -2
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.js +2 -0
- package/dist/react/members/Members.d.ts +28 -1
- package/dist/react/members/Members.js +14 -10
- package/dist/react/members/hooks/use-members.hooks.d.ts +43 -1
- package/dist/react/members/hooks/use-members.hooks.js +37 -9
- package/dist/react/members/rules.d.ts +31 -4
- package/dist/react/members/rules.js +17 -5
- package/dist/react/models.d.ts +3 -0
- package/dist/react/users/Users.d.ts +105 -6
- package/dist/react/users/Users.js +105 -43
- package/dist/react/users/hooks/use-reset-password-fields.hooks.d.ts +33 -1
- package/dist/react/users/hooks/use-reset-password-fields.hooks.js +16 -1
- package/dist/react/users/hooks/use-users.hooks.d.ts +120 -3
- package/dist/react/users/hooks/use-users.hooks.js +192 -23
- package/dist/react/users/rules.d.ts +115 -8
- package/dist/react/users/rules.js +109 -6
- package/dist/server/admin-crud-service.js +4 -1
- package/dist/server/authorize.d.ts +9 -6
- package/dist/server/authorize.js +11 -3
- package/dist/server/permission-migrations.d.ts +35 -15
- package/dist/server/permission-migrations.js +16 -16
- package/dist/server/seed.js +6 -1
- package/package.json +15 -10
- package/dist/react/roles/Roles.d.ts +0 -100
- package/dist/react/roles/Roles.hooks.d.ts +0 -17
- package/dist/react/roles/Roles.hooks.js +0 -40
- package/dist/react/roles/Roles.js +0 -150
- package/dist/react/roles/hooks/use-roles.hooks.d.ts +0 -80
- package/dist/react/roles/hooks/use-roles.hooks.js +0 -303
- package/dist/react/roles/rules.d.ts +0 -35
- package/dist/react/roles/rules.js +0 -31
- package/dist/react/roles/text.d.ts +0 -27
- package/dist/react/roles/text.js +0 -13
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { useRef, useState } from "react";
|
|
2
|
-
import {} from "../../models.js";
|
|
3
|
-
import { useFetchMutation, useFetchQuery } from "@jini-ai/ui/panel-kit";
|
|
4
|
-
import { describeApiError as describeFeatureError, KEYS } from "../rules.js";
|
|
5
|
-
async function runRowDelete(id, mutate, setRowSavingId, setRowError, clearPending, describeError) {
|
|
6
|
-
setRowSavingId(id);
|
|
7
|
-
setRowError(null);
|
|
8
|
-
try {
|
|
9
|
-
await mutate(id);
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
setRowError(describeError(e));
|
|
13
|
-
}
|
|
14
|
-
finally {
|
|
15
|
-
setRowSavingId((current) => (current === id ? null : current));
|
|
16
|
-
clearPending();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export function useRoles(deps) {
|
|
20
|
-
const { port, translate, queryScope } = deps;
|
|
21
|
-
const describeApiError = (error, fallback) => describeFeatureError({ error, fallback, translate });
|
|
22
|
-
const t = translate;
|
|
23
|
-
const boundT = translate;
|
|
24
|
-
const list = useFetchQuery({
|
|
25
|
-
key: [queryScope, ...KEYS.list],
|
|
26
|
-
fetch: async () => {
|
|
27
|
-
const [r, p] = await Promise.all([port.listRoles({}), port.listPolicies({})]);
|
|
28
|
-
return { roles: r.roles, policies: p.policies };
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
const roles = list.data?.roles ?? null;
|
|
32
|
-
const policies = list.data?.policies ?? null;
|
|
33
|
-
const error = list.error ? describeApiError(list.error, t("failed to load roles/policies")) : null;
|
|
34
|
-
const [rowError, setRowError] = useState(null);
|
|
35
|
-
const [roleName, setRoleName] = useState("");
|
|
36
|
-
const [policyName, setPolicyName] = useState("");
|
|
37
|
-
const [policyDescription, setPolicyDescription] = useState("");
|
|
38
|
-
const [editingRoleId, setEditingRoleId] = useState(null);
|
|
39
|
-
const [editingRoleName, setEditingRoleName] = useState("");
|
|
40
|
-
const [editingPolicyId, setEditingPolicyId] = useState(null);
|
|
41
|
-
const [editingPolicyName, setEditingPolicyName] = useState("");
|
|
42
|
-
const [editingPolicyDescription, setEditingPolicyDescription] = useState("");
|
|
43
|
-
const [rowSavingId, setRowSavingId] = useState(null);
|
|
44
|
-
const [permissionPolicyId, setPermissionPolicyId] = useState(null);
|
|
45
|
-
const [permissionInput, setPermissionInput] = useState("");
|
|
46
|
-
const [resourceTypeInput, setResourceTypeInput] = useState("");
|
|
47
|
-
const [permissionRows, setPermissionRows] = useState([]);
|
|
48
|
-
const [permissionsLoading, setPermissionsLoading] = useState(false);
|
|
49
|
-
const [removingPermissionId, setRemovingPermissionId] = useState(null);
|
|
50
|
-
const permissionsGenerationRef = useRef(0);
|
|
51
|
-
const permissionPolicyIdRef = useRef(null);
|
|
52
|
-
const [pendingRoleDelete, setPendingRoleDelete] = useState(null);
|
|
53
|
-
const [pendingPolicyDelete, setPendingPolicyDelete] = useState(null);
|
|
54
|
-
const [pendingPermissionRemove, setPendingPermissionRemove] = useState(null);
|
|
55
|
-
const createRoleMutation = useFetchMutation({
|
|
56
|
-
run: ({ input: name }) => port.createRole({ name: name })
|
|
57
|
-
}, {
|
|
58
|
-
invalidates: [[queryScope, ...KEYS.list]],
|
|
59
|
-
});
|
|
60
|
-
const createPolicyMutation = useFetchMutation({
|
|
61
|
-
run: ({ input }) => port.createPolicy({ name: input.name }, { description: input.description })
|
|
62
|
-
}, {
|
|
63
|
-
invalidates: [[queryScope, ...KEYS.list]],
|
|
64
|
-
});
|
|
65
|
-
const saveRoleMutation = useFetchMutation({
|
|
66
|
-
run: ({ input }) => port.updateRole(input)
|
|
67
|
-
}, {
|
|
68
|
-
invalidates: [[queryScope, ...KEYS.list]],
|
|
69
|
-
});
|
|
70
|
-
const deleteRoleMutation = useFetchMutation({
|
|
71
|
-
run: ({ input: id }) => port.deleteRole({ roleId: id })
|
|
72
|
-
}, {
|
|
73
|
-
invalidates: [[queryScope, ...KEYS.list]],
|
|
74
|
-
});
|
|
75
|
-
const savePolicyMutation = useFetchMutation({
|
|
76
|
-
run: ({ input }) => port.updatePolicy({ policyId: input.policyId }, { name: input.name, description: input.description })
|
|
77
|
-
}, {
|
|
78
|
-
invalidates: [[queryScope, ...KEYS.list]],
|
|
79
|
-
});
|
|
80
|
-
const deletePolicyMutation = useFetchMutation({
|
|
81
|
-
run: ({ input: id }) => port.deletePolicy({ policyId: id })
|
|
82
|
-
}, {
|
|
83
|
-
invalidates: [[queryScope, ...KEYS.list]],
|
|
84
|
-
});
|
|
85
|
-
const writePermissionMutation = useFetchMutation({
|
|
86
|
-
run: ({ input }) => port.writePolicyPermission({ policyId: input.policyId, permission: input.permission }, { resourceType: input.resourceType }),
|
|
87
|
-
});
|
|
88
|
-
const removePermissionMutation = useFetchMutation({
|
|
89
|
-
run: ({ input }) => port.removePolicyPermission(input),
|
|
90
|
-
});
|
|
91
|
-
async function onCreateRole(e) {
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
try {
|
|
94
|
-
await createRoleMutation.mutate({ input: roleName });
|
|
95
|
-
setRoleName("");
|
|
96
|
-
}
|
|
97
|
-
catch {
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async function onCreatePolicy(e) {
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
try {
|
|
103
|
-
await createPolicyMutation.mutate({ input: { name: policyName, description: policyDescription || undefined } });
|
|
104
|
-
setPolicyName("");
|
|
105
|
-
setPolicyDescription("");
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function startEditRole(role) {
|
|
111
|
-
setRowError(null);
|
|
112
|
-
setEditingRoleId(role.id);
|
|
113
|
-
setEditingRoleName(role.name);
|
|
114
|
-
}
|
|
115
|
-
async function onSaveRole({ roleId }) {
|
|
116
|
-
setRowSavingId(roleId);
|
|
117
|
-
setRowError(null);
|
|
118
|
-
try {
|
|
119
|
-
await saveRoleMutation.mutate({ input: { roleId, name: editingRoleName } });
|
|
120
|
-
setEditingRoleId((current) => (current === roleId ? null : current));
|
|
121
|
-
}
|
|
122
|
-
catch (e) {
|
|
123
|
-
setRowError(describeApiError(e, t("failed to rename role")));
|
|
124
|
-
}
|
|
125
|
-
finally {
|
|
126
|
-
setRowSavingId((current) => (current === roleId ? null : current));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
async function onDeleteRole() {
|
|
130
|
-
if (!pendingRoleDelete)
|
|
131
|
-
return;
|
|
132
|
-
const role = pendingRoleDelete;
|
|
133
|
-
await runRowDelete(role.id, (id) => deleteRoleMutation.mutate({ input: id }), setRowSavingId, setRowError, () => setPendingRoleDelete((current) => (current?.id === role.id ? null : current)), (e) => describeApiError(e, t("failed to delete role")));
|
|
134
|
-
}
|
|
135
|
-
function startEditPolicy(policy) {
|
|
136
|
-
setRowError(null);
|
|
137
|
-
setEditingPolicyId(policy.id);
|
|
138
|
-
setEditingPolicyName(policy.name);
|
|
139
|
-
setEditingPolicyDescription(policy.description ?? "");
|
|
140
|
-
}
|
|
141
|
-
async function onSavePolicy({ policyId }) {
|
|
142
|
-
setRowSavingId(policyId);
|
|
143
|
-
setRowError(null);
|
|
144
|
-
try {
|
|
145
|
-
await savePolicyMutation.mutate({ input: { policyId, name: editingPolicyName, description: editingPolicyDescription } });
|
|
146
|
-
setEditingPolicyId((current) => (current === policyId ? null : current));
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
setRowError(describeApiError(e, t("failed to update policy")));
|
|
150
|
-
}
|
|
151
|
-
finally {
|
|
152
|
-
setRowSavingId((current) => (current === policyId ? null : current));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
async function onDeletePolicy() {
|
|
156
|
-
if (!pendingPolicyDelete)
|
|
157
|
-
return;
|
|
158
|
-
const policy = pendingPolicyDelete;
|
|
159
|
-
await runRowDelete(policy.id, (id) => deletePolicyMutation.mutate({ input: id }), setRowSavingId, setRowError, () => setPendingPolicyDelete((current) => (current?.id === policy.id ? null : current)), (e) => describeApiError(e, t("failed to delete policy")));
|
|
160
|
-
}
|
|
161
|
-
async function loadPermissions(policyId) {
|
|
162
|
-
const generation = ++permissionsGenerationRef.current;
|
|
163
|
-
setPermissionsLoading(true);
|
|
164
|
-
try {
|
|
165
|
-
const { policyPermissions } = await port.listPolicyPermissions({ policyId: policyId });
|
|
166
|
-
if (permissionsGenerationRef.current !== generation)
|
|
167
|
-
return;
|
|
168
|
-
setPermissionRows(policyPermissions);
|
|
169
|
-
}
|
|
170
|
-
catch (e) {
|
|
171
|
-
if (permissionsGenerationRef.current !== generation)
|
|
172
|
-
return;
|
|
173
|
-
setPermissionRows([]);
|
|
174
|
-
setRowError(describeApiError(e, t("failed to load permissions")));
|
|
175
|
-
}
|
|
176
|
-
finally {
|
|
177
|
-
if (permissionsGenerationRef.current !== generation)
|
|
178
|
-
return;
|
|
179
|
-
setPermissionsLoading(false);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function togglePermissionForm({ policyId }) {
|
|
183
|
-
setRowError(null);
|
|
184
|
-
setPermissionInput("");
|
|
185
|
-
setResourceTypeInput("");
|
|
186
|
-
const closing = permissionPolicyIdRef.current === policyId;
|
|
187
|
-
permissionPolicyIdRef.current = closing ? null : policyId;
|
|
188
|
-
setPermissionPolicyId(permissionPolicyIdRef.current);
|
|
189
|
-
setPermissionRows([]);
|
|
190
|
-
if (!closing)
|
|
191
|
-
void loadPermissions(policyId);
|
|
192
|
-
}
|
|
193
|
-
async function onRemovePermission({ policyId, policyPermissionId }) {
|
|
194
|
-
setRemovingPermissionId(policyPermissionId);
|
|
195
|
-
setRowError(null);
|
|
196
|
-
try {
|
|
197
|
-
await removePermissionMutation.mutate({ input: { policyId, policyPermissionId } });
|
|
198
|
-
if (permissionPolicyIdRef.current === policyId)
|
|
199
|
-
await loadPermissions(policyId);
|
|
200
|
-
}
|
|
201
|
-
catch (e) {
|
|
202
|
-
setRowError(describeApiError(e, t("failed to remove permission")));
|
|
203
|
-
}
|
|
204
|
-
finally {
|
|
205
|
-
setRemovingPermissionId((current) => (current === policyPermissionId ? null : current));
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
async function onConfirmRemovePermission() {
|
|
209
|
-
if (!pendingPermissionRemove)
|
|
210
|
-
return;
|
|
211
|
-
const target = pendingPermissionRemove;
|
|
212
|
-
try {
|
|
213
|
-
await onRemovePermission({ policyId: target.policyId, policyPermissionId: target.row.id });
|
|
214
|
-
}
|
|
215
|
-
finally {
|
|
216
|
-
setPendingPermissionRemove((current) => (current?.row.id === target.row.id ? null : current));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
async function onWritePermission({ policyId }) {
|
|
220
|
-
if (!permissionInput)
|
|
221
|
-
return;
|
|
222
|
-
const generationAtStart = permissionsGenerationRef.current;
|
|
223
|
-
setRowSavingId(policyId);
|
|
224
|
-
setRowError(null);
|
|
225
|
-
try {
|
|
226
|
-
await writePermissionMutation.mutate({ input: { policyId, permission: permissionInput, resourceType: resourceTypeInput || undefined } });
|
|
227
|
-
if (permissionsGenerationRef.current === generationAtStart) {
|
|
228
|
-
setPermissionInput("");
|
|
229
|
-
setResourceTypeInput("");
|
|
230
|
-
}
|
|
231
|
-
if (permissionPolicyIdRef.current === policyId)
|
|
232
|
-
await loadPermissions(policyId);
|
|
233
|
-
}
|
|
234
|
-
catch (e) {
|
|
235
|
-
setRowError(describeApiError(e, t("failed to add permission")));
|
|
236
|
-
}
|
|
237
|
-
finally {
|
|
238
|
-
setRowSavingId((current) => (current === policyId ? null : current));
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const roleSaving = createRoleMutation.status === "pending";
|
|
242
|
-
const roleError = createRoleMutation.error ? describeApiError(createRoleMutation.error, t("failed to create role")) : null;
|
|
243
|
-
const policySaving = createPolicyMutation.status === "pending";
|
|
244
|
-
const policyError = createPolicyMutation.error
|
|
245
|
-
? describeApiError(createPolicyMutation.error, t("failed to create policy"))
|
|
246
|
-
: null;
|
|
247
|
-
return {
|
|
248
|
-
roles,
|
|
249
|
-
policies,
|
|
250
|
-
error,
|
|
251
|
-
rowError,
|
|
252
|
-
roleName,
|
|
253
|
-
setRoleName,
|
|
254
|
-
roleSaving,
|
|
255
|
-
roleError,
|
|
256
|
-
onCreateRole,
|
|
257
|
-
policyName,
|
|
258
|
-
setPolicyName,
|
|
259
|
-
policyDescription,
|
|
260
|
-
setPolicyDescription,
|
|
261
|
-
policySaving,
|
|
262
|
-
policyError,
|
|
263
|
-
onCreatePolicy,
|
|
264
|
-
editingRoleId,
|
|
265
|
-
setEditingRoleId,
|
|
266
|
-
editingRoleName,
|
|
267
|
-
setEditingRoleName,
|
|
268
|
-
startEditRole,
|
|
269
|
-
onSaveRole,
|
|
270
|
-
editingPolicyId,
|
|
271
|
-
setEditingPolicyId,
|
|
272
|
-
editingPolicyName,
|
|
273
|
-
setEditingPolicyName,
|
|
274
|
-
editingPolicyDescription,
|
|
275
|
-
setEditingPolicyDescription,
|
|
276
|
-
startEditPolicy,
|
|
277
|
-
onSavePolicy,
|
|
278
|
-
rowSavingId,
|
|
279
|
-
permissionPolicyId,
|
|
280
|
-
permissionInput,
|
|
281
|
-
setPermissionInput,
|
|
282
|
-
resourceTypeInput,
|
|
283
|
-
setResourceTypeInput,
|
|
284
|
-
togglePermissionForm,
|
|
285
|
-
onWritePermission,
|
|
286
|
-
permissionRows,
|
|
287
|
-
permissionsLoading,
|
|
288
|
-
removingPermissionId,
|
|
289
|
-
onRemovePermission,
|
|
290
|
-
pendingPermissionRemove,
|
|
291
|
-
setPendingPermissionRemove,
|
|
292
|
-
onConfirmRemovePermission,
|
|
293
|
-
pendingRoleDelete,
|
|
294
|
-
setPendingRoleDelete,
|
|
295
|
-
onDeleteRole,
|
|
296
|
-
pendingPolicyDelete,
|
|
297
|
-
setPendingPolicyDelete,
|
|
298
|
-
onDeletePolicy,
|
|
299
|
-
t: boundT,
|
|
300
|
-
translate,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
//# sourceMappingURL=use-roles.hooks.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AdminRole, AdminPolicy } from "../models.js";
|
|
2
|
-
import type { Translate } from "@jini-ai/ui/panel-kit";
|
|
3
|
-
import type { RowMenuItem } from "@jini-ai/admin/react";
|
|
4
|
-
import type { QueryKey } from "@jini-ai/ui/panel-kit";
|
|
5
|
-
export declare const KEYS: {
|
|
6
|
-
list: QueryKey;
|
|
7
|
-
};
|
|
8
|
-
export declare function describeApiError({ error, fallback, translate }: {
|
|
9
|
-
error: unknown;
|
|
10
|
-
fallback: string;
|
|
11
|
-
translate: Translate;
|
|
12
|
-
}): string;
|
|
13
|
-
export interface RoleRowMenuHandlers {
|
|
14
|
-
onRename: (role: AdminRole) => void;
|
|
15
|
-
onDelete: (role: AdminRole) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function roleMenuItems({ role, handlers, translate }: {
|
|
18
|
-
role: AdminRole;
|
|
19
|
-
handlers: RoleRowMenuHandlers;
|
|
20
|
-
translate: Translate;
|
|
21
|
-
}): RowMenuItem[];
|
|
22
|
-
export interface PolicyRowMenuHandlers {
|
|
23
|
-
onRename: (policy: AdminPolicy) => void;
|
|
24
|
-
onTogglePermissionForm: (required: {
|
|
25
|
-
policyId: string;
|
|
26
|
-
}) => void;
|
|
27
|
-
onDelete: (policy: AdminPolicy) => void;
|
|
28
|
-
}
|
|
29
|
-
export declare function policyMenuItems({ policy, permissionPolicyId, handlers, translate }: {
|
|
30
|
-
policy: AdminPolicy;
|
|
31
|
-
permissionPolicyId: string | null;
|
|
32
|
-
handlers: PolicyRowMenuHandlers;
|
|
33
|
-
translate: Translate;
|
|
34
|
-
}): RowMenuItem[];
|
|
35
|
-
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { describeIdentityError } from "../errors.js";
|
|
2
|
-
export const KEYS = {
|
|
3
|
-
list: ["roles-and-policies"],
|
|
4
|
-
};
|
|
5
|
-
const STATIC_ERROR_MESSAGES = {
|
|
6
|
-
FORBIDDEN: "You do not have permission to do that.",
|
|
7
|
-
RESOURCE_CONFLICT: "It is still in use — remove that assignment/attachment first.",
|
|
8
|
-
PERMISSION_UNKNOWN: "That permission is not recognized.",
|
|
9
|
-
GRANT_EXCEEDS_ISSUER: "You cannot grant a permission you do not hold.",
|
|
10
|
-
};
|
|
11
|
-
export function describeApiError({ error, fallback, translate }) {
|
|
12
|
-
return describeIdentityError({ error, fallback, translate }, { messages: STATIC_ERROR_MESSAGES });
|
|
13
|
-
}
|
|
14
|
-
export function roleMenuItems({ role, handlers, translate }) {
|
|
15
|
-
return [
|
|
16
|
-
{ key: "rename", label: translate("Rename"), onSelect: () => handlers.onRename(role) },
|
|
17
|
-
{ key: "delete", label: translate("Delete"), destructive: true, onSelect: () => handlers.onDelete(role) },
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
export function policyMenuItems({ policy, permissionPolicyId, handlers, translate }) {
|
|
21
|
-
return [
|
|
22
|
-
{ key: "rename", label: translate("Rename"), onSelect: () => handlers.onRename(policy) },
|
|
23
|
-
{
|
|
24
|
-
key: "permission",
|
|
25
|
-
label: permissionPolicyId === policy.id ? translate("Close") : translate("Add permission"),
|
|
26
|
-
onSelect: () => handlers.onTogglePermissionForm({ policyId: policy.id }),
|
|
27
|
-
},
|
|
28
|
-
{ key: "delete", label: translate("Delete"), destructive: true, onSelect: () => handlers.onDelete(policy) },
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=rules.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type Translate } from "@jini-ai/ui/panel-kit";
|
|
2
|
-
export declare function rolesDescriptionParts({ translate }: {
|
|
3
|
-
translate: Translate;
|
|
4
|
-
}): {
|
|
5
|
-
prefix: string;
|
|
6
|
-
suffix: string;
|
|
7
|
-
linkLabel: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function roleDeleteBodyParts({ translate }: {
|
|
10
|
-
translate: Translate;
|
|
11
|
-
}): {
|
|
12
|
-
prefix: string;
|
|
13
|
-
suffix: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function policyDeleteBodyParts({ translate }: {
|
|
16
|
-
translate: Translate;
|
|
17
|
-
}): {
|
|
18
|
-
prefix: string;
|
|
19
|
-
suffix: string;
|
|
20
|
-
};
|
|
21
|
-
export declare function permissionRemoveBodyParts({ translate }: {
|
|
22
|
-
translate: Translate;
|
|
23
|
-
}): {
|
|
24
|
-
prefix: string;
|
|
25
|
-
suffix: string;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=text.d.ts.map
|
package/dist/react/roles/text.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { splitOnPlaceholders } from "@jini-ai/ui/panel-kit";
|
|
2
|
-
export function rolesDescriptionParts({ translate }) {
|
|
3
|
-
const [prefix = "", suffix = ""] = splitOnPlaceholders({ template: translate("Roles and policies grant access to operator users. Assign a role or policy to a specific user from the {users} screen."), tokens: ["{users}"] });
|
|
4
|
-
return { prefix, suffix, linkLabel: translate("Users") };
|
|
5
|
-
}
|
|
6
|
-
function nameParts(translate, template) {
|
|
7
|
-
const [prefix = "", suffix = ""] = splitOnPlaceholders({ template: translate(template), tokens: ["{name}"] });
|
|
8
|
-
return { prefix, suffix };
|
|
9
|
-
}
|
|
10
|
-
export function roleDeleteBodyParts({ translate }) { return nameParts(translate, 'Delete role "{name}"?'); }
|
|
11
|
-
export function policyDeleteBodyParts({ translate }) { return nameParts(translate, 'Delete policy "{name}"?'); }
|
|
12
|
-
export function permissionRemoveBodyParts({ translate }) { return nameParts(translate, 'Remove "{name}" from this policy? Anyone with this policy loses it.'); }
|
|
13
|
-
//# sourceMappingURL=text.js.map
|