@firecms/user_management 3.0.0-canary.183 → 3.0.0-canary.186
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 +1 -11
- package/dist/index.es.js +57 -115
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +57 -115
- package/dist/index.umd.js.map +1 -1
- package/dist/types/user_management.d.ts +0 -8
- package/package.json +5 -5
- package/src/components/roles/RolesView.tsx +9 -17
- package/src/components/users/UsersView.tsx +1 -4
- package/src/hooks/useBuildUserManagement.tsx +0 -16
- package/src/types/user_management.tsx +0 -10
@@ -19,14 +19,6 @@ export interface UserManagementParams<CONTROLLER extends AuthController<any> = A
|
|
19
19
|
* Default: __FIRECMS/config/roles
|
20
20
|
*/
|
21
21
|
rolesPath?: string;
|
22
|
-
/**
|
23
|
-
* Maximum number of users that can be created.
|
24
|
-
*/
|
25
|
-
usersLimit?: number;
|
26
|
-
/**
|
27
|
-
* Can the logged user edit roles
|
28
|
-
*/
|
29
|
-
canEditRoles?: boolean;
|
30
22
|
/**
|
31
23
|
* If there are no roles in the database, provide a button to create the default roles.
|
32
24
|
*/
|
@@ -43,9 +35,7 @@ export interface UserManagementParams<CONTROLLER extends AuthController<any> = A
|
|
43
35
|
* @param dataSourceDelegate
|
44
36
|
* @param usersPath
|
45
37
|
* @param rolesPath
|
46
|
-
* @param usersLimit
|
47
|
-
* @param canEditRoles
|
48
38
|
* @param allowDefaultRolesCreation
|
49
39
|
* @param includeCollectionConfigPermissions
|
50
40
|
*/
|
51
|
-
export declare function useBuildUserManagement<CONTROLLER extends AuthController<any> = AuthController<any>, USER extends User = CONTROLLER extends AuthController<infer U> ? U : any>({ authController, dataSourceDelegate, usersPath, rolesPath,
|
41
|
+
export declare function useBuildUserManagement<CONTROLLER extends AuthController<any> = AuthController<any>, USER extends User = CONTROLLER extends AuthController<infer U> ? U : any>({ authController, dataSourceDelegate, usersPath, rolesPath, allowDefaultRolesCreation, includeCollectionConfigPermissions }: UserManagementParams<CONTROLLER>): UserManagement<USER> & CONTROLLER;
|
package/dist/index.es.js
CHANGED
@@ -147,8 +147,6 @@ function useBuildUserManagement({
|
|
147
147
|
dataSourceDelegate,
|
148
148
|
usersPath = "__FIRECMS/config/users",
|
149
149
|
rolesPath = "__FIRECMS/config/roles",
|
150
|
-
usersLimit,
|
151
|
-
canEditRoles = true,
|
152
150
|
allowDefaultRolesCreation,
|
153
151
|
includeCollectionConfigPermissions
|
154
152
|
}) {
|
@@ -349,10 +347,8 @@ function useBuildUserManagement({
|
|
349
347
|
rolesError,
|
350
348
|
deleteUser,
|
351
349
|
deleteRole,
|
352
|
-
usersLimit,
|
353
350
|
usersError,
|
354
351
|
isAdmin,
|
355
|
-
canEditRoles: canEditRoles === void 0 ? true : canEditRoles,
|
356
352
|
allowDefaultRolesCreation: allowDefaultRolesCreation === void 0 ? true : allowDefaultRolesCreation,
|
357
353
|
includeCollectionConfigPermissions: Boolean(includeCollectionConfigPermissions),
|
358
354
|
collectionPermissions,
|
@@ -1354,7 +1350,7 @@ function RolesTable(t0) {
|
|
1354
1350
|
return t11;
|
1355
1351
|
}
|
1356
1352
|
const RolesView = React.memo(function RolesView2(t0) {
|
1357
|
-
const $ = c(
|
1353
|
+
const $ = c(13);
|
1358
1354
|
const {
|
1359
1355
|
children
|
1360
1356
|
} = t0;
|
@@ -1363,9 +1359,6 @@ const RolesView = React.memo(function RolesView2(t0) {
|
|
1363
1359
|
} = useNavigationController();
|
1364
1360
|
const [dialogOpen, setDialogOpen] = useState(false);
|
1365
1361
|
const [selectedRole, setSelectedRole] = useState();
|
1366
|
-
const {
|
1367
|
-
canEditRoles
|
1368
|
-
} = useUserManagement();
|
1369
1362
|
let t1;
|
1370
1363
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
1371
1364
|
t1 = (user) => {
|
@@ -1395,78 +1388,47 @@ const RolesView = React.memo(function RolesView2(t0) {
|
|
1395
1388
|
} else {
|
1396
1389
|
t3 = $[2];
|
1397
1390
|
}
|
1398
|
-
|
1399
|
-
|
1400
|
-
let t6;
|
1401
|
-
let t7;
|
1391
|
+
let t4;
|
1392
|
+
let t5;
|
1402
1393
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
1403
|
-
|
1404
|
-
t7 = () => setDialogOpen(true);
|
1405
|
-
$[3] = t6;
|
1406
|
-
$[4] = t7;
|
1407
|
-
} else {
|
1408
|
-
t6 = $[3];
|
1409
|
-
t7 = $[4];
|
1410
|
-
}
|
1411
|
-
let t8;
|
1412
|
-
if ($[5] !== t5) {
|
1413
|
-
t8 = /* @__PURE__ */ jsx(Button, { size: "large", disabled: t5, startIcon: t6, onClick: t7, children: "Add role" });
|
1414
|
-
$[5] = t5;
|
1415
|
-
$[6] = t8;
|
1416
|
-
} else {
|
1417
|
-
t8 = $[6];
|
1418
|
-
}
|
1419
|
-
let t9;
|
1420
|
-
if ($[7] !== t4 || $[8] !== t8) {
|
1421
|
-
t9 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
|
1394
|
+
t4 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
|
1422
1395
|
t3,
|
1423
|
-
/* @__PURE__ */ jsx(
|
1396
|
+
/* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
|
1424
1397
|
] });
|
1425
|
-
|
1426
|
-
$[
|
1427
|
-
$[
|
1428
|
-
} else {
|
1429
|
-
t9 = $[9];
|
1430
|
-
}
|
1431
|
-
const t10 = Boolean(canEditRoles);
|
1432
|
-
let t11;
|
1433
|
-
if ($[10] !== t10) {
|
1434
|
-
t11 = /* @__PURE__ */ jsx(RolesTable, { onRoleClicked, editable: t10 });
|
1435
|
-
$[10] = t10;
|
1436
|
-
$[11] = t11;
|
1398
|
+
t5 = /* @__PURE__ */ jsx(RolesTable, { onRoleClicked, editable: true });
|
1399
|
+
$[3] = t4;
|
1400
|
+
$[4] = t5;
|
1437
1401
|
} else {
|
1438
|
-
|
1402
|
+
t4 = $[3];
|
1403
|
+
t5 = $[4];
|
1439
1404
|
}
|
1440
|
-
const
|
1441
|
-
let
|
1442
|
-
if ($[
|
1443
|
-
|
1444
|
-
$[
|
1445
|
-
$[
|
1446
|
-
$[
|
1447
|
-
$[
|
1448
|
-
$[
|
1449
|
-
$[17] = t13;
|
1405
|
+
const t6 = selectedRole?.id ?? "new";
|
1406
|
+
let t7;
|
1407
|
+
if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
|
1408
|
+
t7 = /* @__PURE__ */ jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
|
1409
|
+
$[5] = collections;
|
1410
|
+
$[6] = dialogOpen;
|
1411
|
+
$[7] = selectedRole;
|
1412
|
+
$[8] = t6;
|
1413
|
+
$[9] = t7;
|
1450
1414
|
} else {
|
1451
|
-
|
1415
|
+
t7 = $[9];
|
1452
1416
|
}
|
1453
|
-
let
|
1454
|
-
if ($[
|
1455
|
-
|
1417
|
+
let t8;
|
1418
|
+
if ($[10] !== children || $[11] !== t7) {
|
1419
|
+
t8 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
|
1456
1420
|
children,
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1421
|
+
t4,
|
1422
|
+
t5,
|
1423
|
+
t7
|
1460
1424
|
] });
|
1461
|
-
$[
|
1462
|
-
$[
|
1463
|
-
$[
|
1464
|
-
$[21] = t9;
|
1465
|
-
$[22] = t14;
|
1425
|
+
$[10] = children;
|
1426
|
+
$[11] = t7;
|
1427
|
+
$[12] = t8;
|
1466
1428
|
} else {
|
1467
|
-
|
1429
|
+
t8 = $[12];
|
1468
1430
|
}
|
1469
|
-
return
|
1431
|
+
return t8;
|
1470
1432
|
});
|
1471
1433
|
const UserYupSchema = Yup.object().shape({
|
1472
1434
|
displayName: Yup.string().required("Required"),
|
@@ -2007,17 +1969,13 @@ function _temp(userRole) {
|
|
2007
1969
|
return /* @__PURE__ */ jsx(RoleChip, { role: userRole }, userRole?.id);
|
2008
1970
|
}
|
2009
1971
|
const UsersView = function UsersView2(t0) {
|
2010
|
-
const $ = c(
|
1972
|
+
const $ = c(12);
|
2011
1973
|
const {
|
2012
1974
|
children
|
2013
1975
|
} = t0;
|
2014
1976
|
const [dialogOpen, setDialogOpen] = useState();
|
2015
1977
|
const [selectedUser, setSelectedUser] = useState();
|
2016
|
-
|
2017
|
-
users,
|
2018
|
-
usersLimit
|
2019
|
-
} = useUserManagement();
|
2020
|
-
const reachedUsersLimit = usersLimit !== void 0 && users && users.length >= usersLimit;
|
1978
|
+
useUserManagement();
|
2021
1979
|
let t1;
|
2022
1980
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
2023
1981
|
t1 = (user) => {
|
@@ -2050,60 +2008,44 @@ const UsersView = function UsersView2(t0) {
|
|
2050
2008
|
let t4;
|
2051
2009
|
let t5;
|
2052
2010
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
2053
|
-
t4 = /* @__PURE__ */
|
2054
|
-
|
2011
|
+
t4 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
|
2012
|
+
t3,
|
2013
|
+
/* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add user" })
|
2014
|
+
] });
|
2015
|
+
t5 = /* @__PURE__ */ jsx(UsersTable, { onUserClicked });
|
2055
2016
|
$[3] = t4;
|
2056
2017
|
$[4] = t5;
|
2057
2018
|
} else {
|
2058
2019
|
t4 = $[3];
|
2059
2020
|
t5 = $[4];
|
2060
2021
|
}
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
]
|
2067
|
-
$[5] = reachedUsersLimit;
|
2022
|
+
const t6 = selectedUser?.uid ?? "new";
|
2023
|
+
const t7 = dialogOpen ?? false;
|
2024
|
+
let t8;
|
2025
|
+
if ($[5] !== selectedUser || $[6] !== t6 || $[7] !== t7) {
|
2026
|
+
t8 = /* @__PURE__ */ jsx(UserDetailsForm, { open: t7, user: selectedUser, handleClose }, t6);
|
2027
|
+
$[5] = selectedUser;
|
2068
2028
|
$[6] = t6;
|
2069
|
-
} else {
|
2070
|
-
t6 = $[6];
|
2071
|
-
}
|
2072
|
-
let t7;
|
2073
|
-
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
2074
|
-
t7 = /* @__PURE__ */ jsx(UsersTable, { onUserClicked });
|
2075
2029
|
$[7] = t7;
|
2030
|
+
$[8] = t8;
|
2076
2031
|
} else {
|
2077
|
-
|
2078
|
-
}
|
2079
|
-
const t8 = selectedUser?.uid ?? "new";
|
2080
|
-
const t9 = dialogOpen ?? false;
|
2081
|
-
let t10;
|
2082
|
-
if ($[8] !== selectedUser || $[9] !== t8 || $[10] !== t9) {
|
2083
|
-
t10 = /* @__PURE__ */ jsx(UserDetailsForm, { open: t9, user: selectedUser, handleClose }, t8);
|
2084
|
-
$[8] = selectedUser;
|
2085
|
-
$[9] = t8;
|
2086
|
-
$[10] = t9;
|
2087
|
-
$[11] = t10;
|
2088
|
-
} else {
|
2089
|
-
t10 = $[11];
|
2032
|
+
t8 = $[8];
|
2090
2033
|
}
|
2091
|
-
let
|
2092
|
-
if ($[
|
2093
|
-
|
2034
|
+
let t9;
|
2035
|
+
if ($[9] !== children || $[10] !== t8) {
|
2036
|
+
t9 = /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
|
2094
2037
|
children,
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2038
|
+
t4,
|
2039
|
+
t5,
|
2040
|
+
t8
|
2098
2041
|
] });
|
2099
|
-
$[
|
2100
|
-
$[
|
2101
|
-
$[
|
2102
|
-
$[15] = t11;
|
2042
|
+
$[9] = children;
|
2043
|
+
$[10] = t8;
|
2044
|
+
$[11] = t9;
|
2103
2045
|
} else {
|
2104
|
-
|
2046
|
+
t9 = $[11];
|
2105
2047
|
}
|
2106
|
-
return
|
2048
|
+
return t9;
|
2107
2049
|
};
|
2108
2050
|
function useUserManagementPlugin(t0) {
|
2109
2051
|
const $ = c(12);
|