@firecms/user_management 3.0.0 → 3.1.0-canary.1df3b2c
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/components/roles/RolesDetailsForm.d.ts +7 -10
- package/dist/components/roles/index.d.ts +1 -0
- package/dist/components/users/UserDetailsForm.d.ts +9 -13
- package/dist/index.es.js +51 -42
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +50 -41
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/roles/RolesDetailsForm.tsx +0 -2
- package/src/components/roles/RolesTable.tsx +1 -1
- package/src/components/roles/index.ts +1 -0
- package/src/components/users/UserDetailsForm.tsx +0 -2
- package/src/components/users/UsersTable.tsx +56 -42
- package/src/hooks/useBuildUserManagement.tsx +13 -5
- package/src/useUserManagementPlugin.tsx +1 -1
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import * as Yup from "yup";
|
|
2
2
|
import { EntityCollection, Role } from "@firecms/core";
|
|
3
|
-
export declare const RoleYupSchema: Yup.ObjectSchema<
|
|
4
|
-
id:
|
|
5
|
-
name:
|
|
6
|
-
}
|
|
7
|
-
id:
|
|
8
|
-
name:
|
|
9
|
-
}
|
|
10
|
-
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
|
-
name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
12
|
-
}>>>;
|
|
3
|
+
export declare const RoleYupSchema: Yup.ObjectSchema<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}, Yup.AnyObject, {
|
|
7
|
+
id: undefined;
|
|
8
|
+
name: undefined;
|
|
9
|
+
}, "">;
|
|
13
10
|
export declare function RolesDetailsForm({ open, role, editable, handleClose, collections }: {
|
|
14
11
|
open: boolean;
|
|
15
12
|
editable?: boolean;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import * as Yup from "yup";
|
|
2
2
|
import { User } from "@firecms/core";
|
|
3
|
-
export declare const UserYupSchema: Yup.ObjectSchema<
|
|
4
|
-
displayName:
|
|
5
|
-
email:
|
|
6
|
-
roles:
|
|
7
|
-
}
|
|
8
|
-
displayName:
|
|
9
|
-
email:
|
|
10
|
-
roles:
|
|
11
|
-
}
|
|
12
|
-
displayName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
13
|
-
email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
|
-
roles: import("yup/lib/array").OptionalArraySchema<Yup.AnySchema, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
15
|
-
}>>>;
|
|
3
|
+
export declare const UserYupSchema: Yup.ObjectSchema<{
|
|
4
|
+
displayName: string;
|
|
5
|
+
email: string;
|
|
6
|
+
roles: any[] | undefined;
|
|
7
|
+
}, Yup.AnyObject, {
|
|
8
|
+
displayName: undefined;
|
|
9
|
+
email: undefined;
|
|
10
|
+
roles: undefined;
|
|
11
|
+
}, "">;
|
|
16
12
|
export declare function UserDetailsForm({ open, user: userProp, handleClose }: {
|
|
17
13
|
open: boolean;
|
|
18
14
|
user?: User;
|
package/dist/index.es.js
CHANGED
|
@@ -3,7 +3,7 @@ import equal from "react-fast-compare";
|
|
|
3
3
|
import { removeUndefined, useAuthController, toSnakeCase, FieldCaption, ConfirmationDialog, useNavigationController, useSnackbarController, useCustomizationController, defaultDateFormat } from "@firecms/core";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { c } from "react-compiler-runtime";
|
|
6
|
-
import { getColorSchemeForSeed, Chip, TextField, TableRow, TableCell, Checkbox, Tooltip, Button, Typography, DialogTitle, TableHeader, Paper, Table, TableBody, SelectItem, Select, DialogContent, LoadingButton, DialogActions, Dialog, IconButton, DeleteIcon, CenteredView, AddIcon, Container, MultiSelectItem, MultiSelect } from "@firecms/ui";
|
|
6
|
+
import { getColorSchemeForSeed, Chip, TextField, TableRow, TableCell, Checkbox, Tooltip, Button, Typography, DialogTitle, TableHeader, Paper, Table, TableBody, SelectItem, Select, DialogContent, LoadingButton, DialogActions, Dialog, IconButton, DeleteIcon, CenteredView, AddIcon, Container, MultiSelectItem, MultiSelect, Avatar } from "@firecms/ui";
|
|
7
7
|
import * as Yup from "yup";
|
|
8
8
|
import { useCreateFormex, getIn, Formex } from "@firecms/formex";
|
|
9
9
|
import { format } from "date-fns";
|
|
@@ -348,11 +348,17 @@ function useBuildUserManagement({
|
|
|
348
348
|
}
|
|
349
349
|
const mgmtUser_0 = users.find((u_3) => u_3.email?.toLowerCase() === user_3?.email?.toLowerCase());
|
|
350
350
|
if (mgmtUser_0) {
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
const needsUidUpdate = mgmtUser_0.uid !== user_3.uid;
|
|
352
|
+
const needsPhotoUpdate = user_3.photoURL && mgmtUser_0.photoURL !== user_3.photoURL;
|
|
353
|
+
if (needsUidUpdate || needsPhotoUpdate) {
|
|
354
|
+
const updateReason = needsUidUpdate ? "uid" : "photoURL";
|
|
355
|
+
console.debug(`User ${updateReason} has changed, updating user in user management system`);
|
|
353
356
|
saveUser({
|
|
354
357
|
...mgmtUser_0,
|
|
355
|
-
uid: user_3.uid
|
|
358
|
+
uid: user_3.uid,
|
|
359
|
+
...needsPhotoUpdate ? {
|
|
360
|
+
photoURL: user_3.photoURL
|
|
361
|
+
} : {}
|
|
356
362
|
}).then(() => {
|
|
357
363
|
console.debug("User updated in user management system", mgmtUser_0);
|
|
358
364
|
}).catch((e_4) => {
|
|
@@ -618,7 +624,7 @@ function RolesDetailsForm(t0) {
|
|
|
618
624
|
React.useEffect(t5, t6);
|
|
619
625
|
let t7;
|
|
620
626
|
let t8;
|
|
621
|
-
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
627
|
+
if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
622
628
|
t7 = {
|
|
623
629
|
display: "flex",
|
|
624
630
|
flexDirection: "column",
|
|
@@ -713,7 +719,7 @@ function RolesDetailsForm(t0) {
|
|
|
713
719
|
t21 = $[42];
|
|
714
720
|
}
|
|
715
721
|
let t22;
|
|
716
|
-
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
722
|
+
if ($[43] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
717
723
|
t22 = /* @__PURE__ */ jsxs(TableHeader, { className: "rounded-md", children: [
|
|
718
724
|
/* @__PURE__ */ jsx(TableCell, {}),
|
|
719
725
|
/* @__PURE__ */ jsx(TableCell, { align: "center", children: "Create entities" }),
|
|
@@ -727,7 +733,7 @@ function RolesDetailsForm(t0) {
|
|
|
727
733
|
t22 = $[43];
|
|
728
734
|
}
|
|
729
735
|
let t23;
|
|
730
|
-
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
|
|
736
|
+
if ($[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
731
737
|
t23 = /* @__PURE__ */ jsx(TableCell, { scope: "row", children: /* @__PURE__ */ jsx("strong", { children: "All collections" }) });
|
|
732
738
|
$[44] = t23;
|
|
733
739
|
} else {
|
|
@@ -814,7 +820,7 @@ function RolesDetailsForm(t0) {
|
|
|
814
820
|
t39 = $[68];
|
|
815
821
|
}
|
|
816
822
|
let t40;
|
|
817
|
-
if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
|
|
823
|
+
if ($[69] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
818
824
|
t40 = /* @__PURE__ */ jsx(TableCell, { align: "center" });
|
|
819
825
|
$[69] = t40;
|
|
820
826
|
} else {
|
|
@@ -882,7 +888,7 @@ function RolesDetailsForm(t0) {
|
|
|
882
888
|
t43 = $[87];
|
|
883
889
|
}
|
|
884
890
|
let t44;
|
|
885
|
-
if ($[88] === Symbol.for("react.memo_cache_sentinel")) {
|
|
891
|
+
if ($[88] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
886
892
|
t44 = /* @__PURE__ */ jsx(FieldCaption, { children: "You can customise the permissions that the users related to this role can perform in the entities of each collection" });
|
|
887
893
|
$[88] = t44;
|
|
888
894
|
} else {
|
|
@@ -912,7 +918,7 @@ function RolesDetailsForm(t0) {
|
|
|
912
918
|
const t49 = isAdmin || values_0.config?.createCollections ? "true" : "false";
|
|
913
919
|
let t50;
|
|
914
920
|
let t51;
|
|
915
|
-
if ($[93] === Symbol.for("react.memo_cache_sentinel")) {
|
|
921
|
+
if ($[93] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
916
922
|
t50 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: " Yes " });
|
|
917
923
|
t51 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: " No " });
|
|
918
924
|
$[93] = t50;
|
|
@@ -970,7 +976,7 @@ function RolesDetailsForm(t0) {
|
|
|
970
976
|
let t60;
|
|
971
977
|
let t61;
|
|
972
978
|
let t62;
|
|
973
|
-
if ($[107] === Symbol.for("react.memo_cache_sentinel")) {
|
|
979
|
+
if ($[107] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
974
980
|
t60 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: " Yes " });
|
|
975
981
|
t61 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: " No " });
|
|
976
982
|
t62 = /* @__PURE__ */ jsx(SelectItem, { value: "own", children: " Only his/her own " });
|
|
@@ -1032,7 +1038,7 @@ function RolesDetailsForm(t0) {
|
|
|
1032
1038
|
let t71;
|
|
1033
1039
|
let t72;
|
|
1034
1040
|
let t73;
|
|
1035
|
-
if ($[122] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1041
|
+
if ($[122] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1036
1042
|
t71 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: " Yes " });
|
|
1037
1043
|
t72 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: " No " });
|
|
1038
1044
|
t73 = /* @__PURE__ */ jsx(SelectItem, { value: "own", children: " Only his/her own " });
|
|
@@ -1110,7 +1116,7 @@ function RolesDetailsForm(t0) {
|
|
|
1110
1116
|
}
|
|
1111
1117
|
let t80;
|
|
1112
1118
|
if ($[144] !== handleClose) {
|
|
1113
|
-
t80 = /* @__PURE__ */ jsx(Button, { variant: "text",
|
|
1119
|
+
t80 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
|
|
1114
1120
|
handleClose();
|
|
1115
1121
|
}, children: "Cancel" });
|
|
1116
1122
|
$[144] = handleClose;
|
|
@@ -1122,7 +1128,7 @@ function RolesDetailsForm(t0) {
|
|
|
1122
1128
|
const t82 = isNewRole ? "Create role" : "Update";
|
|
1123
1129
|
let t83;
|
|
1124
1130
|
if ($[146] !== isSubmitting || $[147] !== t81 || $[148] !== t82) {
|
|
1125
|
-
t83 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled",
|
|
1131
|
+
t83 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t81, loading: isSubmitting, children: t82 });
|
|
1126
1132
|
$[146] = isSubmitting;
|
|
1127
1133
|
$[147] = t81;
|
|
1128
1134
|
$[148] = t82;
|
|
@@ -1247,7 +1253,7 @@ function RolesTable(t0) {
|
|
|
1247
1253
|
const [roleToBeDeleted, setRoleToBeDeleted] = useState(void 0);
|
|
1248
1254
|
const [deleteInProgress, setDeleteInProgress] = useState(false);
|
|
1249
1255
|
let t1;
|
|
1250
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1256
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1251
1257
|
t1 = /* @__PURE__ */ jsxs(TableHeader, { children: [
|
|
1252
1258
|
/* @__PURE__ */ jsx(TableCell, { header: true, className: "w-16" }),
|
|
1253
1259
|
/* @__PURE__ */ jsx(TableCell, { header: true, children: "Role" }),
|
|
@@ -1295,7 +1301,7 @@ function RolesTable(t0) {
|
|
|
1295
1301
|
if ($[5] !== allowDefaultRolesCreation || $[6] !== roles || $[7] !== saveRole) {
|
|
1296
1302
|
t3 = (!roles || roles.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 4, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
|
|
1297
1303
|
/* @__PURE__ */ jsx(Typography, { variant: "label", children: "You don't have any roles yet." }),
|
|
1298
|
-
allowDefaultRolesCreation && /* @__PURE__ */ jsx(Button, {
|
|
1304
|
+
allowDefaultRolesCreation && /* @__PURE__ */ jsx(Button, { onClick: () => {
|
|
1299
1305
|
DEFAULT_ROLES.forEach((role_0) => {
|
|
1300
1306
|
saveRole(role_0);
|
|
1301
1307
|
});
|
|
@@ -1345,7 +1351,7 @@ function RolesTable(t0) {
|
|
|
1345
1351
|
let t7;
|
|
1346
1352
|
let t8;
|
|
1347
1353
|
let t9;
|
|
1348
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1354
|
+
if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1349
1355
|
t7 = () => {
|
|
1350
1356
|
setRoleToBeDeleted(void 0);
|
|
1351
1357
|
};
|
|
@@ -1394,7 +1400,7 @@ const RolesView = React.memo(function RolesView2(t0) {
|
|
|
1394
1400
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
1395
1401
|
const [selectedRole, setSelectedRole] = useState();
|
|
1396
1402
|
let t1;
|
|
1397
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1403
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1398
1404
|
t1 = (user) => {
|
|
1399
1405
|
setDialogOpen(true);
|
|
1400
1406
|
setSelectedRole(user);
|
|
@@ -1405,7 +1411,7 @@ const RolesView = React.memo(function RolesView2(t0) {
|
|
|
1405
1411
|
}
|
|
1406
1412
|
const onRoleClicked = t1;
|
|
1407
1413
|
let t2;
|
|
1408
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1414
|
+
if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1409
1415
|
t2 = () => {
|
|
1410
1416
|
setSelectedRole(void 0);
|
|
1411
1417
|
setDialogOpen(false);
|
|
@@ -1416,7 +1422,7 @@ const RolesView = React.memo(function RolesView2(t0) {
|
|
|
1416
1422
|
}
|
|
1417
1423
|
const handleClose = t2;
|
|
1418
1424
|
let t3;
|
|
1419
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1425
|
+
if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1420
1426
|
t3 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Roles" });
|
|
1421
1427
|
$[2] = t3;
|
|
1422
1428
|
} else {
|
|
@@ -1424,7 +1430,7 @@ const RolesView = React.memo(function RolesView2(t0) {
|
|
|
1424
1430
|
}
|
|
1425
1431
|
let t4;
|
|
1426
1432
|
let t5;
|
|
1427
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1433
|
+
if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1428
1434
|
t4 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
|
|
1429
1435
|
t3,
|
|
1430
1436
|
/* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
|
|
@@ -1590,7 +1596,7 @@ function UserDetailsForm(t0) {
|
|
|
1590
1596
|
}
|
|
1591
1597
|
let t6;
|
|
1592
1598
|
let t7;
|
|
1593
|
-
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1599
|
+
if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1594
1600
|
t6 = {
|
|
1595
1601
|
display: "flex",
|
|
1596
1602
|
flexDirection: "column",
|
|
@@ -1721,7 +1727,7 @@ function UserDetailsForm(t0) {
|
|
|
1721
1727
|
}
|
|
1722
1728
|
let t25;
|
|
1723
1729
|
if ($[53] !== handleClose) {
|
|
1724
|
-
t25 = /* @__PURE__ */ jsx(Button, { variant: "text",
|
|
1730
|
+
t25 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
|
|
1725
1731
|
handleClose();
|
|
1726
1732
|
}, children: "Cancel" });
|
|
1727
1733
|
$[53] = handleClose;
|
|
@@ -1733,7 +1739,7 @@ function UserDetailsForm(t0) {
|
|
|
1733
1739
|
const t27 = isNewUser ? "Create user" : "Update";
|
|
1734
1740
|
let t28;
|
|
1735
1741
|
if ($[55] !== isSubmitting || $[56] !== t26 || $[57] !== t27) {
|
|
1736
|
-
t28 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled",
|
|
1742
|
+
t28 = /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: t26, loading: isSubmitting, children: t27 });
|
|
1737
1743
|
$[55] = isSubmitting;
|
|
1738
1744
|
$[56] = t26;
|
|
1739
1745
|
$[57] = t27;
|
|
@@ -1830,13 +1836,14 @@ function UsersTable(t0) {
|
|
|
1830
1836
|
const [userToBeDeleted, setUserToBeDeleted] = useState(void 0);
|
|
1831
1837
|
const [deleteInProgress, setDeleteInProgress] = useState(false);
|
|
1832
1838
|
let t1;
|
|
1833
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1839
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1834
1840
|
t1 = /* @__PURE__ */ jsxs(TableHeader, { children: [
|
|
1835
|
-
/* @__PURE__ */ jsx(TableCell, { className: "
|
|
1841
|
+
/* @__PURE__ */ jsx(TableCell, { className: "w-12" }),
|
|
1836
1842
|
/* @__PURE__ */ jsx(TableCell, { children: "Email" }),
|
|
1837
1843
|
/* @__PURE__ */ jsx(TableCell, { children: "Name" }),
|
|
1838
1844
|
/* @__PURE__ */ jsx(TableCell, { children: "Roles" }),
|
|
1839
|
-
/* @__PURE__ */ jsx(TableCell, { children: "Created on" })
|
|
1845
|
+
/* @__PURE__ */ jsx(TableCell, { children: "Created on" }),
|
|
1846
|
+
/* @__PURE__ */ jsx(TableCell, { className: "w-12" })
|
|
1840
1847
|
] });
|
|
1841
1848
|
$[0] = t1;
|
|
1842
1849
|
} else {
|
|
@@ -1852,14 +1859,15 @@ function UsersTable(t0) {
|
|
|
1852
1859
|
return /* @__PURE__ */ jsxs(TableRow, { onClick: () => {
|
|
1853
1860
|
onUserClicked(user);
|
|
1854
1861
|
}, children: [
|
|
1855
|
-
/* @__PURE__ */ jsx(TableCell, { className: "w-
|
|
1856
|
-
event.stopPropagation();
|
|
1857
|
-
return setUserToBeDeleted(user);
|
|
1858
|
-
}, children: /* @__PURE__ */ jsx(DeleteIcon, {}) }) }) }),
|
|
1862
|
+
/* @__PURE__ */ jsx(TableCell, { className: "w-12", children: /* @__PURE__ */ jsx(Avatar, { src: user.photoURL ?? void 0, outerClassName: "w-8 h-8 min-w-8 min-h-8 p-0", className: "text-sm", hover: false, children: user.displayName ? user.displayName[0].toUpperCase() : user.email ? user.email[0].toUpperCase() : "U" }) }),
|
|
1859
1863
|
/* @__PURE__ */ jsx(TableCell, { children: user.email }),
|
|
1860
1864
|
/* @__PURE__ */ jsx(TableCell, { className: "font-medium align-left", children: user.displayName }),
|
|
1861
1865
|
/* @__PURE__ */ jsx(TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
|
|
1862
|
-
/* @__PURE__ */ jsx(TableCell, { children: formattedDate })
|
|
1866
|
+
/* @__PURE__ */ jsx(TableCell, { children: formattedDate }),
|
|
1867
|
+
/* @__PURE__ */ jsx(TableCell, { className: "w-12", children: /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: "Delete this user", children: /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: (event) => {
|
|
1868
|
+
event.stopPropagation();
|
|
1869
|
+
return setUserToBeDeleted(user);
|
|
1870
|
+
}, children: /* @__PURE__ */ jsx(DeleteIcon, { size: "small" }) }) }) })
|
|
1863
1871
|
] }, "row_" + user.uid);
|
|
1864
1872
|
});
|
|
1865
1873
|
$[1] = dateFormat;
|
|
@@ -1874,7 +1882,7 @@ function UsersTable(t0) {
|
|
|
1874
1882
|
if ($[6] !== authController || $[7] !== saveUser || $[8] !== snackbarController || $[9] !== users) {
|
|
1875
1883
|
t3 = (!users || users.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 6, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
|
|
1876
1884
|
/* @__PURE__ */ jsx(Typography, { variant: "label", children: "There are no users yet" }),
|
|
1877
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1885
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => {
|
|
1878
1886
|
if (!authController.user?.uid) {
|
|
1879
1887
|
throw Error("UsersTable, authController misconfiguration");
|
|
1880
1888
|
}
|
|
@@ -1954,7 +1962,7 @@ function UsersTable(t0) {
|
|
|
1954
1962
|
let t7;
|
|
1955
1963
|
let t8;
|
|
1956
1964
|
let t9;
|
|
1957
|
-
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1965
|
+
if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1958
1966
|
t7 = () => {
|
|
1959
1967
|
setUserToBeDeleted(void 0);
|
|
1960
1968
|
};
|
|
@@ -2005,7 +2013,7 @@ const UsersView = function UsersView2(t0) {
|
|
|
2005
2013
|
const [newFormKey, setNewFormKey] = useState(0);
|
|
2006
2014
|
useUserManagement();
|
|
2007
2015
|
let t1;
|
|
2008
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2016
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2009
2017
|
t1 = (user) => {
|
|
2010
2018
|
setSelectedUser(user);
|
|
2011
2019
|
setDialogOpen(true);
|
|
@@ -2016,7 +2024,7 @@ const UsersView = function UsersView2(t0) {
|
|
|
2016
2024
|
}
|
|
2017
2025
|
const onUserClicked = t1;
|
|
2018
2026
|
let t2;
|
|
2019
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2027
|
+
if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2020
2028
|
t2 = () => {
|
|
2021
2029
|
setDialogOpen(false);
|
|
2022
2030
|
setSelectedUser(void 0);
|
|
@@ -2027,7 +2035,7 @@ const UsersView = function UsersView2(t0) {
|
|
|
2027
2035
|
}
|
|
2028
2036
|
const handleClose = t2;
|
|
2029
2037
|
let t3;
|
|
2030
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2038
|
+
if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2031
2039
|
t3 = () => {
|
|
2032
2040
|
setSelectedUser(void 0);
|
|
2033
2041
|
setNewFormKey(_temp);
|
|
@@ -2039,7 +2047,7 @@ const UsersView = function UsersView2(t0) {
|
|
|
2039
2047
|
}
|
|
2040
2048
|
const handleAddUser = t3;
|
|
2041
2049
|
let t4;
|
|
2042
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2050
|
+
if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2043
2051
|
t4 = /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "flex-grow", component: "h4", children: "Users" });
|
|
2044
2052
|
$[3] = t4;
|
|
2045
2053
|
} else {
|
|
@@ -2047,7 +2055,7 @@ const UsersView = function UsersView2(t0) {
|
|
|
2047
2055
|
}
|
|
2048
2056
|
let t5;
|
|
2049
2057
|
let t6;
|
|
2050
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2058
|
+
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2051
2059
|
t5 = /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12", children: [
|
|
2052
2060
|
t4,
|
|
2053
2061
|
/* @__PURE__ */ jsx(Button, { size: "large", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleAddUser, children: "Add user" })
|
|
@@ -2170,7 +2178,7 @@ function IntroWidget(t0) {
|
|
|
2170
2178
|
const buttonLabel = noUsers && noRoles ? "Create default roles and add current user as admin" : noUsers ? "Add current user as admin" : noRoles ? "Create default roles" : void 0;
|
|
2171
2179
|
let t1;
|
|
2172
2180
|
let t2;
|
|
2173
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2181
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2174
2182
|
t1 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "uppercase", children: "Create your users and roles" });
|
|
2175
2183
|
t2 = /* @__PURE__ */ jsx(Typography, { children: "You have no users or roles defined. You can create default roles and add the current user as admin." });
|
|
2176
2184
|
$[0] = t1;
|
|
@@ -2231,7 +2239,7 @@ function IntroWidget(t0) {
|
|
|
2231
2239
|
t3 = $[12];
|
|
2232
2240
|
}
|
|
2233
2241
|
let t4;
|
|
2234
|
-
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2242
|
+
if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2235
2243
|
t4 = /* @__PURE__ */ jsx(AddIcon, {});
|
|
2236
2244
|
$[13] = t4;
|
|
2237
2245
|
} else {
|
|
@@ -2242,7 +2250,7 @@ function IntroWidget(t0) {
|
|
|
2242
2250
|
t5 = /* @__PURE__ */ jsxs(Paper, { className: "my-4 flex flex-col px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
|
|
2243
2251
|
t1,
|
|
2244
2252
|
t2,
|
|
2245
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
2253
|
+
/* @__PURE__ */ jsxs(Button, { onClick: t3, children: [
|
|
2246
2254
|
t4,
|
|
2247
2255
|
buttonLabel
|
|
2248
2256
|
] })
|
|
@@ -2269,6 +2277,7 @@ const userManagementAdminViews = [{
|
|
|
2269
2277
|
view: /* @__PURE__ */ jsx(RolesView, {})
|
|
2270
2278
|
}];
|
|
2271
2279
|
export {
|
|
2280
|
+
DEFAULT_ROLES,
|
|
2272
2281
|
IntroWidget,
|
|
2273
2282
|
RESERVED_GROUPS,
|
|
2274
2283
|
RoleChip,
|