@firecms/user_management 3.0.0-beta.6 → 3.0.0-beta.8
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/useFirestoreUserManagement.d.ts +1 -1
- package/dist/index.es.js +169 -180
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/user_management.d.ts +4 -0
- package/package.json +13 -27
- package/src/hooks/useFirestoreUserManagement.tsx +6 -3
- package/src/types/user_management.tsx +5 -0
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-beta.
|
4
|
+
"version": "3.0.0-beta.8",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
7
7
|
},
|
@@ -29,30 +29,22 @@
|
|
29
29
|
"types": "dist/index.d.ts",
|
30
30
|
"source": "src/index.ts",
|
31
31
|
"dependencies": {
|
32
|
-
"@firecms/core": "^3.0.0-beta.
|
33
|
-
"@firecms/formex": "^3.0.0-beta.
|
34
|
-
"@firecms/ui": "^3.0.0-beta.
|
32
|
+
"@firecms/core": "^3.0.0-beta.8",
|
33
|
+
"@firecms/formex": "^3.0.0-beta.8",
|
34
|
+
"@firecms/ui": "^3.0.0-beta.8",
|
35
35
|
"date-fns": "^3.6.0"
|
36
36
|
},
|
37
37
|
"peerDependencies": {
|
38
|
-
"firebase": "^10.
|
39
|
-
"react": "^18.
|
40
|
-
"react-dom": "^18.
|
38
|
+
"firebase": "^10.12.2",
|
39
|
+
"react": "^18.3.1",
|
40
|
+
"react-dom": "^18.3.1"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
|
-
"@types/node": "^20.
|
44
|
-
"@types/react": "^18.
|
45
|
-
"@types/react-dom": "^18.
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"eslint-config-standard": "^17.1.0",
|
49
|
-
"eslint-plugin-import": "^2.29.1",
|
50
|
-
"eslint-plugin-n": "^16.6.2",
|
51
|
-
"eslint-plugin-promise": "^6.1.1",
|
52
|
-
"eslint-plugin-react": "^7.34.1",
|
53
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
54
|
-
"typescript": "^5.4.5",
|
55
|
-
"vite": "^5.2.9"
|
43
|
+
"@types/node": "^20.14.9",
|
44
|
+
"@types/react": "^18.3.3",
|
45
|
+
"@types/react-dom": "^18.3.0",
|
46
|
+
"typescript": "^5.5.3",
|
47
|
+
"vite": "^5.3.2"
|
56
48
|
},
|
57
49
|
"scripts": {
|
58
50
|
"dev": "vite",
|
@@ -64,11 +56,5 @@
|
|
64
56
|
"src",
|
65
57
|
"bin"
|
66
58
|
],
|
67
|
-
"
|
68
|
-
"extends": [
|
69
|
-
"react-app",
|
70
|
-
"react-app/jest"
|
71
|
-
]
|
72
|
-
},
|
73
|
-
"gitHead": "ffcbddbd73211bb644ff7503c2c62790bff6202a"
|
59
|
+
"gitHead": "4ef14d60f86cb2e581b908a1dc84ad6a87b14e2e"
|
74
60
|
}
|
@@ -8,8 +8,8 @@ import {
|
|
8
8
|
getFirestore,
|
9
9
|
onSnapshot,
|
10
10
|
setDoc
|
11
|
-
} from "firebase/firestore";
|
12
|
-
import { FirebaseApp } from "firebase/app";
|
11
|
+
} from "@firebase/firestore";
|
12
|
+
import { FirebaseApp } from "@firebase/app";
|
13
13
|
import { UserManagement } from "../types";
|
14
14
|
import { Authenticator, PermissionsBuilder, Role, User } from "@firecms/core";
|
15
15
|
import { resolveUserRolePermissions } from "../utils";
|
@@ -231,7 +231,9 @@ export function useFirestoreUserManagement({
|
|
231
231
|
}
|
232
232
|
|
233
233
|
throw Error("Could not find a user with the provided email in the user management system.");
|
234
|
-
}, [loading, users])
|
234
|
+
}, [loading, users]);
|
235
|
+
|
236
|
+
const isAdmin = roles.some(r => r.id === "admin");
|
235
237
|
|
236
238
|
return {
|
237
239
|
loading,
|
@@ -244,6 +246,7 @@ export function useFirestoreUserManagement({
|
|
244
246
|
deleteRole,
|
245
247
|
usersLimit,
|
246
248
|
usersError,
|
249
|
+
isAdmin,
|
247
250
|
canEditRoles: canEditRoles === undefined ? true : canEditRoles,
|
248
251
|
allowDefaultRolesCreation: allowDefaultRolesCreation === undefined ? true : allowDefaultRolesCreation,
|
249
252
|
includeCollectionConfigPermissions: Boolean(includeCollectionConfigPermissions),
|
@@ -22,6 +22,11 @@ export type UserManagement<USER extends User = User> = {
|
|
22
22
|
*/
|
23
23
|
canEditRoles?: boolean;
|
24
24
|
|
25
|
+
/**
|
26
|
+
* Is the logged user Admin?
|
27
|
+
*/
|
28
|
+
isAdmin?: boolean;
|
29
|
+
|
25
30
|
/**
|
26
31
|
* Include a button to create default roles, in case there are no roles in the system.
|
27
32
|
*/
|