@firecms/user_management 3.0.0-canary.153 → 3.0.0-canary.155
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/hooks/useBuildUserManagement.d.ts +2 -2
- package/dist/index.es.js +1809 -1149
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1807 -1148
- package/dist/index.umd.js.map +1 -1
- package/package.json +7 -5
- package/src/components/roles/RolesDetailsForm.tsx +7 -8
- package/src/components/users/UserDetailsForm.tsx +5 -7
- package/src/hooks/useBuildUserManagement.tsx +7 -18
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@firecms/user_management",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.0-canary.
|
4
|
+
"version": "3.0.0-canary.155",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
7
7
|
},
|
@@ -29,9 +29,9 @@
|
|
29
29
|
"types": "dist/index.d.ts",
|
30
30
|
"source": "src/index.ts",
|
31
31
|
"dependencies": {
|
32
|
-
"@firecms/core": "^3.0.0-canary.
|
33
|
-
"@firecms/formex": "^3.0.0-canary.
|
34
|
-
"@firecms/ui": "^3.0.0-canary.
|
32
|
+
"@firecms/core": "^3.0.0-canary.155",
|
33
|
+
"@firecms/formex": "^3.0.0-canary.155",
|
34
|
+
"@firecms/ui": "^3.0.0-canary.155",
|
35
35
|
"date-fns": "^3.6.0"
|
36
36
|
},
|
37
37
|
"peerDependencies": {
|
@@ -42,6 +42,8 @@
|
|
42
42
|
"@types/node": "^20.16.11",
|
43
43
|
"@types/react": "^18.3.12",
|
44
44
|
"@types/react-dom": "^18.3.1",
|
45
|
+
"babel-plugin-react-compiler": "beta",
|
46
|
+
"eslint-plugin-react-compiler": "beta",
|
45
47
|
"typescript": "^5.6.3",
|
46
48
|
"vite": "^5.4.10"
|
47
49
|
},
|
@@ -55,5 +57,5 @@
|
|
55
57
|
"src",
|
56
58
|
"bin"
|
57
59
|
],
|
58
|
-
"gitHead": "
|
60
|
+
"gitHead": "c9b71679d709242ff3a47ec56a0ecf980ec76564"
|
59
61
|
}
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
Checkbox,
|
8
8
|
Dialog,
|
9
9
|
DialogActions,
|
10
|
-
DialogContent,
|
10
|
+
DialogContent, DialogTitle,
|
11
11
|
DoneIcon,
|
12
12
|
LoadingButton,
|
13
13
|
Paper,
|
@@ -143,14 +143,10 @@ export function RolesDetailsForm({
|
|
143
143
|
position: "relative",
|
144
144
|
height: "100%"
|
145
145
|
}}>
|
146
|
+
<DialogTitle variant={"h4"} gutterBottom={false}>
|
147
|
+
Role
|
148
|
+
</DialogTitle>
|
146
149
|
<DialogContent className="flex-grow">
|
147
|
-
<div
|
148
|
-
className="flex flex-row pt-12 pb-8">
|
149
|
-
<Typography variant={"h4"}
|
150
|
-
className="flex-grow">
|
151
|
-
Role
|
152
|
-
</Typography>
|
153
|
-
</div>
|
154
150
|
|
155
151
|
<div className={"grid grid-cols-12 gap-8"}>
|
156
152
|
|
@@ -343,6 +339,7 @@ export function RolesDetailsForm({
|
|
343
339
|
<Select
|
344
340
|
error={touched.config && Boolean(errors.config)}
|
345
341
|
size={"large"}
|
342
|
+
fullWidth={true}
|
346
343
|
id="createCollections"
|
347
344
|
name="createCollections"
|
348
345
|
label="Create collections"
|
@@ -366,6 +363,7 @@ export function RolesDetailsForm({
|
|
366
363
|
<div className={"col-span-12 md:col-span-4"}>
|
367
364
|
<Select
|
368
365
|
size={"large"}
|
366
|
+
fullWidth={true}
|
369
367
|
error={touched.config && Boolean(errors.config)}
|
370
368
|
id="editCollections"
|
371
369
|
name="editCollections"
|
@@ -393,6 +391,7 @@ export function RolesDetailsForm({
|
|
393
391
|
<div className={"col-span-12 md:col-span-4"}>
|
394
392
|
<Select
|
395
393
|
size={"large"}
|
394
|
+
fullWidth={true}
|
396
395
|
error={touched.config && Boolean(errors.config)}
|
397
396
|
id="deleteCollections"
|
398
397
|
name="deleteCollections"
|
@@ -5,6 +5,7 @@ import {
|
|
5
5
|
Dialog,
|
6
6
|
DialogActions,
|
7
7
|
DialogContent,
|
8
|
+
DialogTitle,
|
8
9
|
DoneIcon,
|
9
10
|
LoadingButton,
|
10
11
|
MultiSelect,
|
@@ -140,14 +141,11 @@ export function UserDetailsForm({
|
|
140
141
|
position: "relative",
|
141
142
|
height: "100%"
|
142
143
|
}}>
|
144
|
+
|
145
|
+
<DialogTitle variant={"h4"} gutterBottom={false}>
|
146
|
+
User
|
147
|
+
</DialogTitle>
|
143
148
|
<DialogContent className="h-full flex-grow">
|
144
|
-
<div
|
145
|
-
className="flex flex-row pt-4 pb-4">
|
146
|
-
<Typography variant={"h4"}
|
147
|
-
className="flex-grow">
|
148
|
-
User
|
149
|
-
</Typography>
|
150
|
-
</div>
|
151
149
|
|
152
150
|
<div className={"grid grid-cols-12 gap-8"}>
|
153
151
|
|
@@ -16,8 +16,7 @@ import { resolveUserRolePermissions } from "../utils";
|
|
16
16
|
|
17
17
|
type UserWithRoleIds<USER extends User = any> = Omit<USER, "roles"> & { roles: string[] };
|
18
18
|
|
19
|
-
export interface UserManagementParams<CONTROLLER extends AuthController<any> = AuthController<any
|
20
|
-
USER extends User = CONTROLLER extends AuthController<infer U> ? U : any> {
|
19
|
+
export interface UserManagementParams<CONTROLLER extends AuthController<any> = AuthController<any>> {
|
21
20
|
|
22
21
|
authController: CONTROLLER;
|
23
22
|
|
@@ -86,7 +85,7 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<any> =
|
|
86
85
|
canEditRoles = true,
|
87
86
|
allowDefaultRolesCreation,
|
88
87
|
includeCollectionConfigPermissions
|
89
|
-
}: UserManagementParams<CONTROLLER
|
88
|
+
}: UserManagementParams<CONTROLLER>): UserManagement<USER> & CONTROLLER {
|
90
89
|
|
91
90
|
if (!authController) {
|
92
91
|
throw Error("useBuildUserManagement: You need to provide an authController since version 3.0.0-beta.11. Check https://firecms.co/docs/pro/migrating_from_v3_beta");
|
@@ -154,10 +153,6 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<any> =
|
|
154
153
|
if (authController?.initialLoading) {
|
155
154
|
return;
|
156
155
|
}
|
157
|
-
// if (authController.user === null) {
|
158
|
-
// setUsersLoading(false);
|
159
|
-
// return;
|
160
|
-
// }
|
161
156
|
|
162
157
|
setUsersLoading(true);
|
163
158
|
return dataSourceDelegate.listenCollection?.({
|
@@ -299,17 +294,11 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<any> =
|
|
299
294
|
const userRoles = authController.user ? defineRolesFor(authController.user) : undefined;
|
300
295
|
const isAdmin = (userRoles ?? []).some(r => r.id === "admin");
|
301
296
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
// console.debug("Setting roles", {
|
308
|
-
// authController,
|
309
|
-
// userRoles
|
310
|
-
// });
|
311
|
-
// authController.setUserRoles?.(userRoles ?? []);
|
312
|
-
// }, [userRoles?.map(r => r.id)]);
|
297
|
+
const userRoleIds = userRoles?.map(r => r.id);
|
298
|
+
useEffect(() => {
|
299
|
+
console.debug("Setting roles", userRoles);
|
300
|
+
authController.setUserRoles?.(userRoles ?? []);
|
301
|
+
}, [userRoleIds]);
|
313
302
|
|
314
303
|
return {
|
315
304
|
loading,
|