@firecms/user_management 3.0.0-beta.11 → 3.0.0-beta.12
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 -116
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +57 -116
- package/dist/index.umd.js.map +1 -1
- package/dist/types/user_management.d.ts +0 -8
- package/package.json +12 -12
- package/src/components/roles/RolesDetailsForm.tsx +0 -1
- 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
package/dist/index.umd.js
CHANGED
@@ -159,8 +159,6 @@
|
|
159
159
|
dataSourceDelegate,
|
160
160
|
usersPath = "__FIRECMS/config/users",
|
161
161
|
rolesPath = "__FIRECMS/config/roles",
|
162
|
-
usersLimit,
|
163
|
-
canEditRoles = true,
|
164
162
|
allowDefaultRolesCreation,
|
165
163
|
includeCollectionConfigPermissions
|
166
164
|
}) {
|
@@ -361,10 +359,8 @@
|
|
361
359
|
rolesError,
|
362
360
|
deleteUser,
|
363
361
|
deleteRole,
|
364
|
-
usersLimit,
|
365
362
|
usersError,
|
366
363
|
isAdmin,
|
367
|
-
canEditRoles: canEditRoles === void 0 ? true : canEditRoles,
|
368
364
|
allowDefaultRolesCreation: allowDefaultRolesCreation === void 0 ? true : allowDefaultRolesCreation,
|
369
365
|
includeCollectionConfigPermissions: Boolean(includeCollectionConfigPermissions),
|
370
366
|
collectionPermissions,
|
@@ -463,7 +459,6 @@
|
|
463
459
|
});
|
464
460
|
function canRoleBeEdited(loggedUser) {
|
465
461
|
const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
|
466
|
-
console.log("loggedUserIsAdmin", loggedUser);
|
467
462
|
if (!loggedUserIsAdmin) {
|
468
463
|
throw new Error("Only admins can edit roles");
|
469
464
|
}
|
@@ -1366,7 +1361,7 @@
|
|
1366
1361
|
return t11;
|
1367
1362
|
}
|
1368
1363
|
const RolesView = React.memo(function RolesView2(t0) {
|
1369
|
-
const $ = reactCompilerRuntime.c(
|
1364
|
+
const $ = reactCompilerRuntime.c(13);
|
1370
1365
|
const {
|
1371
1366
|
children
|
1372
1367
|
} = t0;
|
@@ -1375,9 +1370,6 @@
|
|
1375
1370
|
} = core.useNavigationController();
|
1376
1371
|
const [dialogOpen, setDialogOpen] = React.useState(false);
|
1377
1372
|
const [selectedRole, setSelectedRole] = React.useState();
|
1378
|
-
const {
|
1379
|
-
canEditRoles
|
1380
|
-
} = useUserManagement();
|
1381
1373
|
let t1;
|
1382
1374
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
1383
1375
|
t1 = (user) => {
|
@@ -1407,78 +1399,47 @@
|
|
1407
1399
|
} else {
|
1408
1400
|
t3 = $[2];
|
1409
1401
|
}
|
1410
|
-
|
1411
|
-
|
1412
|
-
let t6;
|
1413
|
-
let t7;
|
1402
|
+
let t4;
|
1403
|
+
let t5;
|
1414
1404
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
1415
|
-
|
1416
|
-
t7 = () => setDialogOpen(true);
|
1417
|
-
$[3] = t6;
|
1418
|
-
$[4] = t7;
|
1419
|
-
} else {
|
1420
|
-
t6 = $[3];
|
1421
|
-
t7 = $[4];
|
1422
|
-
}
|
1423
|
-
let t8;
|
1424
|
-
if ($[5] !== t5) {
|
1425
|
-
t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", disabled: t5, startIcon: t6, onClick: t7, children: "Add role" });
|
1426
|
-
$[5] = t5;
|
1427
|
-
$[6] = t8;
|
1428
|
-
} else {
|
1429
|
-
t8 = $[6];
|
1430
|
-
}
|
1431
|
-
let t9;
|
1432
|
-
if ($[7] !== t4 || $[8] !== t8) {
|
1433
|
-
t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
|
1405
|
+
t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
|
1434
1406
|
t3,
|
1435
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.
|
1407
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
|
1436
1408
|
] });
|
1437
|
-
|
1438
|
-
$[
|
1439
|
-
$[
|
1440
|
-
} else {
|
1441
|
-
t9 = $[9];
|
1442
|
-
}
|
1443
|
-
const t10 = Boolean(canEditRoles);
|
1444
|
-
let t11;
|
1445
|
-
if ($[10] !== t10) {
|
1446
|
-
t11 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: t10 });
|
1447
|
-
$[10] = t10;
|
1448
|
-
$[11] = t11;
|
1409
|
+
t5 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
|
1410
|
+
$[3] = t4;
|
1411
|
+
$[4] = t5;
|
1449
1412
|
} else {
|
1450
|
-
|
1413
|
+
t4 = $[3];
|
1414
|
+
t5 = $[4];
|
1451
1415
|
}
|
1452
|
-
const
|
1453
|
-
let
|
1454
|
-
if ($[
|
1455
|
-
|
1456
|
-
$[
|
1457
|
-
$[
|
1458
|
-
$[
|
1459
|
-
$[
|
1460
|
-
$[
|
1461
|
-
$[17] = t13;
|
1416
|
+
const t6 = selectedRole?.id ?? "new";
|
1417
|
+
let t7;
|
1418
|
+
if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
|
1419
|
+
t7 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
|
1420
|
+
$[5] = collections;
|
1421
|
+
$[6] = dialogOpen;
|
1422
|
+
$[7] = selectedRole;
|
1423
|
+
$[8] = t6;
|
1424
|
+
$[9] = t7;
|
1462
1425
|
} else {
|
1463
|
-
|
1426
|
+
t7 = $[9];
|
1464
1427
|
}
|
1465
|
-
let
|
1466
|
-
if ($[
|
1467
|
-
|
1428
|
+
let t8;
|
1429
|
+
if ($[10] !== children || $[11] !== t7) {
|
1430
|
+
t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
|
1468
1431
|
children,
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1432
|
+
t4,
|
1433
|
+
t5,
|
1434
|
+
t7
|
1472
1435
|
] });
|
1473
|
-
$[
|
1474
|
-
$[
|
1475
|
-
$[
|
1476
|
-
$[21] = t9;
|
1477
|
-
$[22] = t14;
|
1436
|
+
$[10] = children;
|
1437
|
+
$[11] = t7;
|
1438
|
+
$[12] = t8;
|
1478
1439
|
} else {
|
1479
|
-
|
1440
|
+
t8 = $[12];
|
1480
1441
|
}
|
1481
|
-
return
|
1442
|
+
return t8;
|
1482
1443
|
});
|
1483
1444
|
const UserYupSchema = Yup__namespace.object().shape({
|
1484
1445
|
displayName: Yup__namespace.string().required("Required"),
|
@@ -2019,17 +1980,13 @@
|
|
2019
1980
|
return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
|
2020
1981
|
}
|
2021
1982
|
const UsersView = function UsersView2(t0) {
|
2022
|
-
const $ = reactCompilerRuntime.c(
|
1983
|
+
const $ = reactCompilerRuntime.c(12);
|
2023
1984
|
const {
|
2024
1985
|
children
|
2025
1986
|
} = t0;
|
2026
1987
|
const [dialogOpen, setDialogOpen] = React.useState();
|
2027
1988
|
const [selectedUser, setSelectedUser] = React.useState();
|
2028
|
-
|
2029
|
-
users,
|
2030
|
-
usersLimit
|
2031
|
-
} = useUserManagement();
|
2032
|
-
const reachedUsersLimit = usersLimit !== void 0 && users && users.length >= usersLimit;
|
1989
|
+
useUserManagement();
|
2033
1990
|
let t1;
|
2034
1991
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
2035
1992
|
t1 = (user) => {
|
@@ -2062,60 +2019,44 @@
|
|
2062
2019
|
let t4;
|
2063
2020
|
let t5;
|
2064
2021
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
2065
|
-
t4 = /* @__PURE__ */ jsxRuntime.
|
2066
|
-
|
2022
|
+
t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
|
2023
|
+
t3,
|
2024
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add user" })
|
2025
|
+
] });
|
2026
|
+
t5 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
|
2067
2027
|
$[3] = t4;
|
2068
2028
|
$[4] = t5;
|
2069
2029
|
} else {
|
2070
2030
|
t4 = $[3];
|
2071
2031
|
t5 = $[4];
|
2072
2032
|
}
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
]
|
2079
|
-
$[5] = reachedUsersLimit;
|
2033
|
+
const t6 = selectedUser?.uid ?? "new";
|
2034
|
+
const t7 = dialogOpen ?? false;
|
2035
|
+
let t8;
|
2036
|
+
if ($[5] !== selectedUser || $[6] !== t6 || $[7] !== t7) {
|
2037
|
+
t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: t7, user: selectedUser, handleClose }, t6);
|
2038
|
+
$[5] = selectedUser;
|
2080
2039
|
$[6] = t6;
|
2081
|
-
} else {
|
2082
|
-
t6 = $[6];
|
2083
|
-
}
|
2084
|
-
let t7;
|
2085
|
-
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
2086
|
-
t7 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
|
2087
2040
|
$[7] = t7;
|
2041
|
+
$[8] = t8;
|
2088
2042
|
} else {
|
2089
|
-
|
2090
|
-
}
|
2091
|
-
const t8 = selectedUser?.uid ?? "new";
|
2092
|
-
const t9 = dialogOpen ?? false;
|
2093
|
-
let t10;
|
2094
|
-
if ($[8] !== selectedUser || $[9] !== t8 || $[10] !== t9) {
|
2095
|
-
t10 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: t9, user: selectedUser, handleClose }, t8);
|
2096
|
-
$[8] = selectedUser;
|
2097
|
-
$[9] = t8;
|
2098
|
-
$[10] = t9;
|
2099
|
-
$[11] = t10;
|
2100
|
-
} else {
|
2101
|
-
t10 = $[11];
|
2043
|
+
t8 = $[8];
|
2102
2044
|
}
|
2103
|
-
let
|
2104
|
-
if ($[
|
2105
|
-
|
2045
|
+
let t9;
|
2046
|
+
if ($[9] !== children || $[10] !== t8) {
|
2047
|
+
t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
|
2106
2048
|
children,
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2049
|
+
t4,
|
2050
|
+
t5,
|
2051
|
+
t8
|
2110
2052
|
] });
|
2111
|
-
$[
|
2112
|
-
$[
|
2113
|
-
$[
|
2114
|
-
$[15] = t11;
|
2053
|
+
$[9] = children;
|
2054
|
+
$[10] = t8;
|
2055
|
+
$[11] = t9;
|
2115
2056
|
} else {
|
2116
|
-
|
2057
|
+
t9 = $[11];
|
2117
2058
|
}
|
2118
|
-
return
|
2059
|
+
return t9;
|
2119
2060
|
};
|
2120
2061
|
function useUserManagementPlugin(t0) {
|
2121
2062
|
const $ = reactCompilerRuntime.c(12);
|