@byline/admin 2.4.0 → 2.4.2
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/dist/abilities.js +5 -24
- package/dist/index.js +8 -30
- package/dist/lib/assert-admin-actor.js +13 -74
- package/dist/lib/create-command.js +6 -16
- package/dist/modules/admin-account/commands.js +35 -24
- package/dist/modules/admin-account/components/change-password.d.ts +8 -0
- package/dist/modules/admin-account/components/change-password.js +192 -0
- package/dist/modules/admin-account/components/change-password.module.js +8 -0
- package/dist/modules/admin-account/components/change-password_module.css +27 -0
- package/dist/modules/admin-account/components/container.d.ts +29 -0
- package/dist/modules/admin-account/components/container.js +298 -0
- package/dist/modules/admin-account/components/container.module.js +28 -0
- package/dist/modules/admin-account/components/container_module.css +106 -0
- package/dist/modules/admin-account/components/update.d.ts +8 -0
- package/dist/modules/admin-account/components/update.js +207 -0
- package/dist/modules/admin-account/components/update.module.js +8 -0
- package/dist/modules/admin-account/components/update_module.css +27 -0
- package/dist/modules/admin-account/errors.js +14 -45
- package/dist/modules/admin-account/index.js +4 -34
- package/dist/modules/admin-account/schemas.js +25 -59
- package/dist/modules/admin-account/service.js +56 -61
- package/dist/modules/admin-permissions/abilities.js +6 -24
- package/dist/modules/admin-permissions/commands.js +42 -28
- package/dist/modules/admin-permissions/components/inspector.d.ts +4 -0
- package/dist/modules/admin-permissions/components/inspector.js +284 -0
- package/dist/modules/admin-permissions/components/inspector.module.js +56 -0
- package/dist/modules/admin-permissions/components/inspector_module.css +238 -0
- package/dist/modules/admin-permissions/dto.js +3 -16
- package/dist/modules/admin-permissions/errors.js +14 -27
- package/dist/modules/admin-permissions/index.js +6 -26
- package/dist/modules/admin-permissions/repository.js +1 -8
- package/dist/modules/admin-permissions/schemas.js +33 -70
- package/dist/modules/admin-permissions/service.js +88 -92
- package/dist/modules/admin-roles/abilities.js +8 -30
- package/dist/modules/admin-roles/commands.js +89 -55
- package/dist/modules/admin-roles/components/create.d.ts +7 -0
- package/dist/modules/admin-roles/components/create.js +177 -0
- package/dist/modules/admin-roles/components/create.module.js +8 -0
- package/dist/modules/admin-roles/components/create_module.css +27 -0
- package/dist/modules/admin-roles/components/permissions.d.ts +10 -0
- package/dist/modules/admin-roles/components/permissions.js +303 -0
- package/dist/modules/admin-roles/components/permissions.module.js +44 -0
- package/dist/modules/admin-roles/components/permissions_module.css +192 -0
- package/dist/modules/admin-roles/components/update.d.ts +8 -0
- package/dist/modules/admin-roles/components/update.js +166 -0
- package/dist/modules/admin-roles/components/update.module.js +8 -0
- package/dist/modules/admin-roles/components/update_module.css +27 -0
- package/dist/modules/admin-roles/dto.js +3 -16
- package/dist/modules/admin-roles/errors.js +16 -40
- package/dist/modules/admin-roles/index.js +6 -26
- package/dist/modules/admin-roles/repository.js +1 -8
- package/dist/modules/admin-roles/schemas.js +41 -71
- package/dist/modules/admin-roles/service.js +79 -82
- package/dist/modules/admin-users/abilities.js +9 -38
- package/dist/modules/admin-users/commands.js +92 -50
- package/dist/modules/admin-users/components/create.d.ts +8 -0
- package/dist/modules/admin-users/components/create.js +268 -0
- package/dist/modules/admin-users/components/create.module.js +10 -0
- package/dist/modules/admin-users/components/create_module.css +45 -0
- package/dist/modules/admin-users/components/roles.d.ts +11 -0
- package/dist/modules/admin-users/components/roles.js +148 -0
- package/dist/modules/admin-users/components/roles.module.js +18 -0
- package/dist/modules/admin-users/components/roles_module.css +75 -0
- package/dist/modules/admin-users/components/set-password.d.ts +8 -0
- package/dist/modules/admin-users/components/set-password.js +170 -0
- package/dist/modules/admin-users/components/set-password.module.js +9 -0
- package/dist/modules/admin-users/components/set-password_module.css +31 -0
- package/dist/modules/admin-users/components/update.d.ts +8 -0
- package/dist/modules/admin-users/components/update.js +254 -0
- package/dist/modules/admin-users/components/update.module.js +9 -0
- package/dist/modules/admin-users/components/update_module.css +34 -0
- package/dist/modules/admin-users/dto.js +3 -18
- package/dist/modules/admin-users/errors.js +17 -43
- package/dist/modules/admin-users/index.js +7 -27
- package/dist/modules/admin-users/repository.js +1 -8
- package/dist/modules/admin-users/schemas.js +44 -75
- package/dist/modules/admin-users/seed-super-admin.js +9 -34
- package/dist/modules/admin-users/service.js +76 -91
- package/dist/modules/auth/components/sign-in-form.d.ts +12 -0
- package/dist/modules/auth/components/sign-in-form.js +115 -0
- package/dist/modules/auth/components/sign-in-form.module.js +12 -0
- package/dist/modules/auth/components/sign-in-form_module.css +41 -0
- package/dist/modules/auth/index.js +3 -24
- package/dist/modules/auth/jwt-session-provider.js +179 -149
- package/dist/modules/auth/password.js +11 -53
- package/dist/modules/auth/phc.js +21 -54
- package/dist/modules/auth/refresh-tokens-repository.js +1 -8
- package/dist/modules/auth/resolve-actor.js +6 -28
- package/dist/services/admin-services-context.d.ts +16 -0
- package/dist/services/admin-services-context.js +13 -0
- package/dist/services/admin-services-types.d.ts +129 -0
- package/dist/services/admin-services-types.js +1 -0
- package/dist/store.js +1 -8
- package/dist/vendor/noble-argon2/_blake.js +277 -45
- package/dist/vendor/noble-argon2/_md.js +81 -136
- package/dist/vendor/noble-argon2/_u64.js +65 -67
- package/dist/vendor/noble-argon2/argon2.js +181 -342
- package/dist/vendor/noble-argon2/blake2.js +252 -327
- package/dist/vendor/noble-argon2/utils.js +110 -490
- package/dist/vendor/noble-argon2/utils.js.LICENSE.txt +1 -0
- package/package.json +89 -10
- package/src/abilities.ts +32 -0
- package/src/declarations.d.ts +4 -0
- package/src/index.ts +39 -0
- package/src/lib/assert-admin-actor.ts +90 -0
- package/src/lib/create-command.ts +109 -0
- package/src/modules/admin-account/commands.ts +76 -0
- package/src/modules/admin-account/components/change-password.module.css +40 -0
- package/src/modules/admin-account/components/change-password.tsx +232 -0
- package/src/modules/admin-account/components/container.module.css +158 -0
- package/src/modules/admin-account/components/container.tsx +229 -0
- package/src/modules/admin-account/components/update.module.css +40 -0
- package/src/modules/admin-account/components/update.tsx +263 -0
- package/src/modules/admin-account/errors.ts +75 -0
- package/src/modules/admin-account/index.ts +60 -0
- package/src/modules/admin-account/schemas.ts +84 -0
- package/src/modules/admin-account/service.ts +92 -0
- package/src/modules/admin-permissions/abilities.ts +46 -0
- package/src/modules/admin-permissions/commands.ts +103 -0
- package/src/modules/admin-permissions/components/inspector.module.css +326 -0
- package/src/modules/admin-permissions/components/inspector.tsx +298 -0
- package/src/modules/admin-permissions/dto.ts +28 -0
- package/src/modules/admin-permissions/errors.ts +57 -0
- package/src/modules/admin-permissions/index.ts +72 -0
- package/src/modules/admin-permissions/repository.ts +49 -0
- package/src/modules/admin-permissions/schemas.ts +128 -0
- package/src/modules/admin-permissions/service.ts +137 -0
- package/src/modules/admin-roles/abilities.ts +62 -0
- package/src/modules/admin-roles/commands.ts +161 -0
- package/src/modules/admin-roles/components/create.module.css +40 -0
- package/src/modules/admin-roles/components/create.tsx +218 -0
- package/src/modules/admin-roles/components/permissions.module.css +279 -0
- package/src/modules/admin-roles/components/permissions.tsx +396 -0
- package/src/modules/admin-roles/components/update.module.css +40 -0
- package/src/modules/admin-roles/components/update.tsx +218 -0
- package/src/modules/admin-roles/dto.ts +30 -0
- package/src/modules/admin-roles/errors.ts +76 -0
- package/src/modules/admin-roles/index.ts +81 -0
- package/src/modules/admin-roles/repository.ts +96 -0
- package/src/modules/admin-roles/schemas.ts +139 -0
- package/src/modules/admin-roles/service.ts +136 -0
- package/src/modules/admin-users/abilities.ts +76 -0
- package/src/modules/admin-users/commands.ts +157 -0
- package/src/modules/admin-users/components/create.module.css +63 -0
- package/src/modules/admin-users/components/create.tsx +323 -0
- package/src/modules/admin-users/components/roles.module.css +119 -0
- package/src/modules/admin-users/components/roles.tsx +172 -0
- package/src/modules/admin-users/components/set-password.module.css +46 -0
- package/src/modules/admin-users/components/set-password.tsx +199 -0
- package/src/modules/admin-users/components/update.module.css +49 -0
- package/src/modules/admin-users/components/update.tsx +328 -0
- package/src/modules/admin-users/dto.ts +39 -0
- package/src/modules/admin-users/errors.ts +84 -0
- package/src/modules/admin-users/index.ts +91 -0
- package/src/modules/admin-users/repository.ts +161 -0
- package/src/modules/admin-users/schemas.ts +168 -0
- package/src/modules/admin-users/seed-super-admin.ts +102 -0
- package/src/modules/admin-users/service.ts +166 -0
- package/src/modules/auth/components/sign-in-form.module.css +62 -0
- package/src/modules/auth/components/sign-in-form.tsx +132 -0
- package/src/modules/auth/index.ts +31 -0
- package/src/modules/auth/jwt-session-provider.ts +301 -0
- package/src/modules/auth/password.ts +94 -0
- package/src/modules/auth/phc.ts +121 -0
- package/src/modules/auth/refresh-tokens-repository.ts +74 -0
- package/src/modules/auth/resolve-actor.ts +42 -0
- package/src/services/admin-services-context.tsx +52 -0
- package/src/services/admin-services-types.ts +177 -0
- package/src/store.ts +32 -0
- package/src/vendor/noble-argon2/LICENSE +21 -0
- package/src/vendor/noble-argon2/README.md +87 -0
- package/src/vendor/noble-argon2/_blake.ts +58 -0
- package/src/vendor/noble-argon2/_md.ts +223 -0
- package/src/vendor/noble-argon2/_u64.ts +118 -0
- package/src/vendor/noble-argon2/argon2.ts +668 -0
- package/src/vendor/noble-argon2/blake2.ts +583 -0
- package/src/vendor/noble-argon2/utils.ts +849 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button, Container, LoaderRing, Section } from "@byline/ui/react";
|
|
5
|
+
import classnames from "classnames";
|
|
6
|
+
import { useBylineAdminServices } from "../../../services/admin-services-context.js";
|
|
7
|
+
import inspector_module from "./inspector.module.js";
|
|
8
|
+
function sourceVariant(source) {
|
|
9
|
+
switch(source){
|
|
10
|
+
case 'collection':
|
|
11
|
+
return {
|
|
12
|
+
global: 'byline-inspector-row-source-collection',
|
|
13
|
+
local: inspector_module["row-source-collection"]
|
|
14
|
+
};
|
|
15
|
+
case 'admin':
|
|
16
|
+
return {
|
|
17
|
+
global: 'byline-inspector-row-source-admin',
|
|
18
|
+
local: inspector_module["row-source-admin"]
|
|
19
|
+
};
|
|
20
|
+
case 'plugin':
|
|
21
|
+
return {
|
|
22
|
+
global: 'byline-inspector-row-source-plugin',
|
|
23
|
+
local: inspector_module["row-source-plugin"]
|
|
24
|
+
};
|
|
25
|
+
case 'core':
|
|
26
|
+
return {
|
|
27
|
+
global: 'byline-inspector-row-source-core',
|
|
28
|
+
local: inspector_module["row-source-core"]
|
|
29
|
+
};
|
|
30
|
+
default:
|
|
31
|
+
return {
|
|
32
|
+
global: 'byline-inspector-row-source-unknown',
|
|
33
|
+
local: inspector_module["row-source-unknown"]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function displayUser(user) {
|
|
38
|
+
const parts = [
|
|
39
|
+
user.given_name,
|
|
40
|
+
user.family_name
|
|
41
|
+
].filter((p)=>'string' == typeof p && p.length > 0);
|
|
42
|
+
return parts.length > 0 ? `${parts.join(' ')} (${user.email})` : user.email;
|
|
43
|
+
}
|
|
44
|
+
function MatrixPanel({ matrix }) {
|
|
45
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
46
|
+
className: classnames('byline-inspector-matrix', inspector_module.matrix),
|
|
47
|
+
children: [
|
|
48
|
+
/*#__PURE__*/ jsxs("div", {
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ jsxs("h4", {
|
|
51
|
+
className: classnames('byline-inspector-matrix-title', inspector_module["matrix-title"]),
|
|
52
|
+
children: [
|
|
53
|
+
"Roles (",
|
|
54
|
+
matrix.roles.length,
|
|
55
|
+
")"
|
|
56
|
+
]
|
|
57
|
+
}),
|
|
58
|
+
0 === matrix.roles.length ? /*#__PURE__*/ jsx("p", {
|
|
59
|
+
className: classnames('muted', 'byline-inspector-matrix-empty', inspector_module["matrix-empty"]),
|
|
60
|
+
children: "No role grants this ability."
|
|
61
|
+
}) : /*#__PURE__*/ jsx("ul", {
|
|
62
|
+
className: classnames('byline-inspector-matrix-list', inspector_module["matrix-list"]),
|
|
63
|
+
children: matrix.roles.map((role)=>/*#__PURE__*/ jsxs("li", {
|
|
64
|
+
className: classnames('byline-inspector-matrix-item', inspector_module["matrix-item"]),
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ jsx("span", {
|
|
67
|
+
className: classnames('byline-inspector-matrix-name', inspector_module["matrix-name"]),
|
|
68
|
+
children: role.name
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ jsxs("span", {
|
|
71
|
+
className: "muted",
|
|
72
|
+
children: [
|
|
73
|
+
"\xa0\xb7\xa0",
|
|
74
|
+
role.machine_name
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}, role.id))
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ jsxs("div", {
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ jsxs("h4", {
|
|
85
|
+
className: classnames('byline-inspector-matrix-title', inspector_module["matrix-title"]),
|
|
86
|
+
children: [
|
|
87
|
+
"Admin users (",
|
|
88
|
+
matrix.users.length,
|
|
89
|
+
")"
|
|
90
|
+
]
|
|
91
|
+
}),
|
|
92
|
+
0 === matrix.users.length ? /*#__PURE__*/ jsx("p", {
|
|
93
|
+
className: classnames('muted', 'byline-inspector-matrix-empty', inspector_module["matrix-empty"]),
|
|
94
|
+
children: "No admin user holds this ability."
|
|
95
|
+
}) : /*#__PURE__*/ jsx("ul", {
|
|
96
|
+
className: classnames('byline-inspector-matrix-list', inspector_module["matrix-list"]),
|
|
97
|
+
children: matrix.users.map((user)=>/*#__PURE__*/ jsx("li", {
|
|
98
|
+
className: classnames('byline-inspector-matrix-item', inspector_module["matrix-item"]),
|
|
99
|
+
children: displayUser(user)
|
|
100
|
+
}, user.id))
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function AbilityRow({ ability, matrix, loading, onToggle, expanded }) {
|
|
108
|
+
const sv = sourceVariant(ability.source);
|
|
109
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
110
|
+
className: classnames('byline-inspector-row', inspector_module.row),
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ jsxs("div", {
|
|
113
|
+
className: classnames('byline-inspector-row-head', inspector_module["row-head"]),
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ jsxs("div", {
|
|
116
|
+
className: classnames('byline-inspector-row-info', inspector_module["row-info"]),
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ jsxs("div", {
|
|
119
|
+
className: classnames('byline-inspector-row-meta', inspector_module["row-meta"]),
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ jsx("code", {
|
|
122
|
+
className: classnames('byline-inspector-row-key', inspector_module["row-key"]),
|
|
123
|
+
children: ability.key
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ jsx("span", {
|
|
126
|
+
className: classnames('byline-inspector-row-source', inspector_module["row-source"], sv.global, sv.local),
|
|
127
|
+
children: ability.source ?? 'unknown'
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ jsx("p", {
|
|
132
|
+
className: classnames('byline-inspector-row-label', inspector_module["row-label"]),
|
|
133
|
+
children: ability.label
|
|
134
|
+
}),
|
|
135
|
+
ability.description ? /*#__PURE__*/ jsx("p", {
|
|
136
|
+
className: classnames('muted', "byline-inspector-row-description", inspector_module["row-description"]),
|
|
137
|
+
children: ability.description
|
|
138
|
+
}) : null
|
|
139
|
+
]
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ jsx(Button, {
|
|
142
|
+
size: "xs",
|
|
143
|
+
intent: "secondary",
|
|
144
|
+
onClick: onToggle,
|
|
145
|
+
children: expanded ? 'Hide' : 'Holders'
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
expanded ? loading ? /*#__PURE__*/ jsxs("div", {
|
|
150
|
+
className: classnames('byline-inspector-loader', inspector_module.loader),
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ jsx(LoaderRing, {
|
|
153
|
+
size: 20,
|
|
154
|
+
color: "#888"
|
|
155
|
+
}),
|
|
156
|
+
/*#__PURE__*/ jsx("span", {
|
|
157
|
+
className: "muted",
|
|
158
|
+
children: "Loading…"
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
}) : matrix ? /*#__PURE__*/ jsx(MatrixPanel, {
|
|
162
|
+
matrix: matrix
|
|
163
|
+
}) : null : null
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function GroupSection({ group, matrices, loading, expanded, onToggle }) {
|
|
168
|
+
return /*#__PURE__*/ jsxs("details", {
|
|
169
|
+
open: true,
|
|
170
|
+
className: classnames('byline-inspector-group', inspector_module.group),
|
|
171
|
+
children: [
|
|
172
|
+
/*#__PURE__*/ jsxs("summary", {
|
|
173
|
+
className: classnames('byline-inspector-group-summary', inspector_module["group-summary"]),
|
|
174
|
+
children: [
|
|
175
|
+
/*#__PURE__*/ jsx("span", {
|
|
176
|
+
className: classnames('byline-inspector-group-name', inspector_module["group-name"]),
|
|
177
|
+
children: group.group
|
|
178
|
+
}),
|
|
179
|
+
/*#__PURE__*/ jsxs("span", {
|
|
180
|
+
className: classnames('muted', 'byline-inspector-group-count', inspector_module["group-count"]),
|
|
181
|
+
children: [
|
|
182
|
+
group.abilities.length,
|
|
183
|
+
" abilities"
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
}),
|
|
188
|
+
/*#__PURE__*/ jsx("div", {
|
|
189
|
+
className: classnames('byline-inspector-group-body', inspector_module["group-body"]),
|
|
190
|
+
children: group.abilities.map((ability)=>/*#__PURE__*/ jsx(AbilityRow, {
|
|
191
|
+
ability: ability,
|
|
192
|
+
matrix: matrices[ability.key],
|
|
193
|
+
loading: loading.has(ability.key),
|
|
194
|
+
expanded: expanded.has(ability.key),
|
|
195
|
+
onToggle: ()=>onToggle(ability.key)
|
|
196
|
+
}, ability.key))
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function AbilitiesInspector({ data }) {
|
|
202
|
+
const { whoHasAbility } = useBylineAdminServices();
|
|
203
|
+
const [expanded, setExpanded] = useState(new Set());
|
|
204
|
+
const [loading, setLoading] = useState(new Set());
|
|
205
|
+
const [matrices, setMatrices] = useState({});
|
|
206
|
+
async function handleToggle(abilityKey) {
|
|
207
|
+
setExpanded((current)=>{
|
|
208
|
+
const next = new Set(current);
|
|
209
|
+
if (next.has(abilityKey)) next.delete(abilityKey);
|
|
210
|
+
else next.add(abilityKey);
|
|
211
|
+
return next;
|
|
212
|
+
});
|
|
213
|
+
if (!matrices[abilityKey] && !loading.has(abilityKey)) {
|
|
214
|
+
setLoading((current)=>new Set(current).add(abilityKey));
|
|
215
|
+
try {
|
|
216
|
+
const result = await whoHasAbility({
|
|
217
|
+
data: {
|
|
218
|
+
ability: abilityKey
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
setMatrices((current)=>({
|
|
222
|
+
...current,
|
|
223
|
+
[abilityKey]: result
|
|
224
|
+
}));
|
|
225
|
+
} finally{
|
|
226
|
+
setLoading((current)=>{
|
|
227
|
+
const next = new Set(current);
|
|
228
|
+
next.delete(abilityKey);
|
|
229
|
+
return next;
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return /*#__PURE__*/ jsx(Section, {
|
|
235
|
+
children: /*#__PURE__*/ jsxs(Container, {
|
|
236
|
+
children: [
|
|
237
|
+
/*#__PURE__*/ jsxs("div", {
|
|
238
|
+
className: classnames('byline-inspector-head', inspector_module.head),
|
|
239
|
+
children: [
|
|
240
|
+
/*#__PURE__*/ jsx("h1", {
|
|
241
|
+
className: classnames('byline-inspector-title', inspector_module.title),
|
|
242
|
+
children: "Abilities Inspector"
|
|
243
|
+
}),
|
|
244
|
+
/*#__PURE__*/ jsxs("span", {
|
|
245
|
+
className: classnames('byline-inspector-count-pill', inspector_module["count-pill"]),
|
|
246
|
+
children: [
|
|
247
|
+
data.total,
|
|
248
|
+
" registered"
|
|
249
|
+
]
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
}),
|
|
253
|
+
/*#__PURE__*/ jsxs("p", {
|
|
254
|
+
className: classnames('muted', 'byline-inspector-lead', inspector_module.lead),
|
|
255
|
+
children: [
|
|
256
|
+
"Read-only view of every ability registered through ",
|
|
257
|
+
/*#__PURE__*/ jsx("code", {
|
|
258
|
+
children: "bylineCore.abilities"
|
|
259
|
+
}),
|
|
260
|
+
". Collections auto-register CRUD + workflow abilities; admin subsystems contribute their own keys at composition root via ",
|
|
261
|
+
/*#__PURE__*/ jsx("code", {
|
|
262
|
+
children: "registerAdminAbilities"
|
|
263
|
+
}),
|
|
264
|
+
"."
|
|
265
|
+
]
|
|
266
|
+
}),
|
|
267
|
+
0 === data.groups.length ? /*#__PURE__*/ jsx("p", {
|
|
268
|
+
className: classnames('muted', 'byline-inspector-empty', inspector_module.empty),
|
|
269
|
+
children: "No abilities are registered."
|
|
270
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
271
|
+
className: classnames('byline-inspector-groups', inspector_module.groups),
|
|
272
|
+
children: data.groups.map((group)=>/*#__PURE__*/ jsx(GroupSection, {
|
|
273
|
+
group: group,
|
|
274
|
+
matrices: matrices,
|
|
275
|
+
loading: loading,
|
|
276
|
+
expanded: expanded,
|
|
277
|
+
onToggle: (key)=>void handleToggle(key)
|
|
278
|
+
}, group.group))
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
export { AbilitiesInspector };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import "./inspector_module.css";
|
|
2
|
+
const inspector_module = {
|
|
3
|
+
head: "head-LSZDaP",
|
|
4
|
+
title: "title-lDK_Fk",
|
|
5
|
+
"count-pill": "count-pill-ITgdEl",
|
|
6
|
+
countPill: "count-pill-ITgdEl",
|
|
7
|
+
lead: "lead-izInZI",
|
|
8
|
+
groups: "groups-fkoeOF",
|
|
9
|
+
group: "group-sFsp6u",
|
|
10
|
+
"group-summary": "group-summary-pHxhr7",
|
|
11
|
+
groupSummary: "group-summary-pHxhr7",
|
|
12
|
+
"group-name": "group-name-XGxN_k",
|
|
13
|
+
groupName: "group-name-XGxN_k",
|
|
14
|
+
"group-count": "group-count-AySjLk",
|
|
15
|
+
groupCount: "group-count-AySjLk",
|
|
16
|
+
"group-body": "group-body-bsRbDC",
|
|
17
|
+
groupBody: "group-body-bsRbDC",
|
|
18
|
+
row: "row-EWBEL6",
|
|
19
|
+
"row-head": "row-head-v7sV3a",
|
|
20
|
+
rowHead: "row-head-v7sV3a",
|
|
21
|
+
"row-info": "row-info-Ue09nn",
|
|
22
|
+
rowInfo: "row-info-Ue09nn",
|
|
23
|
+
"row-meta": "row-meta-vd_MXt",
|
|
24
|
+
rowMeta: "row-meta-vd_MXt",
|
|
25
|
+
"row-key": "row-key-DOMQOX",
|
|
26
|
+
rowKey: "row-key-DOMQOX",
|
|
27
|
+
"row-source": "row-source-PVTPVk",
|
|
28
|
+
rowSource: "row-source-PVTPVk",
|
|
29
|
+
"row-source-collection": "row-source-collection-jMqWJY",
|
|
30
|
+
rowSourceCollection: "row-source-collection-jMqWJY",
|
|
31
|
+
"row-source-admin": "row-source-admin-f0X_cD",
|
|
32
|
+
rowSourceAdmin: "row-source-admin-f0X_cD",
|
|
33
|
+
"row-source-plugin": "row-source-plugin-mvW_Tv",
|
|
34
|
+
rowSourcePlugin: "row-source-plugin-mvW_Tv",
|
|
35
|
+
"row-source-core": "row-source-core-FpbsYQ",
|
|
36
|
+
rowSourceCore: "row-source-core-FpbsYQ",
|
|
37
|
+
"row-source-unknown": "row-source-unknown-Y7M8Ui",
|
|
38
|
+
rowSourceUnknown: "row-source-unknown-Y7M8Ui",
|
|
39
|
+
"row-label": "row-label-AaK0cT",
|
|
40
|
+
rowLabel: "row-label-AaK0cT",
|
|
41
|
+
"row-description": "row-description-zN1YP1",
|
|
42
|
+
rowDescription: "row-description-zN1YP1",
|
|
43
|
+
loader: "loader-Nd5rQi",
|
|
44
|
+
matrix: "matrix-hXQUki",
|
|
45
|
+
"matrix-title": "matrix-title-Cb_VsP",
|
|
46
|
+
matrixTitle: "matrix-title-Cb_VsP",
|
|
47
|
+
"matrix-empty": "matrix-empty-hvBS57",
|
|
48
|
+
matrixEmpty: "matrix-empty-hvBS57",
|
|
49
|
+
"matrix-list": "matrix-list-XIClzY",
|
|
50
|
+
matrixList: "matrix-list-XIClzY",
|
|
51
|
+
"matrix-item": "matrix-item-J5vk6D",
|
|
52
|
+
matrixItem: "matrix-item-J5vk6D",
|
|
53
|
+
"matrix-name": "matrix-name-TtDpnW",
|
|
54
|
+
matrixName: "matrix-name-TtDpnW"
|
|
55
|
+
};
|
|
56
|
+
export default inspector_module;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
:is(.head-LSZDaP, .byline-inspector-head) {
|
|
2
|
+
align-items: center;
|
|
3
|
+
gap: var(--spacing-12);
|
|
4
|
+
margin-bottom: var(--spacing-16);
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:is(.title-lDK_Fk, .byline-inspector-title) {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:is(.count-pill-ITgdEl, .byline-inspector-count-pill) {
|
|
13
|
+
background-color: var(--gray-25);
|
|
14
|
+
border: var(--border-width-thin) var(--border-style-solid) var(--gray-200);
|
|
15
|
+
padding: var(--spacing-4) var(--spacing-8);
|
|
16
|
+
font-size: var(--font-size-sm);
|
|
17
|
+
border-radius: var(--border-radius-sm);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:is(.lead-izInZI, .byline-inspector-lead) {
|
|
21
|
+
margin-bottom: var(--spacing-16);
|
|
22
|
+
font-size: var(--font-size-sm);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:is(.groups-fkoeOF, .byline-inspector-groups) {
|
|
26
|
+
gap: var(--spacing-8);
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
display: flex;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:is(.group-sFsp6u, .byline-inspector-group) {
|
|
32
|
+
border: var(--border-width-thin) var(--border-style-solid) var(--gray-100);
|
|
33
|
+
border-radius: var(--border-radius-sm);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.group-sFsp6u summary::-webkit-details-marker {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:is(.group-summary-pHxhr7, .byline-inspector-group-summary) {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
padding: var(--spacing-12);
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
align-items: center;
|
|
45
|
+
list-style: none;
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:is(.group-name-XGxN_k, .byline-inspector-group-name) {
|
|
50
|
+
font-weight: var(--font-weight-medium);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:is(.group-count-AySjLk, .byline-inspector-group-count) {
|
|
54
|
+
font-size: var(--font-size-xs);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:is(.group-body-bsRbDC, .byline-inspector-group-body) {
|
|
58
|
+
padding: 0 var(--spacing-12) var(--spacing-12) var(--spacing-12);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:is(.row-EWBEL6, .byline-inspector-row) {
|
|
62
|
+
border-top: var(--border-width-thin) var(--border-style-solid) var(--gray-100);
|
|
63
|
+
padding: var(--spacing-8) 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:is(.row-EWBEL6:first-child, .byline-inspector-row:first-child) {
|
|
67
|
+
border-top: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:is(.row-head-v7sV3a, .byline-inspector-row-head) {
|
|
71
|
+
align-items: flex-start;
|
|
72
|
+
gap: var(--spacing-12);
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:is(.row-info-Ue09nn, .byline-inspector-row-info) {
|
|
77
|
+
flex: 1 1 0;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:is(.row-meta-vd_MXt, .byline-inspector-row-meta) {
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: var(--spacing-8);
|
|
84
|
+
display: flex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:is(.row-key-DOMQOX, .byline-inspector-row-key) {
|
|
88
|
+
background-color: var(--gray-50);
|
|
89
|
+
font-size: var(--font-size-xs);
|
|
90
|
+
border-radius: var(--border-radius-sm);
|
|
91
|
+
padding: .125rem .375rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:is(.row-source-PVTPVk, .byline-inspector-row-source) {
|
|
95
|
+
text-transform: uppercase;
|
|
96
|
+
letter-spacing: .05em;
|
|
97
|
+
border-radius: var(--border-radius-sm);
|
|
98
|
+
background-color: var(--gray-100);
|
|
99
|
+
color: var(--gray-800);
|
|
100
|
+
padding: .125rem .375rem;
|
|
101
|
+
font-size: .625rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:is(.row-source-collection-jMqWJY, .byline-inspector-row-source-collection) {
|
|
105
|
+
background-color: var(--gray-100);
|
|
106
|
+
color: var(--gray-800);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:is(.row-source-admin-f0X_cD, .byline-inspector-row-source-admin) {
|
|
110
|
+
background-color: var(--blue-50);
|
|
111
|
+
color: var(--blue-700);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:is(.row-source-plugin-mvW_Tv, .byline-inspector-row-source-plugin) {
|
|
115
|
+
background-color: var(--primary-50);
|
|
116
|
+
color: var(--primary-700);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:is(.row-source-core-FpbsYQ, .byline-inspector-row-source-core) {
|
|
120
|
+
background-color: var(--green-50);
|
|
121
|
+
color: var(--green-700);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:is(.row-source-unknown-Y7M8Ui, .byline-inspector-row-source-unknown) {
|
|
125
|
+
background-color: var(--gray-50);
|
|
126
|
+
color: var(--gray-600);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:is(.row-label-AaK0cT, .byline-inspector-row-label) {
|
|
130
|
+
margin: var(--spacing-4) 0 0 0;
|
|
131
|
+
font-size: var(--font-size-sm);
|
|
132
|
+
font-weight: var(--font-weight-medium);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:is(.row-description-zN1YP1, .byline-inspector-row-description) {
|
|
136
|
+
font-size: var(--font-size-xs);
|
|
137
|
+
margin-bottom: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:is(.loader-Nd5rQi, .byline-inspector-loader) {
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: var(--spacing-8);
|
|
143
|
+
margin-top: var(--spacing-8);
|
|
144
|
+
font-size: var(--font-size-sm);
|
|
145
|
+
display: flex;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:is(.matrix-hXQUki, .byline-inspector-matrix) {
|
|
149
|
+
margin-top: var(--spacing-8);
|
|
150
|
+
gap: var(--spacing-12);
|
|
151
|
+
padding: var(--spacing-12);
|
|
152
|
+
background-color: var(--canvas-25);
|
|
153
|
+
border: var(--border-width-thin) var(--border-style-solid) var(--gray-100);
|
|
154
|
+
border-radius: var(--border-radius-sm);
|
|
155
|
+
grid-template-columns: 1fr;
|
|
156
|
+
display: grid;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (min-width: 40rem) {
|
|
160
|
+
:is(.matrix-hXQUki, .byline-inspector-matrix) {
|
|
161
|
+
grid-template-columns: 1fr 1fr;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:is(.matrix-title-Cb_VsP, .byline-inspector-matrix-title) {
|
|
166
|
+
margin: 0 0 var(--spacing-8) 0;
|
|
167
|
+
font-size: var(--font-size-sm);
|
|
168
|
+
font-weight: var(--font-weight-bold);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:is(.matrix-empty-hvBS57, .byline-inspector-matrix-empty) {
|
|
172
|
+
font-style: italic;
|
|
173
|
+
font-size: var(--font-size-sm);
|
|
174
|
+
margin: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:is(.matrix-list-XIClzY, .byline-inspector-matrix-list) {
|
|
178
|
+
font-size: var(--font-size-sm);
|
|
179
|
+
margin: 0;
|
|
180
|
+
padding: 0;
|
|
181
|
+
list-style: none;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:is(.matrix-item-J5vk6D, .byline-inspector-matrix-item) {
|
|
185
|
+
margin-bottom: var(--spacing-4);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:is(.matrix-name-TtDpnW, .byline-inspector-matrix-name) {
|
|
189
|
+
font-weight: var(--font-weight-medium);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:is(:is([data-theme="dark"], .dark) .count-pill-ITgdEl, :is([data-theme="dark"], .dark) .byline-inspector-count-pill) {
|
|
193
|
+
background-color: var(--canvas-700);
|
|
194
|
+
border-color: var(--gray-700);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
:is(:is([data-theme="dark"], .dark) .group-sFsp6u, :is([data-theme="dark"], .dark) .byline-inspector-group) {
|
|
198
|
+
border-color: var(--gray-700);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:is(:is([data-theme="dark"], .dark) .row-EWBEL6, :is([data-theme="dark"], .dark) .byline-inspector-row) {
|
|
202
|
+
border-top-color: var(--gray-700);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
:is(:is([data-theme="dark"], .dark) .row-key-DOMQOX, :is([data-theme="dark"], .dark) .byline-inspector-row-key) {
|
|
206
|
+
background-color: var(--canvas-800);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
:is(:is([data-theme="dark"], .dark) .row-source-collection-jMqWJY, :is([data-theme="dark"], .dark) .byline-inspector-row-source-collection) {
|
|
210
|
+
background-color: var(--canvas-700);
|
|
211
|
+
color: var(--gray-200);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
:is(:is([data-theme="dark"], .dark) .row-source-admin-f0X_cD, :is([data-theme="dark"], .dark) .byline-inspector-row-source-admin) {
|
|
215
|
+
background-color: var(--blue-900);
|
|
216
|
+
color: var(--blue-200);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
:is(:is([data-theme="dark"], .dark) .row-source-plugin-mvW_Tv, :is([data-theme="dark"], .dark) .byline-inspector-row-source-plugin) {
|
|
220
|
+
background-color: var(--primary-900);
|
|
221
|
+
color: var(--primary-200);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
:is(:is([data-theme="dark"], .dark) .row-source-core-FpbsYQ, :is([data-theme="dark"], .dark) .byline-inspector-row-source-core) {
|
|
225
|
+
background-color: var(--green-900);
|
|
226
|
+
color: var(--green-200);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
:is(:is([data-theme="dark"], .dark) .row-source-unknown-Y7M8Ui, :is([data-theme="dark"], .dark) .byline-inspector-row-source-unknown) {
|
|
230
|
+
background-color: var(--canvas-800);
|
|
231
|
+
color: var(--gray-400);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
:is(:is([data-theme="dark"], .dark) .matrix-hXQUki, :is([data-theme="dark"], .dark) .byline-inspector-matrix) {
|
|
235
|
+
background-color: var(--canvas-800);
|
|
236
|
+
border-color: var(--gray-700);
|
|
237
|
+
}
|
|
238
|
+
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Infonomic Company Limited
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Shape an `AbilityDescriptor` from the registry into its public
|
|
10
|
-
* response form. Identity-shaped today — the indirection exists so
|
|
11
|
-
* that future internal-only fields on `AbilityDescriptor` (e.g. a
|
|
12
|
-
* registration timestamp) stay opted out of the public shape by
|
|
13
|
-
* default.
|
|
14
|
-
*/
|
|
15
|
-
export function toAbilityDescriptor(descriptor) {
|
|
1
|
+
function toAbilityDescriptor(descriptor) {
|
|
16
2
|
return {
|
|
17
3
|
key: descriptor.key,
|
|
18
4
|
label: descriptor.label,
|
|
19
5
|
description: descriptor.description ?? null,
|
|
20
6
|
group: descriptor.group,
|
|
21
|
-
source: descriptor.source ?? null
|
|
7
|
+
source: descriptor.source ?? null
|
|
22
8
|
};
|
|
23
9
|
}
|
|
10
|
+
export { toAbilityDescriptor };
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Infonomic Company Limited
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Module-local error codes for admin-permissions.
|
|
10
|
-
*
|
|
11
|
-
* `ROLE_NOT_FOUND` covers the editor (and future grant/revoke) paths;
|
|
12
|
-
* `ABILITY_UNREGISTERED` is reserved for the editor too — when a client
|
|
13
|
-
* tries to grant an ability key that no subsystem has registered. The
|
|
14
|
-
* inspector is read-only and never throws either of these.
|
|
15
|
-
*/
|
|
16
|
-
export const AdminPermissionsErrorCodes = {
|
|
1
|
+
const AdminPermissionsErrorCodes = {
|
|
17
2
|
ROLE_NOT_FOUND: 'admin.permissions.roleNotFound',
|
|
18
|
-
ABILITY_UNREGISTERED: 'admin.permissions.abilityUnregistered'
|
|
3
|
+
ABILITY_UNREGISTERED: 'admin.permissions.abilityUnregistered'
|
|
19
4
|
};
|
|
20
|
-
|
|
21
|
-
code
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
class AdminPermissionsError extends Error {
|
|
6
|
+
constructor(code, options){
|
|
7
|
+
super(options.message, null != options.cause ? {
|
|
8
|
+
cause: options.cause
|
|
9
|
+
} : void 0);
|
|
24
10
|
this.name = 'AdminPermissionsError';
|
|
25
11
|
this.code = code;
|
|
26
12
|
}
|
|
27
13
|
}
|
|
28
|
-
const make = (code, defaultMessage)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
const make = (code, defaultMessage)=>(options)=>new AdminPermissionsError(code, {
|
|
15
|
+
message: options?.message ?? defaultMessage,
|
|
16
|
+
cause: options?.cause
|
|
17
|
+
});
|
|
18
|
+
const ERR_ADMIN_PERMISSIONS_ROLE_NOT_FOUND = make(AdminPermissionsErrorCodes.ROLE_NOT_FOUND, 'admin role not found');
|
|
19
|
+
const ERR_ADMIN_PERMISSIONS_ABILITY_UNREGISTERED = make(AdminPermissionsErrorCodes.ABILITY_UNREGISTERED, 'one or more abilities are not registered');
|
|
20
|
+
export { AdminPermissionsError, AdminPermissionsErrorCodes, ERR_ADMIN_PERMISSIONS_ABILITY_UNREGISTERED, ERR_ADMIN_PERMISSIONS_ROLE_NOT_FOUND };
|