strapi-plugin-oidc 1.8.3 → 1.8.5
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/README.md +22 -3
- package/dist/admin/{index-Bb9-aYb4.mjs → index-BlfNZYVU.mjs} +1 -1
- package/dist/admin/{index-Dk6TYtio.js → index-C8nfr95D.js} +1 -1
- package/dist/admin/{index-Bmg4eTYb.js → index-DDCcJt16.js} +183 -179
- package/dist/admin/{index-BqWd-Iiq.mjs → index-DRFXk_MQ.mjs} +183 -179
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +231 -219
- package/dist/server/index.mjs +232 -220
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { useState, useRef, useId, useEffect, useCallback, useReducer, useMemo, m
|
|
|
5
5
|
import { Typography, Flex, Box, MultiSelect, MultiSelectOption, Button, Dialog, Table, Pagination, PreviousLink, NextLink, PageLink, Field, Divider, Thead, Tr, Th, Tbody, Td, IconButton, Loader, Tooltip, Alert } from "@strapi/design-system";
|
|
6
6
|
import { Cross, WarningCircle, Plus, Download, Upload, Trash, Calendar, Mail, Information } from "@strapi/icons";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
|
-
import { g as getTrad } from "./index-
|
|
8
|
+
import { g as getTrad } from "./index-BlfNZYVU.mjs";
|
|
9
9
|
import styled from "styled-components";
|
|
10
10
|
import { Filter, ClipboardList, Server } from "lucide-react";
|
|
11
11
|
function Role({ oidcRoles, roles, onChangeRole }) {
|
|
@@ -848,7 +848,7 @@ function TablePagination({ page, pageCount, onPageChange, total }) {
|
|
|
848
848
|
] }) });
|
|
849
849
|
}
|
|
850
850
|
const PAGE_SIZE$1 = 10;
|
|
851
|
-
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
851
|
+
const EMAIL_REGEX$1 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
852
852
|
function Whitelist({
|
|
853
853
|
users,
|
|
854
854
|
useWhitelist,
|
|
@@ -889,7 +889,7 @@ function Whitelist({
|
|
|
889
889
|
if (!Array.isArray(parsed)) throw new Error();
|
|
890
890
|
const emails = parsed.filter((item) => item?.email).map(
|
|
891
891
|
(item) => String(item.email).trim().toLowerCase()
|
|
892
|
-
).filter((email2) => EMAIL_REGEX.test(email2));
|
|
892
|
+
).filter((email2) => EMAIL_REGEX$1.test(email2));
|
|
893
893
|
const count = await onImport(emails);
|
|
894
894
|
if (count === 0) {
|
|
895
895
|
toggleNotification({
|
|
@@ -931,7 +931,7 @@ function Whitelist({
|
|
|
931
931
|
type: "text",
|
|
932
932
|
disabled: loading,
|
|
933
933
|
value: email,
|
|
934
|
-
hasError: Boolean(email && !EMAIL_REGEX.test(email)),
|
|
934
|
+
hasError: Boolean(email && !EMAIL_REGEX$1.test(email)),
|
|
935
935
|
onChange: (e) => setEmail(e.currentTarget.value),
|
|
936
936
|
placeholder: formatMessage(getTrad("whitelist.email.placeholder")),
|
|
937
937
|
style: { fontSize: "1.4rem", lineHeight: "2.2rem" }
|
|
@@ -942,7 +942,7 @@ function Whitelist({
|
|
|
942
942
|
{
|
|
943
943
|
size: "S",
|
|
944
944
|
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
945
|
-
disabled: loading || email.trim() === "" || !EMAIL_REGEX.test(email),
|
|
945
|
+
disabled: loading || email.trim() === "" || !EMAIL_REGEX$1.test(email),
|
|
946
946
|
loading,
|
|
947
947
|
onClick: onSaveEmail,
|
|
948
948
|
children: formatMessage(getTrad("page.add"))
|
|
@@ -1062,6 +1062,153 @@ function Whitelist({
|
|
|
1062
1062
|
] })
|
|
1063
1063
|
] });
|
|
1064
1064
|
}
|
|
1065
|
+
const AUDIT_ACTIONS = [
|
|
1066
|
+
"login_success",
|
|
1067
|
+
"login_failure",
|
|
1068
|
+
"missing_code",
|
|
1069
|
+
"state_mismatch",
|
|
1070
|
+
"nonce_mismatch",
|
|
1071
|
+
"token_exchange_failed",
|
|
1072
|
+
"whitelist_rejected",
|
|
1073
|
+
"email_not_verified",
|
|
1074
|
+
"id_token_invalid",
|
|
1075
|
+
"logout",
|
|
1076
|
+
"session_expired",
|
|
1077
|
+
"user_created"
|
|
1078
|
+
];
|
|
1079
|
+
const IP_REGEX = /^(?:(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,6}|:(?::[0-9a-fA-F]{1,4}){1,7}|::))$/;
|
|
1080
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1081
|
+
function FilterBar({
|
|
1082
|
+
filters,
|
|
1083
|
+
hasActiveFilters,
|
|
1084
|
+
onFiltersChange,
|
|
1085
|
+
onResetPage,
|
|
1086
|
+
onClear
|
|
1087
|
+
}) {
|
|
1088
|
+
const { formatMessage } = useIntl();
|
|
1089
|
+
return /* @__PURE__ */ jsxs(
|
|
1090
|
+
Box,
|
|
1091
|
+
{
|
|
1092
|
+
background: "neutral100",
|
|
1093
|
+
hasRadius: true,
|
|
1094
|
+
padding: 4,
|
|
1095
|
+
marginBottom: 4,
|
|
1096
|
+
borderColor: "neutral200",
|
|
1097
|
+
borderWidth: "1px",
|
|
1098
|
+
borderStyle: "solid",
|
|
1099
|
+
children: [
|
|
1100
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", marginBottom: 3, children: [
|
|
1101
|
+
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Filter, { size: "1.6rem" }) }),
|
|
1102
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h3", children: formatMessage(getTrad("auditlog.filters")) })
|
|
1103
|
+
] }),
|
|
1104
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", children: [
|
|
1105
|
+
/* @__PURE__ */ jsx(
|
|
1106
|
+
TagDateInput,
|
|
1107
|
+
{
|
|
1108
|
+
placeholder: formatMessage(getTrad("auditlog.filters.createdAt")),
|
|
1109
|
+
value: filters.createdAt ?? [],
|
|
1110
|
+
onChange: (selections) => {
|
|
1111
|
+
onFiltersChange((prev) => {
|
|
1112
|
+
if (selections.length === 0) {
|
|
1113
|
+
const { createdAt, ...rest } = prev;
|
|
1114
|
+
return rest;
|
|
1115
|
+
}
|
|
1116
|
+
return { ...prev, createdAt: selections };
|
|
1117
|
+
});
|
|
1118
|
+
onResetPage();
|
|
1119
|
+
},
|
|
1120
|
+
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Calendar, { width: "1.4rem", height: "1.4rem" }) })
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ jsx(
|
|
1124
|
+
TagInput,
|
|
1125
|
+
{
|
|
1126
|
+
value: filters.action ?? [],
|
|
1127
|
+
onChange: (value) => onFiltersChange((prev) => ({ ...prev, action: value })),
|
|
1128
|
+
options: AUDIT_ACTIONS,
|
|
1129
|
+
placeholder: formatMessage(getTrad("auditlog.filters.action")),
|
|
1130
|
+
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ClipboardList, { size: "1.4rem" }) })
|
|
1131
|
+
}
|
|
1132
|
+
),
|
|
1133
|
+
/* @__PURE__ */ jsx(
|
|
1134
|
+
TagInput,
|
|
1135
|
+
{
|
|
1136
|
+
value: filters.email ?? [],
|
|
1137
|
+
onChange: (value) => onFiltersChange((prev) => ({ ...prev, email: value })),
|
|
1138
|
+
placeholder: formatMessage(getTrad("auditlog.filters.email")),
|
|
1139
|
+
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Mail, { width: "1.4rem", height: "1.4rem" }) }),
|
|
1140
|
+
validate: (v) => EMAIL_REGEX.test(v)
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ jsx(
|
|
1144
|
+
TagInput,
|
|
1145
|
+
{
|
|
1146
|
+
value: filters.ip ?? [],
|
|
1147
|
+
onChange: (value) => onFiltersChange((prev) => ({ ...prev, ip: value })),
|
|
1148
|
+
placeholder: formatMessage(getTrad("auditlog.filters.ip")),
|
|
1149
|
+
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Server, { size: "1.4rem" }) }),
|
|
1150
|
+
validate: (v) => IP_REGEX.test(v)
|
|
1151
|
+
}
|
|
1152
|
+
),
|
|
1153
|
+
hasActiveFilters && /* @__PURE__ */ jsx(SizedButton, { size: "S", variant: "danger-light", startIcon: /* @__PURE__ */ jsx(Trash, {}), onClick: onClear, children: formatMessage(getTrad("auditlog.filters.clear")) })
|
|
1154
|
+
] })
|
|
1155
|
+
]
|
|
1156
|
+
}
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
const DETAILS_TEXT_STYLE = {
|
|
1160
|
+
display: "block",
|
|
1161
|
+
overflow: "hidden",
|
|
1162
|
+
textOverflow: "ellipsis",
|
|
1163
|
+
whiteSpace: "nowrap",
|
|
1164
|
+
maxWidth: "180px",
|
|
1165
|
+
cursor: "help"
|
|
1166
|
+
};
|
|
1167
|
+
function LogTable({ records, loading, hasActiveFilters }) {
|
|
1168
|
+
const { formatMessage } = useIntl();
|
|
1169
|
+
return /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%" }, children: [
|
|
1170
|
+
/* @__PURE__ */ jsxs(CustomTable, { colCount: 5, rowCount: records.length, children: [
|
|
1171
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
1172
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.timestamp")) }),
|
|
1173
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.action")) }),
|
|
1174
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.email")) }),
|
|
1175
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.ip")) }),
|
|
1176
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.details")) })
|
|
1177
|
+
] }) }),
|
|
1178
|
+
/* @__PURE__ */ jsxs(Tbody, { children: [
|
|
1179
|
+
records.length === 0 && /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 5, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "80px" }, children: loading ? /* @__PURE__ */ jsx(Loader, { small: true }) : /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: hasActiveFilters ? formatMessage(getTrad("auditlog.filters.empty")) : formatMessage(getTrad("auditlog.table.empty")) }) }) }) }),
|
|
1180
|
+
records.map((record) => /* @__PURE__ */ jsxs(Tr, { style: { opacity: loading ? 0.4 : 1, transition: "opacity 0.15s" }, children: [
|
|
1181
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: /* @__PURE__ */ jsx(LocalizedDate, { date: record.createdAt, options: { second: "2-digit" } }) }) }),
|
|
1182
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
|
|
1183
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: record.action }),
|
|
1184
|
+
/* @__PURE__ */ jsx(Tooltip, { label: formatMessage(getTrad(`auditlog.action.${record.action}`)), children: /* @__PURE__ */ jsx(
|
|
1185
|
+
Information,
|
|
1186
|
+
{
|
|
1187
|
+
"aria-hidden": true,
|
|
1188
|
+
style: { cursor: "help" },
|
|
1189
|
+
width: "1.4rem",
|
|
1190
|
+
height: "1.4rem",
|
|
1191
|
+
fill: "primary600"
|
|
1192
|
+
}
|
|
1193
|
+
) })
|
|
1194
|
+
] }) }),
|
|
1195
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: record.email ?? "—" }) }),
|
|
1196
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: record.ip ?? "—" }) }),
|
|
1197
|
+
/* @__PURE__ */ jsx(Td, { style: { maxWidth: "200px" }, children: record.details ? /* @__PURE__ */ jsx(Tooltip, { label: record.details, side: "top", children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", style: DETAILS_TEXT_STYLE, children: record.details }) }) : /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "—" }) })
|
|
1198
|
+
] }, record.id))
|
|
1199
|
+
] })
|
|
1200
|
+
] }),
|
|
1201
|
+
loading && records.length > 0 && /* @__PURE__ */ jsx(
|
|
1202
|
+
Flex,
|
|
1203
|
+
{
|
|
1204
|
+
justifyContent: "center",
|
|
1205
|
+
alignItems: "center",
|
|
1206
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
1207
|
+
children: /* @__PURE__ */ jsx(Loader, { small: true })
|
|
1208
|
+
}
|
|
1209
|
+
)
|
|
1210
|
+
] });
|
|
1211
|
+
}
|
|
1065
1212
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1066
1213
|
function getDefaultExportFromCjs(x) {
|
|
1067
1214
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -3603,30 +3750,6 @@ function requireLib() {
|
|
|
3603
3750
|
}
|
|
3604
3751
|
var libExports = /* @__PURE__ */ requireLib();
|
|
3605
3752
|
const qs = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
3606
|
-
const AUDIT_ACTIONS = [
|
|
3607
|
-
"login_success",
|
|
3608
|
-
"login_failure",
|
|
3609
|
-
"missing_code",
|
|
3610
|
-
"state_mismatch",
|
|
3611
|
-
"nonce_mismatch",
|
|
3612
|
-
"token_exchange_failed",
|
|
3613
|
-
"whitelist_rejected",
|
|
3614
|
-
"email_not_verified",
|
|
3615
|
-
"id_token_invalid",
|
|
3616
|
-
"logout",
|
|
3617
|
-
"session_expired",
|
|
3618
|
-
"user_created"
|
|
3619
|
-
];
|
|
3620
|
-
const PAGE_SIZE = 10;
|
|
3621
|
-
const MIN_SPINNER_MS = 400;
|
|
3622
|
-
const DETAILS_TEXT_STYLE = {
|
|
3623
|
-
display: "block",
|
|
3624
|
-
overflow: "hidden",
|
|
3625
|
-
textOverflow: "ellipsis",
|
|
3626
|
-
whiteSpace: "nowrap",
|
|
3627
|
-
maxWidth: "180px",
|
|
3628
|
-
cursor: "help"
|
|
3629
|
-
};
|
|
3630
3753
|
function toWireFilters(f) {
|
|
3631
3754
|
const out = {};
|
|
3632
3755
|
if (f.action?.length) out.action = { $or: f.action.map((v) => ({ $eq: v })) };
|
|
@@ -3643,11 +3766,11 @@ function buildQueryString(params) {
|
|
|
3643
3766
|
const { filters, ...rest } = params;
|
|
3644
3767
|
return qs.stringify(
|
|
3645
3768
|
{ ...rest, filters: filters ? toWireFilters(filters) : void 0 },
|
|
3646
|
-
{
|
|
3647
|
-
encodeValuesOnly: true
|
|
3648
|
-
}
|
|
3769
|
+
{ encodeValuesOnly: true }
|
|
3649
3770
|
);
|
|
3650
3771
|
}
|
|
3772
|
+
const PAGE_SIZE = 10;
|
|
3773
|
+
const MIN_SPINNER_MS = 400;
|
|
3651
3774
|
function useDebounced(value, delay = 300) {
|
|
3652
3775
|
const [debounced, setDebounced] = useState(value);
|
|
3653
3776
|
useEffect(() => {
|
|
@@ -3656,10 +3779,8 @@ function useDebounced(value, delay = 300) {
|
|
|
3656
3779
|
}, [value, delay]);
|
|
3657
3780
|
return debounced;
|
|
3658
3781
|
}
|
|
3659
|
-
function
|
|
3660
|
-
const {
|
|
3661
|
-
const { get: get2, del } = useFetchClient();
|
|
3662
|
-
const { toggleNotification } = useNotification();
|
|
3782
|
+
function useAuditLogs(page, filters) {
|
|
3783
|
+
const { get: get2 } = useFetchClient();
|
|
3663
3784
|
const [records, setRecords] = useState([]);
|
|
3664
3785
|
const [pagination, setPagination] = useState({
|
|
3665
3786
|
page: 1,
|
|
@@ -3667,9 +3788,7 @@ function AuditLog({ title } = {}) {
|
|
|
3667
3788
|
total: 0,
|
|
3668
3789
|
pageCount: 1
|
|
3669
3790
|
});
|
|
3670
|
-
const [page, setPage] = useState(1);
|
|
3671
3791
|
const [loading, setLoading] = useState(true);
|
|
3672
|
-
const [filters, setFilters] = useState({});
|
|
3673
3792
|
const fetchGenRef = useRef(0);
|
|
3674
3793
|
const debouncedFilters = useDebounced(filters);
|
|
3675
3794
|
const fetchLogs = useCallback(
|
|
@@ -3703,6 +3822,15 @@ function AuditLog({ title } = {}) {
|
|
|
3703
3822
|
useEffect(() => {
|
|
3704
3823
|
fetchLogs(page, debouncedFilters);
|
|
3705
3824
|
}, [fetchLogs, page, debouncedFilters]);
|
|
3825
|
+
return { records, pagination, loading };
|
|
3826
|
+
}
|
|
3827
|
+
function AuditLog({ title } = {}) {
|
|
3828
|
+
const { formatMessage } = useIntl();
|
|
3829
|
+
const { del } = useFetchClient();
|
|
3830
|
+
const { toggleNotification } = useNotification();
|
|
3831
|
+
const [page, setPage] = useState(1);
|
|
3832
|
+
const [filters, setFilters] = useState({});
|
|
3833
|
+
const { records, pagination, loading } = useAuditLogs(page, filters);
|
|
3706
3834
|
const handleClearAll = async () => {
|
|
3707
3835
|
try {
|
|
3708
3836
|
await del("/strapi-plugin-oidc/audit-logs");
|
|
@@ -3723,9 +3851,7 @@ function AuditLog({ title } = {}) {
|
|
|
3723
3851
|
try {
|
|
3724
3852
|
const cookieMatch = document.cookie.match(/(?:^|;\s*)jwtToken=([^;]+)/);
|
|
3725
3853
|
const token = cookieMatch ? decodeURIComponent(cookieMatch[1]) : "";
|
|
3726
|
-
const queryString = buildQueryString({
|
|
3727
|
-
filters
|
|
3728
|
-
});
|
|
3854
|
+
const queryString = buildQueryString({ filters });
|
|
3729
3855
|
const response = await fetch(`/strapi-plugin-oidc/audit-logs/export?${queryString}`, {
|
|
3730
3856
|
headers: { Authorization: `Bearer ${token}` }
|
|
3731
3857
|
});
|
|
@@ -3793,135 +3919,17 @@ function AuditLog({ title } = {}) {
|
|
|
3793
3919
|
)
|
|
3794
3920
|
] })
|
|
3795
3921
|
] }),
|
|
3796
|
-
/* @__PURE__ */
|
|
3797
|
-
|
|
3922
|
+
/* @__PURE__ */ jsx(
|
|
3923
|
+
FilterBar,
|
|
3798
3924
|
{
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
borderWidth: "1px",
|
|
3805
|
-
borderStyle: "solid",
|
|
3806
|
-
children: [
|
|
3807
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", marginBottom: 3, children: [
|
|
3808
|
-
/* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Filter, { size: "1.6rem" }) }),
|
|
3809
|
-
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h3", children: formatMessage(getTrad("auditlog.filters")) })
|
|
3810
|
-
] }),
|
|
3811
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", children: [
|
|
3812
|
-
/* @__PURE__ */ jsx(
|
|
3813
|
-
TagDateInput,
|
|
3814
|
-
{
|
|
3815
|
-
placeholder: formatMessage(getTrad("auditlog.filters.createdAt")),
|
|
3816
|
-
value: filters.createdAt ?? [],
|
|
3817
|
-
onChange: (selections) => {
|
|
3818
|
-
setFilters((prev) => {
|
|
3819
|
-
if (selections.length === 0) {
|
|
3820
|
-
const { createdAt: _removed, ...rest } = prev;
|
|
3821
|
-
return rest;
|
|
3822
|
-
}
|
|
3823
|
-
return { ...prev, createdAt: selections };
|
|
3824
|
-
});
|
|
3825
|
-
setPage(1);
|
|
3826
|
-
},
|
|
3827
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Calendar, { width: "1.4rem", height: "1.4rem" }) })
|
|
3828
|
-
}
|
|
3829
|
-
),
|
|
3830
|
-
/* @__PURE__ */ jsx(
|
|
3831
|
-
TagInput,
|
|
3832
|
-
{
|
|
3833
|
-
value: filters.action ?? [],
|
|
3834
|
-
onChange: (value) => setFilters((prev) => ({ ...prev, action: value })),
|
|
3835
|
-
options: AUDIT_ACTIONS,
|
|
3836
|
-
placeholder: formatMessage(getTrad("auditlog.filters.action")),
|
|
3837
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(ClipboardList, { size: "1.4rem" }) })
|
|
3838
|
-
}
|
|
3839
|
-
),
|
|
3840
|
-
/* @__PURE__ */ jsx(
|
|
3841
|
-
TagInput,
|
|
3842
|
-
{
|
|
3843
|
-
value: filters.email ?? [],
|
|
3844
|
-
onChange: (value) => setFilters((prev) => ({ ...prev, email: value })),
|
|
3845
|
-
placeholder: formatMessage(getTrad("auditlog.filters.email")),
|
|
3846
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Mail, { width: "1.4rem", height: "1.4rem" }) }),
|
|
3847
|
-
validate: (v) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v)
|
|
3848
|
-
}
|
|
3849
|
-
),
|
|
3850
|
-
/* @__PURE__ */ jsx(
|
|
3851
|
-
TagInput,
|
|
3852
|
-
{
|
|
3853
|
-
value: filters.ip ?? [],
|
|
3854
|
-
onChange: (value) => setFilters((prev) => ({ ...prev, ip: value })),
|
|
3855
|
-
placeholder: formatMessage(getTrad("auditlog.filters.ip")),
|
|
3856
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { children: /* @__PURE__ */ jsx(Server, { size: "1.4rem" }) }),
|
|
3857
|
-
validate: (v) => /^(?:(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?::[0-9a-fA-F]{1,4}){1,6}|:(?::[0-9a-fA-F]{1,4}){1,7}|::))$/.test(
|
|
3858
|
-
v
|
|
3859
|
-
)
|
|
3860
|
-
}
|
|
3861
|
-
),
|
|
3862
|
-
hasActiveFilters && /* @__PURE__ */ jsx(
|
|
3863
|
-
SizedButton,
|
|
3864
|
-
{
|
|
3865
|
-
size: "S",
|
|
3866
|
-
variant: "danger-light",
|
|
3867
|
-
startIcon: /* @__PURE__ */ jsx(Trash, {}),
|
|
3868
|
-
onClick: clearFilters,
|
|
3869
|
-
children: formatMessage(getTrad("auditlog.filters.clear"))
|
|
3870
|
-
}
|
|
3871
|
-
)
|
|
3872
|
-
] })
|
|
3873
|
-
]
|
|
3925
|
+
filters,
|
|
3926
|
+
hasActiveFilters,
|
|
3927
|
+
onFiltersChange: setFilters,
|
|
3928
|
+
onResetPage: () => setPage(1),
|
|
3929
|
+
onClear: clearFilters
|
|
3874
3930
|
}
|
|
3875
3931
|
),
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */ jsxs(CustomTable, { colCount: 5, rowCount: records.length, children: [
|
|
3878
|
-
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
3879
|
-
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.timestamp")) }),
|
|
3880
|
-
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.action")) }),
|
|
3881
|
-
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.email")) }),
|
|
3882
|
-
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.ip")) }),
|
|
3883
|
-
/* @__PURE__ */ jsx(Th, { children: formatMessage(getTrad("auditlog.table.details")) })
|
|
3884
|
-
] }) }),
|
|
3885
|
-
/* @__PURE__ */ jsxs(Tbody, { children: [
|
|
3886
|
-
records.length === 0 && /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 5, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "80px" }, children: loading ? /* @__PURE__ */ jsx(Loader, { small: true }) : /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: hasActiveFilters ? formatMessage(getTrad("auditlog.filters.empty")) : formatMessage(getTrad("auditlog.table.empty")) }) }) }) }),
|
|
3887
|
-
records.map((record) => /* @__PURE__ */ jsxs(
|
|
3888
|
-
Tr,
|
|
3889
|
-
{
|
|
3890
|
-
style: { opacity: loading ? 0.4 : 1, transition: "opacity 0.15s" },
|
|
3891
|
-
children: [
|
|
3892
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: /* @__PURE__ */ jsx(LocalizedDate, { date: record.createdAt, options: { second: "2-digit" } }) }) }),
|
|
3893
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
|
|
3894
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: record.action }),
|
|
3895
|
-
/* @__PURE__ */ jsx(Tooltip, { label: formatMessage(getTrad(`auditlog.action.${record.action}`)), children: /* @__PURE__ */ jsx(
|
|
3896
|
-
Information,
|
|
3897
|
-
{
|
|
3898
|
-
"aria-hidden": true,
|
|
3899
|
-
style: { cursor: "help" },
|
|
3900
|
-
width: "1.4rem",
|
|
3901
|
-
height: "1.4rem",
|
|
3902
|
-
fill: "primary600"
|
|
3903
|
-
}
|
|
3904
|
-
) })
|
|
3905
|
-
] }) }),
|
|
3906
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: record.email ?? "—" }) }),
|
|
3907
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: record.ip ?? "—" }) }),
|
|
3908
|
-
/* @__PURE__ */ jsx(Td, { style: { maxWidth: "200px" }, children: record.details ? /* @__PURE__ */ jsx(Tooltip, { label: record.details, side: "top", children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", style: DETAILS_TEXT_STYLE, children: record.details }) }) : /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "—" }) })
|
|
3909
|
-
]
|
|
3910
|
-
},
|
|
3911
|
-
record.id
|
|
3912
|
-
))
|
|
3913
|
-
] })
|
|
3914
|
-
] }),
|
|
3915
|
-
loading && records.length > 0 && /* @__PURE__ */ jsx(
|
|
3916
|
-
Flex,
|
|
3917
|
-
{
|
|
3918
|
-
justifyContent: "center",
|
|
3919
|
-
alignItems: "center",
|
|
3920
|
-
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
3921
|
-
children: /* @__PURE__ */ jsx(Loader, { small: true })
|
|
3922
|
-
}
|
|
3923
|
-
)
|
|
3924
|
-
] }),
|
|
3932
|
+
/* @__PURE__ */ jsx(LogTable, { records, loading, hasActiveFilters }),
|
|
3925
3933
|
/* @__PURE__ */ jsx(
|
|
3926
3934
|
TablePagination,
|
|
3927
3935
|
{
|
|
@@ -4055,19 +4063,15 @@ function downloadJson(basename, data) {
|
|
|
4055
4063
|
a.click();
|
|
4056
4064
|
URL.revokeObjectURL(url);
|
|
4057
4065
|
}
|
|
4066
|
+
const defaultSnapshot = {
|
|
4067
|
+
oidcRoles: [],
|
|
4068
|
+
users: [],
|
|
4069
|
+
useWhitelist: false,
|
|
4070
|
+
enforceOIDC: false
|
|
4071
|
+
};
|
|
4058
4072
|
const initialState = {
|
|
4059
|
-
current: {
|
|
4060
|
-
|
|
4061
|
-
users: [],
|
|
4062
|
-
useWhitelist: false,
|
|
4063
|
-
enforceOIDC: false
|
|
4064
|
-
},
|
|
4065
|
-
initial: {
|
|
4066
|
-
oidcRoles: [],
|
|
4067
|
-
users: [],
|
|
4068
|
-
useWhitelist: false,
|
|
4069
|
-
enforceOIDC: false
|
|
4070
|
-
},
|
|
4073
|
+
current: { ...defaultSnapshot },
|
|
4074
|
+
initial: { ...defaultSnapshot },
|
|
4071
4075
|
roles: [],
|
|
4072
4076
|
enforceOIDCConfig: null,
|
|
4073
4077
|
auditLogEnabled: true,
|
package/dist/admin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-C8nfr95D.js");
|
|
4
4
|
require("react");
|
|
5
5
|
require("react-dom/client");
|
|
6
6
|
exports.default = index.index;
|
package/dist/admin/index.mjs
CHANGED