strapi-plugin-magic-sessionmanager 4.15.0 → 4.16.0
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/CHANGELOG.md +39 -0
- package/README.md +91 -7
- package/dist/admin/{Analytics-HK6_TEmk.mjs → Analytics-D4gsVwL0.mjs} +1 -1
- package/dist/admin/{Analytics-Dbs5QXLb.js → Analytics-me4qzS0I.js} +1 -1
- package/dist/admin/{App-BOFzZ5d8.mjs → App-BJwtFWxl.mjs} +863 -81
- package/dist/admin/{App-7SxOBJP5.js → App-BTG-2Q26.js} +862 -80
- package/dist/admin/{OnlineUsersWidget-Dns_74xJ.js → OnlineUsersWidget-DYS3Vy1Q.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-CoCxnww-.mjs → OnlineUsersWidget-Yd283YDy.mjs} +1 -1
- package/dist/admin/{Settings-DYRShQ8W.mjs → Settings-DIlvfdjZ.mjs} +170 -19
- package/dist/admin/{Settings-B6CrR-07.js → Settings-TPZ9_75s.js} +169 -18
- package/dist/admin/{de-bkkCvSxX.js → de-BuMw1gBJ.js} +92 -2
- package/dist/admin/{de-B3mPtxsW.mjs → de-DB9ldYwN.mjs} +92 -2
- package/dist/admin/{en-BnU8BNkN.mjs → en-BbLMPQB3.mjs} +92 -2
- package/dist/admin/{en-DMICyIow.js → en-BqGhOJDy.js} +92 -2
- package/dist/admin/{es-OSzHGRIu.js → es-BaIeckl9.js} +92 -2
- package/dist/admin/{es-BxMgfJ1Y.mjs → es-C5iaiE9G.mjs} +92 -2
- package/dist/admin/{fr-WPrbtx8k.mjs → fr-BEvBUCwI.mjs} +92 -2
- package/dist/admin/{fr-Bu_8miJ4.js → fr-D1YKyTex.js} +92 -2
- package/dist/admin/{index-CNSJITRX.js → index-CgZiLcJ1.js} +13 -10
- package/dist/admin/{index-lnZBc5n0.mjs → index-DUESEUaO.mjs} +13 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-C41KyEDN.mjs → pt-DeDih9cR.mjs} +92 -2
- package/dist/admin/{pt-B08xnb0K.js → pt-DtnW-s0V.js} +92 -2
- package/dist/server/index.js +1917 -103
- package/dist/server/index.mjs +1917 -103
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ const styled = require("styled-components");
|
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-CgZiLcJ1.js");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
function _interopNamespace(e) {
|
|
13
13
|
if (e && e.__esModule) return e;
|
|
@@ -6,7 +6,7 @@ import { Flex, Loader, Button, Box, Typography } from "@strapi/design-system";
|
|
|
6
6
|
import { User, Lightning, Clock, Lock, WarningCircle } from "@strapi/icons";
|
|
7
7
|
import * as StrapiAdmin from "@strapi/strapi/admin";
|
|
8
8
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
9
|
-
import { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-
|
|
9
|
+
import { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-DUESEUaO.mjs";
|
|
10
10
|
function normalizeUserCounts(response) {
|
|
11
11
|
const totalUsers = response?.data?.totalUsers;
|
|
12
12
|
const blockedUsers = response?.data?.blockedUsers;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, createContext, useContext, useMemo, useId, Fragment, useRef, useEffect, useLayoutEffect } from "react";
|
|
3
3
|
import { Field, Typography, Switch, Box, TextInput, Flex, Button, Link, SingleSelect, SingleSelectOption, Accordion, Alert, Badge, Radio, Dialog, Tag, Combobox, ComboboxOption, NumberInput, Divider, Tabs, Textarea, Checkbox } from "@strapi/design-system";
|
|
4
|
-
import { ConfirmDialog, useNotification, useFetchClient, useQueryParams, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
|
|
4
|
+
import { ConfirmDialog, useNotification, useFetchClient, useQueryParams, useRBAC, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
|
|
5
5
|
import { EyeStriked, Eye, Key, Duplicate, Cross, Plus, Trash, Download, Check } from "@strapi/icons";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
-
import { F as ReadableParagraphs, b as getTranslation, m as logSafeAdminError, R as ReadableText, G as EqualGrid, n as PersistentAlert, P as PropertyList, H as formatSessionDate, C as ConfirmAction, I as refocusIfLost, l as pluginId, s as isCancelledRequest, J as requireSuccessfulMutation, w as PageShell } from "./index-
|
|
7
|
+
import { F as ReadableParagraphs, b as getTranslation, m as logSafeAdminError, R as ReadableText, G as EqualGrid, n as PersistentAlert, P as PropertyList, H as formatSessionDate, C as ConfirmAction, I as refocusIfLost, l as pluginId, s as isCancelledRequest, J as requireSuccessfulMutation, o as pluginPermissions, w as PageShell } from "./index-DUESEUaO.mjs";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
9
|
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
10
10
|
import { g as getRiskAvailability, r as riskDependentControl } from "./riskData-CI1gm2yI.mjs";
|
|
@@ -13,15 +13,18 @@ const SETTINGS_TAB_IDS = Object.freeze([
|
|
|
13
13
|
"login-protection",
|
|
14
14
|
"location-data",
|
|
15
15
|
"alerts",
|
|
16
|
-
"data-retention"
|
|
16
|
+
"data-retention",
|
|
17
|
+
"admin-activity"
|
|
17
18
|
]);
|
|
19
|
+
const PERMISSION_GATED_TABS = Object.freeze(["admin-activity"]);
|
|
18
20
|
const DEFAULT_SETTINGS_TAB = "sessions";
|
|
19
21
|
const SETTINGS_TAB_LABELS = Object.freeze({
|
|
20
22
|
sessions: ["settings.config.tab.sessions", "Sessions"],
|
|
21
23
|
"login-protection": ["settings.config.tab.loginProtection", "Login protection"],
|
|
22
24
|
"location-data": ["settings.config.tab.locationData", "Location data"],
|
|
23
25
|
alerts: ["settings.config.tab.alerts", "Alerts"],
|
|
24
|
-
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"]
|
|
26
|
+
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"],
|
|
27
|
+
"admin-activity": ["settings.config.tab.adminActivity", "Admin activity"]
|
|
25
28
|
});
|
|
26
29
|
const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
27
30
|
sessions: [
|
|
@@ -58,7 +61,14 @@ const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
|
58
61
|
"discordWebhookUrl",
|
|
59
62
|
"slackWebhookUrl"
|
|
60
63
|
],
|
|
61
|
-
"data-retention": ["retentionDays"]
|
|
64
|
+
"data-retention": ["retentionDays"],
|
|
65
|
+
"admin-activity": [
|
|
66
|
+
"adminSignInHistory",
|
|
67
|
+
"adminContentActivity",
|
|
68
|
+
"securityLogStoreIp",
|
|
69
|
+
"securityLogAnonymizeIp",
|
|
70
|
+
"securityLogRetentionDays"
|
|
71
|
+
]
|
|
62
72
|
});
|
|
63
73
|
const PRESERVED_SETTINGS_KEYS = Object.freeze([
|
|
64
74
|
"rateLimitWriteMax",
|
|
@@ -101,7 +111,21 @@ const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
|
101
111
|
enableWebhooks: ["settings.config.webhooks.enable.label", "Send team notifications"],
|
|
102
112
|
discordWebhookUrl: ["settings.config.webhooks.discord.label", "Discord webhook URL"],
|
|
103
113
|
slackWebhookUrl: ["settings.config.webhooks.slack.label", "Slack webhook URL"],
|
|
104
|
-
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"]
|
|
114
|
+
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"],
|
|
115
|
+
adminSignInHistory: ["settings.config.adminActivity.signIns.label", "Record admin sign-ins"],
|
|
116
|
+
adminContentActivity: [
|
|
117
|
+
"settings.config.adminActivity.content.label",
|
|
118
|
+
"Record Content Manager activity"
|
|
119
|
+
],
|
|
120
|
+
securityLogStoreIp: ["settings.config.adminActivity.storeIp.label", "Store IP addresses"],
|
|
121
|
+
securityLogAnonymizeIp: [
|
|
122
|
+
"settings.config.adminActivity.anonymize.label",
|
|
123
|
+
"Anonymise the last part of IP addresses"
|
|
124
|
+
],
|
|
125
|
+
securityLogRetentionDays: [
|
|
126
|
+
"settings.config.adminActivity.retention.label",
|
|
127
|
+
"Keep security events for"
|
|
128
|
+
]
|
|
105
129
|
});
|
|
106
130
|
const SELECT_PRESETS = Object.freeze({
|
|
107
131
|
inactivityTimeout: Object.freeze([5, 10, 15, 30, 60, 120]),
|
|
@@ -109,11 +133,17 @@ const SELECT_PRESETS = Object.freeze({
|
|
|
109
133
|
lastSeenRateLimit: Object.freeze([10, 30, 60, 120, 300]),
|
|
110
134
|
cleanupInterval: Object.freeze([15, 30, 60, 120]),
|
|
111
135
|
sessionCreationGraceMs: Object.freeze([0, 2e3, 5e3, 1e4, 3e4]),
|
|
112
|
-
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1])
|
|
136
|
+
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1]),
|
|
137
|
+
securityLogRetentionDays: Object.freeze([7, 30, 90, 180, 365])
|
|
113
138
|
});
|
|
114
|
-
function resolveSettingsTab(value) {
|
|
139
|
+
function resolveSettingsTab(value, tabs = SETTINGS_TAB_IDS) {
|
|
115
140
|
const candidate = Array.isArray(value) ? value[0] : value;
|
|
116
|
-
return
|
|
141
|
+
return tabs.includes(candidate) ? candidate : DEFAULT_SETTINGS_TAB;
|
|
142
|
+
}
|
|
143
|
+
function getVisibleSettingsTabs(canViewAdminActivity) {
|
|
144
|
+
return SETTINGS_TAB_IDS.filter(
|
|
145
|
+
(tab) => canViewAdminActivity || !PERMISSION_GATED_TABS.includes(tab)
|
|
146
|
+
);
|
|
117
147
|
}
|
|
118
148
|
function buildTabSearch(search, tab) {
|
|
119
149
|
const params = new URLSearchParams(typeof search === "string" ? search : "");
|
|
@@ -1375,7 +1405,12 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
1375
1405
|
blockedCountries: [],
|
|
1376
1406
|
geoIpProvider: "auto",
|
|
1377
1407
|
geoIpDatabasePath: "",
|
|
1378
|
-
geoLookupFailureMode: "auto"
|
|
1408
|
+
geoLookupFailureMode: "auto",
|
|
1409
|
+
adminSignInHistory: true,
|
|
1410
|
+
adminContentActivity: false,
|
|
1411
|
+
securityLogStoreIp: true,
|
|
1412
|
+
securityLogAnonymizeIp: false,
|
|
1413
|
+
securityLogRetentionDays: 90
|
|
1379
1414
|
});
|
|
1380
1415
|
const MAX_FAILED_LOGINS_RANGE = Object.freeze({ min: 0, max: 100 });
|
|
1381
1416
|
const WEBHOOK_HOSTS = Object.freeze({
|
|
@@ -3247,6 +3282,111 @@ const DataRetentionTab = ({ form }) => {
|
|
|
3247
3282
|
)
|
|
3248
3283
|
] });
|
|
3249
3284
|
};
|
|
3285
|
+
const AdminActivityTab = ({ form }) => {
|
|
3286
|
+
const { t } = useSettingsTranslate();
|
|
3287
|
+
const units = useOptionLabels();
|
|
3288
|
+
const { settings, handleChange } = form;
|
|
3289
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3290
|
+
/* @__PURE__ */ jsx(IntroText, { children: t(
|
|
3291
|
+
"settings.config.adminActivity.intro",
|
|
3292
|
+
"The security log records sign-ins and work in this admin panel. Each admin’s history is under Session Manager > Admin panel; only admins with “View admin activity” can open it."
|
|
3293
|
+
) }),
|
|
3294
|
+
/* @__PURE__ */ jsxs(SectionCard, { title: t("settings.config.adminActivity.recording.title", "What is recorded"), children: [
|
|
3295
|
+
/* @__PURE__ */ jsx(
|
|
3296
|
+
SettingsToggleRow,
|
|
3297
|
+
{
|
|
3298
|
+
id: "admin-sign-in-history",
|
|
3299
|
+
title: t("settings.config.adminActivity.signIns.label", "Record admin sign-ins"),
|
|
3300
|
+
description: t(
|
|
3301
|
+
"settings.config.adminActivity.signIns.hint",
|
|
3302
|
+
"Every sign-in, failed attempt, lockout and sign-out, and who signed out whom, with time, browser and operating system."
|
|
3303
|
+
),
|
|
3304
|
+
checked: settings.adminSignInHistory,
|
|
3305
|
+
onChange: (checked) => handleChange("adminSignInHistory", checked)
|
|
3306
|
+
}
|
|
3307
|
+
),
|
|
3308
|
+
/* @__PURE__ */ jsx(
|
|
3309
|
+
SettingsToggleRow,
|
|
3310
|
+
{
|
|
3311
|
+
id: "admin-content-activity",
|
|
3312
|
+
title: t(
|
|
3313
|
+
"settings.config.adminActivity.content.label",
|
|
3314
|
+
"Record Content Manager activity"
|
|
3315
|
+
),
|
|
3316
|
+
description: t(
|
|
3317
|
+
"settings.config.adminActivity.content.hint",
|
|
3318
|
+
"Which entries each admin opens, creates, edits, publishes, unpublishes or deletes, with content type, title, locale and time."
|
|
3319
|
+
),
|
|
3320
|
+
checked: settings.adminContentActivity,
|
|
3321
|
+
onChange: (checked) => handleChange("adminContentActivity", checked),
|
|
3322
|
+
children: /* @__PURE__ */ jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
|
|
3323
|
+
"settings.config.adminActivity.content.notice",
|
|
3324
|
+
"This records how people work. In many countries employees must be told first, and in Germany the works council usually has a say. Check this before you turn it on."
|
|
3325
|
+
) })
|
|
3326
|
+
}
|
|
3327
|
+
)
|
|
3328
|
+
] }),
|
|
3329
|
+
/* @__PURE__ */ jsxs(
|
|
3330
|
+
SectionCard,
|
|
3331
|
+
{
|
|
3332
|
+
title: t("settings.config.adminActivity.privacy.title", "IP addresses and retention"),
|
|
3333
|
+
subtitle: t(
|
|
3334
|
+
"settings.config.adminActivity.privacy.subtitle",
|
|
3335
|
+
"These options apply to every event in the security log."
|
|
3336
|
+
),
|
|
3337
|
+
children: [
|
|
3338
|
+
/* @__PURE__ */ jsx(
|
|
3339
|
+
SettingsToggleRow,
|
|
3340
|
+
{
|
|
3341
|
+
id: "security-log-store-ip",
|
|
3342
|
+
title: t("settings.config.adminActivity.storeIp.label", "Store IP addresses"),
|
|
3343
|
+
description: t(
|
|
3344
|
+
"settings.config.adminActivity.storeIp.hint",
|
|
3345
|
+
"The address comes from Strapi’s client IP (server.proxy settings). The location uses the IP location lookup under Location data."
|
|
3346
|
+
),
|
|
3347
|
+
checked: settings.securityLogStoreIp,
|
|
3348
|
+
onChange: (checked) => handleChange("securityLogStoreIp", checked)
|
|
3349
|
+
}
|
|
3350
|
+
),
|
|
3351
|
+
/* @__PURE__ */ jsx(
|
|
3352
|
+
SettingsToggleRow,
|
|
3353
|
+
{
|
|
3354
|
+
id: "security-log-anonymize-ip",
|
|
3355
|
+
title: t(
|
|
3356
|
+
"settings.config.adminActivity.anonymize.label",
|
|
3357
|
+
"Anonymise the last part of IP addresses"
|
|
3358
|
+
),
|
|
3359
|
+
description: t(
|
|
3360
|
+
"settings.config.adminActivity.anonymize.hint",
|
|
3361
|
+
"Stores 203.0.113.0 instead of 203.0.113.42 (IPv6: the first 48 bits only)."
|
|
3362
|
+
),
|
|
3363
|
+
checked: settings.securityLogAnonymizeIp,
|
|
3364
|
+
disabled: !settings.securityLogStoreIp,
|
|
3365
|
+
onChange: (checked) => handleChange("securityLogAnonymizeIp", checked),
|
|
3366
|
+
children: !settings.securityLogStoreIp ? /* @__PURE__ */ jsx(RequiresNotice, { children: t("settings.config.adminActivity.requiresIp", "Requires Store IP addresses") }) : null
|
|
3367
|
+
}
|
|
3368
|
+
),
|
|
3369
|
+
/* @__PURE__ */ jsx(EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsx(
|
|
3370
|
+
PresetSelect,
|
|
3371
|
+
{
|
|
3372
|
+
id: "security-log-retention",
|
|
3373
|
+
name: "securityLogRetentionDays",
|
|
3374
|
+
label: t("settings.config.adminActivity.retention.label", "Keep security events for"),
|
|
3375
|
+
description: t(
|
|
3376
|
+
"settings.config.adminActivity.retention.hint",
|
|
3377
|
+
"Older events are deleted once a day. Events of a deleted admin are deleted with the account."
|
|
3378
|
+
),
|
|
3379
|
+
value: settings.securityLogRetentionDays,
|
|
3380
|
+
presets: SELECT_PRESETS.securityLogRetentionDays,
|
|
3381
|
+
format: units.days,
|
|
3382
|
+
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
3383
|
+
}
|
|
3384
|
+
) })
|
|
3385
|
+
]
|
|
3386
|
+
}
|
|
3387
|
+
)
|
|
3388
|
+
] });
|
|
3389
|
+
};
|
|
3250
3390
|
async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
|
|
3251
3391
|
if (typeof value !== "string") {
|
|
3252
3392
|
throw new TypeError("clipboard_value_must_be_text");
|
|
@@ -3619,7 +3759,8 @@ const TAB_COMPONENTS = {
|
|
|
3619
3759
|
"login-protection": LoginProtectionTab,
|
|
3620
3760
|
"location-data": LocationDataTab,
|
|
3621
3761
|
alerts: AlertsTab,
|
|
3622
|
-
"data-retention": DataRetentionTab
|
|
3762
|
+
"data-retention": DataRetentionTab,
|
|
3763
|
+
"admin-activity": AdminActivityTab
|
|
3623
3764
|
};
|
|
3624
3765
|
const DraftSync = ({ values }) => {
|
|
3625
3766
|
const setValues = useForm("DraftSync", (state) => state.setValues);
|
|
@@ -3639,7 +3780,14 @@ const SettingsPage = () => {
|
|
|
3639
3780
|
const { t } = useSettingsTranslate();
|
|
3640
3781
|
const form = useSettingsForm();
|
|
3641
3782
|
const [{ query }] = useQueryParams();
|
|
3642
|
-
const
|
|
3783
|
+
const {
|
|
3784
|
+
allowedActions: { canRead: canViewAdminActivity }
|
|
3785
|
+
} = useRBAC(pluginPermissions.adminActivityRead);
|
|
3786
|
+
const visibleTabs = useMemo(
|
|
3787
|
+
() => getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
3788
|
+
[canViewAdminActivity]
|
|
3789
|
+
);
|
|
3790
|
+
const requestedTab = resolveSettingsTab(query?.tab, visibleTabs);
|
|
3643
3791
|
const [activeTab, setActiveTab] = useState(requestedTab);
|
|
3644
3792
|
const [followedTab, setFollowedTab] = useState(requestedTab);
|
|
3645
3793
|
const tabsRef = useRef(null);
|
|
@@ -3666,11 +3814,14 @@ const SettingsPage = () => {
|
|
|
3666
3814
|
const handleSaveClick = useCallback(async () => {
|
|
3667
3815
|
if (await handleSave()) focusActiveTab();
|
|
3668
3816
|
}, [handleSave, focusActiveTab]);
|
|
3669
|
-
const changeTab = useCallback(
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3817
|
+
const changeTab = useCallback(
|
|
3818
|
+
(tab) => {
|
|
3819
|
+
const next = resolveSettingsTab(tab, visibleTabs);
|
|
3820
|
+
setActiveTab(next);
|
|
3821
|
+
writeTabToAddressBar(next);
|
|
3822
|
+
},
|
|
3823
|
+
[visibleTabs]
|
|
3824
|
+
);
|
|
3674
3825
|
const navigation = useMemo(
|
|
3675
3826
|
() => ({
|
|
3676
3827
|
selectTab: (tab) => {
|
|
@@ -3755,10 +3906,10 @@ const SettingsPage = () => {
|
|
|
3755
3906
|
SettingsTabsList,
|
|
3756
3907
|
{
|
|
3757
3908
|
"aria-label": t("settings.config.tabs.label", "Configuration sections"),
|
|
3758
|
-
children:
|
|
3909
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsx(SettingsTabLabel, { children: t(SETTINGS_TAB_LABELS[tab][0], SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
3759
3910
|
}
|
|
3760
3911
|
),
|
|
3761
|
-
|
|
3912
|
+
visibleTabs.map((tab) => {
|
|
3762
3913
|
const TabPanel = TAB_COMPONENTS[tab];
|
|
3763
3914
|
return /* @__PURE__ */ jsx(Tabs.Content, { value: tab, forceMount: true, hidden: activeTab !== tab, children: /* @__PURE__ */ jsx(TabPanelFrame, { "data-settings-tab-panel": "", children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", paddingTop: 6, children: /* @__PURE__ */ jsx(TabPanel, { form }) }) }) }, tab);
|
|
3764
3915
|
}),
|
|
@@ -6,7 +6,7 @@ const designSystem = require("@strapi/design-system");
|
|
|
6
6
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
const styled = require("styled-components");
|
|
9
|
-
const index = require("./index-
|
|
9
|
+
const index = require("./index-CgZiLcJ1.js");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
12
|
const riskData = require("./riskData-BVs9GpgD.js");
|
|
@@ -17,15 +17,18 @@ const SETTINGS_TAB_IDS = Object.freeze([
|
|
|
17
17
|
"login-protection",
|
|
18
18
|
"location-data",
|
|
19
19
|
"alerts",
|
|
20
|
-
"data-retention"
|
|
20
|
+
"data-retention",
|
|
21
|
+
"admin-activity"
|
|
21
22
|
]);
|
|
23
|
+
const PERMISSION_GATED_TABS = Object.freeze(["admin-activity"]);
|
|
22
24
|
const DEFAULT_SETTINGS_TAB = "sessions";
|
|
23
25
|
const SETTINGS_TAB_LABELS = Object.freeze({
|
|
24
26
|
sessions: ["settings.config.tab.sessions", "Sessions"],
|
|
25
27
|
"login-protection": ["settings.config.tab.loginProtection", "Login protection"],
|
|
26
28
|
"location-data": ["settings.config.tab.locationData", "Location data"],
|
|
27
29
|
alerts: ["settings.config.tab.alerts", "Alerts"],
|
|
28
|
-
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"]
|
|
30
|
+
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"],
|
|
31
|
+
"admin-activity": ["settings.config.tab.adminActivity", "Admin activity"]
|
|
29
32
|
});
|
|
30
33
|
const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
31
34
|
sessions: [
|
|
@@ -62,7 +65,14 @@ const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
|
62
65
|
"discordWebhookUrl",
|
|
63
66
|
"slackWebhookUrl"
|
|
64
67
|
],
|
|
65
|
-
"data-retention": ["retentionDays"]
|
|
68
|
+
"data-retention": ["retentionDays"],
|
|
69
|
+
"admin-activity": [
|
|
70
|
+
"adminSignInHistory",
|
|
71
|
+
"adminContentActivity",
|
|
72
|
+
"securityLogStoreIp",
|
|
73
|
+
"securityLogAnonymizeIp",
|
|
74
|
+
"securityLogRetentionDays"
|
|
75
|
+
]
|
|
66
76
|
});
|
|
67
77
|
const PRESERVED_SETTINGS_KEYS = Object.freeze([
|
|
68
78
|
"rateLimitWriteMax",
|
|
@@ -105,7 +115,21 @@ const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
|
105
115
|
enableWebhooks: ["settings.config.webhooks.enable.label", "Send team notifications"],
|
|
106
116
|
discordWebhookUrl: ["settings.config.webhooks.discord.label", "Discord webhook URL"],
|
|
107
117
|
slackWebhookUrl: ["settings.config.webhooks.slack.label", "Slack webhook URL"],
|
|
108
|
-
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"]
|
|
118
|
+
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"],
|
|
119
|
+
adminSignInHistory: ["settings.config.adminActivity.signIns.label", "Record admin sign-ins"],
|
|
120
|
+
adminContentActivity: [
|
|
121
|
+
"settings.config.adminActivity.content.label",
|
|
122
|
+
"Record Content Manager activity"
|
|
123
|
+
],
|
|
124
|
+
securityLogStoreIp: ["settings.config.adminActivity.storeIp.label", "Store IP addresses"],
|
|
125
|
+
securityLogAnonymizeIp: [
|
|
126
|
+
"settings.config.adminActivity.anonymize.label",
|
|
127
|
+
"Anonymise the last part of IP addresses"
|
|
128
|
+
],
|
|
129
|
+
securityLogRetentionDays: [
|
|
130
|
+
"settings.config.adminActivity.retention.label",
|
|
131
|
+
"Keep security events for"
|
|
132
|
+
]
|
|
109
133
|
});
|
|
110
134
|
const SELECT_PRESETS = Object.freeze({
|
|
111
135
|
inactivityTimeout: Object.freeze([5, 10, 15, 30, 60, 120]),
|
|
@@ -113,11 +137,17 @@ const SELECT_PRESETS = Object.freeze({
|
|
|
113
137
|
lastSeenRateLimit: Object.freeze([10, 30, 60, 120, 300]),
|
|
114
138
|
cleanupInterval: Object.freeze([15, 30, 60, 120]),
|
|
115
139
|
sessionCreationGraceMs: Object.freeze([0, 2e3, 5e3, 1e4, 3e4]),
|
|
116
|
-
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1])
|
|
140
|
+
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1]),
|
|
141
|
+
securityLogRetentionDays: Object.freeze([7, 30, 90, 180, 365])
|
|
117
142
|
});
|
|
118
|
-
function resolveSettingsTab(value) {
|
|
143
|
+
function resolveSettingsTab(value, tabs = SETTINGS_TAB_IDS) {
|
|
119
144
|
const candidate = Array.isArray(value) ? value[0] : value;
|
|
120
|
-
return
|
|
145
|
+
return tabs.includes(candidate) ? candidate : DEFAULT_SETTINGS_TAB;
|
|
146
|
+
}
|
|
147
|
+
function getVisibleSettingsTabs(canViewAdminActivity) {
|
|
148
|
+
return SETTINGS_TAB_IDS.filter(
|
|
149
|
+
(tab) => canViewAdminActivity || !PERMISSION_GATED_TABS.includes(tab)
|
|
150
|
+
);
|
|
121
151
|
}
|
|
122
152
|
function buildTabSearch(search, tab) {
|
|
123
153
|
const params = new URLSearchParams(typeof search === "string" ? search : "");
|
|
@@ -1379,7 +1409,12 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
1379
1409
|
blockedCountries: [],
|
|
1380
1410
|
geoIpProvider: "auto",
|
|
1381
1411
|
geoIpDatabasePath: "",
|
|
1382
|
-
geoLookupFailureMode: "auto"
|
|
1412
|
+
geoLookupFailureMode: "auto",
|
|
1413
|
+
adminSignInHistory: true,
|
|
1414
|
+
adminContentActivity: false,
|
|
1415
|
+
securityLogStoreIp: true,
|
|
1416
|
+
securityLogAnonymizeIp: false,
|
|
1417
|
+
securityLogRetentionDays: 90
|
|
1383
1418
|
});
|
|
1384
1419
|
const MAX_FAILED_LOGINS_RANGE = Object.freeze({ min: 0, max: 100 });
|
|
1385
1420
|
const WEBHOOK_HOSTS = Object.freeze({
|
|
@@ -3251,6 +3286,111 @@ const DataRetentionTab = ({ form }) => {
|
|
|
3251
3286
|
)
|
|
3252
3287
|
] });
|
|
3253
3288
|
};
|
|
3289
|
+
const AdminActivityTab = ({ form }) => {
|
|
3290
|
+
const { t } = useSettingsTranslate();
|
|
3291
|
+
const units = useOptionLabels();
|
|
3292
|
+
const { settings, handleChange } = form;
|
|
3293
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3294
|
+
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
3295
|
+
"settings.config.adminActivity.intro",
|
|
3296
|
+
"The security log records sign-ins and work in this admin panel. Each admin’s history is under Session Manager > Admin panel; only admins with “View admin activity” can open it."
|
|
3297
|
+
) }),
|
|
3298
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SectionCard.SectionCard, { title: t("settings.config.adminActivity.recording.title", "What is recorded"), children: [
|
|
3299
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3300
|
+
SettingsToggleRow,
|
|
3301
|
+
{
|
|
3302
|
+
id: "admin-sign-in-history",
|
|
3303
|
+
title: t("settings.config.adminActivity.signIns.label", "Record admin sign-ins"),
|
|
3304
|
+
description: t(
|
|
3305
|
+
"settings.config.adminActivity.signIns.hint",
|
|
3306
|
+
"Every sign-in, failed attempt, lockout and sign-out, and who signed out whom, with time, browser and operating system."
|
|
3307
|
+
),
|
|
3308
|
+
checked: settings.adminSignInHistory,
|
|
3309
|
+
onChange: (checked) => handleChange("adminSignInHistory", checked)
|
|
3310
|
+
}
|
|
3311
|
+
),
|
|
3312
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3313
|
+
SettingsToggleRow,
|
|
3314
|
+
{
|
|
3315
|
+
id: "admin-content-activity",
|
|
3316
|
+
title: t(
|
|
3317
|
+
"settings.config.adminActivity.content.label",
|
|
3318
|
+
"Record Content Manager activity"
|
|
3319
|
+
),
|
|
3320
|
+
description: t(
|
|
3321
|
+
"settings.config.adminActivity.content.hint",
|
|
3322
|
+
"Which entries each admin opens, creates, edits, publishes, unpublishes or deletes, with content type, title, locale and time."
|
|
3323
|
+
),
|
|
3324
|
+
checked: settings.adminContentActivity,
|
|
3325
|
+
onChange: (checked) => handleChange("adminContentActivity", checked),
|
|
3326
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
|
|
3327
|
+
"settings.config.adminActivity.content.notice",
|
|
3328
|
+
"This records how people work. In many countries employees must be told first, and in Germany the works council usually has a say. Check this before you turn it on."
|
|
3329
|
+
) })
|
|
3330
|
+
}
|
|
3331
|
+
)
|
|
3332
|
+
] }),
|
|
3333
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3334
|
+
SectionCard.SectionCard,
|
|
3335
|
+
{
|
|
3336
|
+
title: t("settings.config.adminActivity.privacy.title", "IP addresses and retention"),
|
|
3337
|
+
subtitle: t(
|
|
3338
|
+
"settings.config.adminActivity.privacy.subtitle",
|
|
3339
|
+
"These options apply to every event in the security log."
|
|
3340
|
+
),
|
|
3341
|
+
children: [
|
|
3342
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3343
|
+
SettingsToggleRow,
|
|
3344
|
+
{
|
|
3345
|
+
id: "security-log-store-ip",
|
|
3346
|
+
title: t("settings.config.adminActivity.storeIp.label", "Store IP addresses"),
|
|
3347
|
+
description: t(
|
|
3348
|
+
"settings.config.adminActivity.storeIp.hint",
|
|
3349
|
+
"The address comes from Strapi’s client IP (server.proxy settings). The location uses the IP location lookup under Location data."
|
|
3350
|
+
),
|
|
3351
|
+
checked: settings.securityLogStoreIp,
|
|
3352
|
+
onChange: (checked) => handleChange("securityLogStoreIp", checked)
|
|
3353
|
+
}
|
|
3354
|
+
),
|
|
3355
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3356
|
+
SettingsToggleRow,
|
|
3357
|
+
{
|
|
3358
|
+
id: "security-log-anonymize-ip",
|
|
3359
|
+
title: t(
|
|
3360
|
+
"settings.config.adminActivity.anonymize.label",
|
|
3361
|
+
"Anonymise the last part of IP addresses"
|
|
3362
|
+
),
|
|
3363
|
+
description: t(
|
|
3364
|
+
"settings.config.adminActivity.anonymize.hint",
|
|
3365
|
+
"Stores 203.0.113.0 instead of 203.0.113.42 (IPv6: the first 48 bits only)."
|
|
3366
|
+
),
|
|
3367
|
+
checked: settings.securityLogAnonymizeIp,
|
|
3368
|
+
disabled: !settings.securityLogStoreIp,
|
|
3369
|
+
onChange: (checked) => handleChange("securityLogAnonymizeIp", checked),
|
|
3370
|
+
children: !settings.securityLogStoreIp ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.adminActivity.requiresIp", "Requires Store IP addresses") }) : null
|
|
3371
|
+
}
|
|
3372
|
+
),
|
|
3373
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
|
+
PresetSelect,
|
|
3375
|
+
{
|
|
3376
|
+
id: "security-log-retention",
|
|
3377
|
+
name: "securityLogRetentionDays",
|
|
3378
|
+
label: t("settings.config.adminActivity.retention.label", "Keep security events for"),
|
|
3379
|
+
description: t(
|
|
3380
|
+
"settings.config.adminActivity.retention.hint",
|
|
3381
|
+
"Older events are deleted once a day. Events of a deleted admin are deleted with the account."
|
|
3382
|
+
),
|
|
3383
|
+
value: settings.securityLogRetentionDays,
|
|
3384
|
+
presets: SELECT_PRESETS.securityLogRetentionDays,
|
|
3385
|
+
format: units.days,
|
|
3386
|
+
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
3387
|
+
}
|
|
3388
|
+
) })
|
|
3389
|
+
]
|
|
3390
|
+
}
|
|
3391
|
+
)
|
|
3392
|
+
] });
|
|
3393
|
+
};
|
|
3254
3394
|
async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
|
|
3255
3395
|
if (typeof value !== "string") {
|
|
3256
3396
|
throw new TypeError("clipboard_value_must_be_text");
|
|
@@ -3623,7 +3763,8 @@ const TAB_COMPONENTS = {
|
|
|
3623
3763
|
"login-protection": LoginProtectionTab,
|
|
3624
3764
|
"location-data": LocationDataTab,
|
|
3625
3765
|
alerts: AlertsTab,
|
|
3626
|
-
"data-retention": DataRetentionTab
|
|
3766
|
+
"data-retention": DataRetentionTab,
|
|
3767
|
+
"admin-activity": AdminActivityTab
|
|
3627
3768
|
};
|
|
3628
3769
|
const DraftSync = ({ values }) => {
|
|
3629
3770
|
const setValues = StrapiAdmin.useForm("DraftSync", (state) => state.setValues);
|
|
@@ -3643,7 +3784,14 @@ const SettingsPage = () => {
|
|
|
3643
3784
|
const { t } = useSettingsTranslate();
|
|
3644
3785
|
const form = useSettingsForm();
|
|
3645
3786
|
const [{ query }] = StrapiAdmin.useQueryParams();
|
|
3646
|
-
const
|
|
3787
|
+
const {
|
|
3788
|
+
allowedActions: { canRead: canViewAdminActivity }
|
|
3789
|
+
} = StrapiAdmin.useRBAC(index.pluginPermissions.adminActivityRead);
|
|
3790
|
+
const visibleTabs = react.useMemo(
|
|
3791
|
+
() => getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
3792
|
+
[canViewAdminActivity]
|
|
3793
|
+
);
|
|
3794
|
+
const requestedTab = resolveSettingsTab(query?.tab, visibleTabs);
|
|
3647
3795
|
const [activeTab, setActiveTab] = react.useState(requestedTab);
|
|
3648
3796
|
const [followedTab, setFollowedTab] = react.useState(requestedTab);
|
|
3649
3797
|
const tabsRef = react.useRef(null);
|
|
@@ -3670,11 +3818,14 @@ const SettingsPage = () => {
|
|
|
3670
3818
|
const handleSaveClick = react.useCallback(async () => {
|
|
3671
3819
|
if (await handleSave()) focusActiveTab();
|
|
3672
3820
|
}, [handleSave, focusActiveTab]);
|
|
3673
|
-
const changeTab = react.useCallback(
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3821
|
+
const changeTab = react.useCallback(
|
|
3822
|
+
(tab) => {
|
|
3823
|
+
const next = resolveSettingsTab(tab, visibleTabs);
|
|
3824
|
+
setActiveTab(next);
|
|
3825
|
+
writeTabToAddressBar(next);
|
|
3826
|
+
},
|
|
3827
|
+
[visibleTabs]
|
|
3828
|
+
);
|
|
3678
3829
|
const navigation = react.useMemo(
|
|
3679
3830
|
() => ({
|
|
3680
3831
|
selectTab: (tab) => {
|
|
@@ -3759,10 +3910,10 @@ const SettingsPage = () => {
|
|
|
3759
3910
|
SettingsTabsList,
|
|
3760
3911
|
{
|
|
3761
3912
|
"aria-label": t("settings.config.tabs.label", "Configuration sections"),
|
|
3762
|
-
children:
|
|
3913
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(SETTINGS_TAB_LABELS[tab][0], SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
3763
3914
|
}
|
|
3764
3915
|
),
|
|
3765
|
-
|
|
3916
|
+
visibleTabs.map((tab) => {
|
|
3766
3917
|
const TabPanel = TAB_COMPONENTS[tab];
|
|
3767
3918
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: tab, forceMount: true, hidden: activeTab !== tab, children: /* @__PURE__ */ jsxRuntime.jsx(TabPanelFrame, { "data-settings-tab-panel": "", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(TabPanel, { form }) }) }) }, tab);
|
|
3768
3919
|
}),
|