strapi-plugin-magic-sessionmanager 4.22.0 → 4.23.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +163 -119
  3. package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
  4. package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
  5. package/dist/admin/{Analytics-WbCUmkQQ.mjs → Analytics-DGAHD19E.mjs} +1 -1
  6. package/dist/admin/{Analytics-DeDLGiCe.js → Analytics-_WA68oHb.js} +1 -1
  7. package/dist/admin/{App-Bkv-W0Sv.js → App-CfhAQ17e.js} +304 -104
  8. package/dist/admin/{App-C4bihk2K.mjs → App-VB66H73A.mjs} +276 -76
  9. package/dist/admin/ImpersonationTabBanner-B6Ps5-oe.mjs +244 -0
  10. package/dist/admin/ImpersonationTabBanner-DdwXNmh4.js +244 -0
  11. package/dist/admin/{OnlineUsersWidget-q0Z6nbbO.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
  12. package/dist/admin/{OnlineUsersWidget-CSvNe2rC.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
  13. package/dist/admin/{Settings-xokFI5LO.js → Settings-BBs2FDp7.js} +87 -266
  14. package/dist/admin/{Settings-avD0DbXP.mjs → Settings-CKDNGJhl.mjs} +79 -258
  15. package/dist/admin/{de-BQlEdBMr.mjs → de-CK-HuY41.mjs} +48 -7
  16. package/dist/admin/{de-HcJ19LKI.js → de-CSRQPn6F.js} +48 -7
  17. package/dist/admin/{en-DI-98CPM.js → en-DCtAgGEa.js} +48 -7
  18. package/dist/admin/{en-DzuXWL1W.mjs → en-KZ5ajaAR.mjs} +48 -7
  19. package/dist/admin/{es-BfyED9YI.mjs → es-B7k8taWV.mjs} +48 -7
  20. package/dist/admin/{es-Cm0Eklav.js → es-CKT00l4K.js} +48 -7
  21. package/dist/admin/{fr-C3nzszsI.js → fr-B2EdBFSb.js} +48 -7
  22. package/dist/admin/{fr-CzFNGWq0.mjs → fr-Q2gmYqCn.mjs} +48 -7
  23. package/dist/admin/{index-6zc5D8eb.mjs → index-BPbs1GyP.mjs} +386 -61
  24. package/dist/admin/{index-Dk5Jqe5U.js → index-Cho0XGZ1.js} +340 -15
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +2 -2
  27. package/dist/admin/{pt-BPZ6chPT.js → pt-CcMUcqDy.js} +48 -7
  28. package/dist/admin/{pt-DmyQnGI_.mjs → pt-CmxZTaf2.mjs} +48 -7
  29. package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
  30. package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
  31. package/dist/server/index.js +1809 -400
  32. package/dist/server/index.mjs +1809 -400
  33. package/package.json +9 -4
  34. package/dist/admin/dashboardModel-BBNRgcEr.mjs +0 -170
  35. package/dist/admin/dashboardModel-D4389iIV.js +0 -169
@@ -2,12 +2,12 @@ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { useState, createContext, useContext, useMemo, useId, Fragment, useRef, useEffect, useCallback, useLayoutEffect } from "react";
3
3
  import { Field, Typography, Switch, Box, TextInput, Flex, Button, Link, SingleSelect, SingleSelectOption, Accordion, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Modal, NumberInput, IconButton, Alert, Badge, Radio, Loader, EmptyStateLayout, Textarea, Dialog, Tag, Combobox, ComboboxOption, Divider, Tabs, Checkbox } from "@strapi/design-system";
4
4
  import { useFetchClient, useNotification, useRBAC, ConfirmDialog, useQueryParams, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
5
- import { EyeStriked, Eye, Key, Duplicate, Plus, Pencil, Trash, Lock, ArrowClockwise, Cross, Download, Check, SignOut } from "@strapi/icons";
5
+ import { EyeStriked, Eye, Key, Duplicate, Plus, Pencil, Trash, Lock, ArrowClockwise, Cross, Download, Check } from "@strapi/icons";
6
6
  import styled from "styled-components";
7
- import { ar as ReadableParagraphs, a1 as useSettingsTranslate, l as logSafeAdminError, as as buildTabSearch, R as ReadableText, at as buildSelectOptions, L as useElementWidth, f as pluginId, F as isCancelledRequest, h as PersistentAlert, au as EqualGrid, av as SELECT_PRESETS, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, aw as fieldHasError, ax as usesLocalDatabase, P as PropertyList, ay as formatSessionDate, az as refocusIfLost, aA as getErrorTab, aB as copyText, aC as buildSavePayload, aD as SETTINGS_FIELD_LABELS, aE as requireSuccessfulMutation, aF as getVisibleSettingsTabs, aG as resolveSettingsTab, aH as getRevealScrollDelta, Q as PageShell, aI as SETTINGS_TAB_LABELS } from "./index-6zc5D8eb.mjs";
7
+ import { as as ReadableParagraphs, a1 as useSettingsTranslate, l as logSafeAdminError, at as buildTabSearch, R as ReadableText, au as buildSelectOptions, L as useElementWidth, f as pluginId, F as isCancelledRequest, h as PersistentAlert, av as EqualGrid, aw as SELECT_PRESETS, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, ax as fieldHasError, ay as usesLocalDatabase, P as PropertyList, az as formatSessionDate, aA as refocusIfLost, aB as getErrorTab, aC as copyText, aD as buildSavePayload, aE as SETTINGS_FIELD_LABELS, aF as requireSuccessfulMutation, aG as getVisibleSettingsTabs, aH as resolveSettingsTab, aI as getRevealScrollDelta, Q as PageShell, aJ as SETTINGS_TAB_LABELS } from "./index-BPbs1GyP.mjs";
8
8
  import "react-intl";
9
9
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
10
- import { b as RowActions, s as shouldIsolateActionKey, o as getRiskAvailability, q as riskDependentControl } from "./dashboardModel-BBNRgcEr.mjs";
10
+ import { b as RowActions, s as shouldIsolateActionKey, q as getRiskAvailability, t as riskDependentControl, o as ActiveImpersonationsCard } from "./ActiveImpersonationsCard-CbyOAlrL.mjs";
11
11
  import { EmptyPermissions } from "@strapi/icons/symbols";
12
12
  const FieldFrame = styled.div`
13
13
  width: 100%;
@@ -567,6 +567,7 @@ const ROLE_RULE_RANGES = Object.freeze({
567
567
  });
568
568
  const ROLE_RULE_FIELDS = Object.freeze(Object.keys(ROLE_RULE_RANGES));
569
569
  const MAX_TRUSTED_ADDRESSES = 100;
570
+ const MAX_TRUSTED_PROXIES = 50;
570
571
  const message$2 = (messageId, defaultMessage, values) => ({ messageId, defaultMessage, values });
571
572
  function validateWholeNumber(value, { min, max }) {
572
573
  if (value === void 0 || value === null || value === "") {
@@ -609,17 +610,24 @@ function validatePolicyFields(settings) {
609
610
  const error = validateWholeNumber(source[key], range);
610
611
  if (error) errors[key] = error;
611
612
  }
612
- const entries = Array.isArray(source.lockoutTrustedAddresses) ? source.lockoutTrustedAddresses : [];
613
- if (entries.length > MAX_TRUSTED_ADDRESSES) {
614
- errors.lockoutTrustedAddresses = message$2(
615
- "settings.validation.trustedTooMany",
616
- "Enter at most {max} addresses.",
617
- { max: MAX_TRUSTED_ADDRESSES }
618
- );
619
- } else {
613
+ for (const [field, max] of [
614
+ ["lockoutTrustedAddresses", MAX_TRUSTED_ADDRESSES],
615
+ ["trustedProxies", MAX_TRUSTED_PROXIES]
616
+ ]) {
617
+ const entries = Array.isArray(source[field]) ? source[field] : [];
618
+ if (entries.length > max) {
619
+ errors[field] = message$2(
620
+ "settings.validation.trustedTooMany",
621
+ "Enter at most {max} addresses.",
622
+ {
623
+ max
624
+ }
625
+ );
626
+ continue;
627
+ }
620
628
  const invalid = entries.find((entry) => !isTrustedAddressLine(entry));
621
629
  if (invalid !== void 0) {
622
- errors.lockoutTrustedAddresses = message$2(
630
+ errors[field] = message$2(
623
631
  "settings.validation.trustedAddress",
624
632
  '"{value}" is not an IP address or CIDR range. Use for example 192.0.2.10 or 192.0.2.0/24.',
625
633
  { value: String(invalid).slice(0, 64) }
@@ -678,8 +686,8 @@ function sortLocks(locks) {
678
686
  return Number.isFinite(until) && until !== 0 ? until : String(a.id).localeCompare(b.id);
679
687
  });
680
688
  }
681
- const TABLE_MIN_WIDTH$2 = 640;
682
- const keepActionKeys$2 = (event) => {
689
+ const TABLE_MIN_WIDTH$1 = 640;
690
+ const keepActionKeys$1 = (event) => {
683
691
  if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
684
692
  };
685
693
  const EMPTY_DRAFT = Object.freeze({
@@ -766,10 +774,10 @@ const RoleRulesSection = ({ form }) => {
766
774
  };
767
775
  const fieldError = (key) => showErrors ? tError(draftErrors[key]) : void 0;
768
776
  const availableRoles = (roles || []).filter((role) => !taken.includes(role.documentId));
769
- const asTable = width === 0 || width >= TABLE_MIN_WIDTH$2;
777
+ const asTable = width === 0 || width >= TABLE_MIN_WIDTH$1;
770
778
  const actions = (rule) => {
771
779
  const name = roleName(rule.role);
772
- return /* @__PURE__ */ jsxs(RowActions, { onKeyDown: keepActionKeys$2, children: [
780
+ return /* @__PURE__ */ jsxs(RowActions, { onKeyDown: keepActionKeys$1, children: [
773
781
  /* @__PURE__ */ jsx(
774
782
  IconButton,
775
783
  {
@@ -2068,7 +2076,8 @@ const SETTINGS_DEFAULTS = Object.freeze({
2068
2076
  sessionCreationGraceMs: 5e3,
2069
2077
  cleanupUseDbDirect: false,
2070
2078
  strictSessionEnforcement: false,
2071
- trustedProxies: false,
2079
+ // Proxy addresses or CIDR ranges (4.22.1); empty = Strapi's server.proxy settings.
2080
+ trustedProxies: [],
2072
2081
  enableGeolocation: true,
2073
2082
  enableSecurityScoring: true,
2074
2083
  blockSuspiciousSessions: false,
@@ -2129,6 +2138,7 @@ function normalizeSettings(loaded) {
2129
2138
  allowedCountries: Array.isArray(loaded.allowedCountries) ? loaded.allowedCountries : [],
2130
2139
  blockedCountries: Array.isArray(loaded.blockedCountries) ? loaded.blockedCountries : [],
2131
2140
  lockoutTrustedAddresses: Array.isArray(loaded.lockoutTrustedAddresses) ? loaded.lockoutTrustedAddresses : [],
2141
+ trustedProxies: Array.isArray(loaded.trustedProxies) ? loaded.trustedProxies : [],
2132
2142
  roleRules: Array.isArray(loaded.roleRules) ? loaded.roleRules : [],
2133
2143
  webhookEvents: Array.isArray(loaded.webhookEvents) ? loaded.webhookEvents : [...SIGNALS_FORM_DEFAULTS.webhookEvents],
2134
2144
  emailTemplates: fillMissingTemplates(loaded.emailTemplates)
@@ -2225,8 +2235,8 @@ function getAdjustedFields(submitted, stored, previous) {
2225
2235
  (key) => !WRITE_ONLY_SETTINGS_KEYS.includes(key) && !areSettingsEqual(source[key], stored?.[key]) && (previous === void 0 || !areSettingsEqual(source[key], previous?.[key]))
2226
2236
  );
2227
2237
  }
2228
- const TABLE_MIN_WIDTH$1 = 640;
2229
- const keepActionKeys$1 = (event) => {
2238
+ const TABLE_MIN_WIDTH = 640;
2239
+ const keepActionKeys = (event) => {
2230
2240
  if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
2231
2241
  };
2232
2242
  const LockTarget = ({ lock }) => {
@@ -2346,7 +2356,7 @@ const LockedNowCard = () => {
2346
2356
  }
2347
2357
  };
2348
2358
  const showActions = !permissionsLoading && canUnlock;
2349
- const asTable = width === 0 || width >= TABLE_MIN_WIDTH$1;
2359
+ const asTable = width === 0 || width >= TABLE_MIN_WIDTH;
2350
2360
  const unlockAction = (lock) => showActions ? /* @__PURE__ */ jsx(
2351
2361
  ConfirmAction,
2352
2362
  {
@@ -2413,7 +2423,7 @@ const LockedNowCard = () => {
2413
2423
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(KindBadge, { kind: lock.kind }) }),
2414
2424
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
2415
2425
  /* @__PURE__ */ jsx(Td, { children: ends(lock) }),
2416
- showActions ? /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
2426
+ showActions ? /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: unlockAction(lock) }) }) : null
2417
2427
  ] }, lock.id)) })
2418
2428
  ] }) });
2419
2429
  } else {
@@ -2436,7 +2446,7 @@ const LockedNowCard = () => {
2436
2446
  }) })
2437
2447
  ] })
2438
2448
  ] }),
2439
- /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
2449
+ /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: unlockAction(lock) })
2440
2450
  ] })
2441
2451
  },
2442
2452
  lock.id
@@ -2494,37 +2504,43 @@ const LockedNowCard = () => {
2494
2504
  }
2495
2505
  );
2496
2506
  };
2497
- const TrustedAddressesField = ({ form, disabled = false }) => {
2507
+ const TrustedAddressesField = ({
2508
+ form,
2509
+ disabled = false,
2510
+ field = "lockoutTrustedAddresses",
2511
+ id = "lockout-trusted-addresses",
2512
+ label,
2513
+ description,
2514
+ placeholder = "192.0.2.0/24"
2515
+ }) => {
2498
2516
  const { t, tError } = useSettingsTranslate();
2499
2517
  const { settings, handleChange, errors, draftVersion } = form;
2500
- const [text, setText] = useState(
2501
- () => formatTrustedAddressText(settings.lockoutTrustedAddresses)
2502
- );
2518
+ const [text, setText] = useState(() => formatTrustedAddressText(settings[field]));
2503
2519
  const [version, setVersion] = useState(draftVersion);
2504
2520
  if (version !== draftVersion) {
2505
2521
  setVersion(draftVersion);
2506
- setText(formatTrustedAddressText(settings.lockoutTrustedAddresses));
2522
+ setText(formatTrustedAddressText(settings[field]));
2507
2523
  }
2508
2524
  return /* @__PURE__ */ jsx(
2509
2525
  FormField,
2510
2526
  {
2511
- id: "lockout-trusted-addresses",
2512
- name: "lockoutTrustedAddresses",
2513
- label: t("settings.config.failed.trusted.label", "Trusted addresses"),
2514
- description: t(
2527
+ id,
2528
+ name: field,
2529
+ label: label ?? t("settings.config.failed.trusted.label", "Trusted addresses"),
2530
+ description: description ?? t(
2515
2531
  "settings.config.failed.trusted.hint",
2516
2532
  "One IP address or CIDR range per line, for example 192.0.2.10 or 192.0.2.0/24. These addresses are never locked by IP; accounts can still be locked. Use it for an office network or a server that signs in for many users."
2517
2533
  ),
2518
- error: tError(errors.lockoutTrustedAddresses),
2534
+ error: tError(errors[field]),
2519
2535
  children: /* @__PURE__ */ jsx(
2520
2536
  Textarea,
2521
2537
  {
2522
2538
  value: text,
2523
- placeholder: "192.0.2.0/24",
2539
+ placeholder,
2524
2540
  disabled,
2525
2541
  onChange: (event) => {
2526
2542
  setText(event.target.value);
2527
- handleChange("lockoutTrustedAddresses", parseTrustedAddressText(event.target.value));
2543
+ handleChange(field, parseTrustedAddressText(event.target.value));
2528
2544
  }
2529
2545
  }
2530
2546
  )
@@ -3148,6 +3164,7 @@ const LoginProtectionTab = ({ form }) => {
3148
3164
  children: /* @__PURE__ */ jsx(
3149
3165
  NumberInput,
3150
3166
  {
3167
+ disabled: policyLocked,
3151
3168
  value: settings.maxFailedLogins,
3152
3169
  onValueChange: (value) => handleChange("maxFailedLogins", value),
3153
3170
  min: MAX_FAILED_LOGINS_RANGE.min,
@@ -3301,7 +3318,7 @@ const LoginProtectionTab = ({ form }) => {
3301
3318
  }
3302
3319
  ),
3303
3320
  /* @__PURE__ */ jsx(LockedNowCard, {}),
3304
- /* @__PURE__ */ jsx(
3321
+ /* @__PURE__ */ jsxs(
3305
3322
  SectionCard,
3306
3323
  {
3307
3324
  id: "client-ip-address",
@@ -3310,19 +3327,24 @@ const LoginProtectionTab = ({ form }) => {
3310
3327
  "settings.config.clientIp.intro",
3311
3328
  "All IP-based rules depend on reading the real client address."
3312
3329
  ),
3313
- children: /* @__PURE__ */ jsx(
3314
- SettingsToggleRow,
3315
- {
3316
- id: "trusted-proxies",
3317
- title: t("settings.config.clientIp.trustProxy.label", "Trust proxy headers"),
3318
- description: t(
3319
- "settings.config.clientIp.trustProxy.hint",
3320
- "Turn on only behind a proxy you control. Affects the recorded IP address, the IP lockout and location lookups."
3321
- ),
3322
- checked: settings.trustedProxies,
3323
- onChange: (checked) => handleChange("trustedProxies", checked)
3324
- }
3325
- )
3330
+ children: [
3331
+ policyLocked ? /* @__PURE__ */ jsx(ProtectedNotice, {}) : null,
3332
+ /* @__PURE__ */ jsx(
3333
+ TrustedAddressesField,
3334
+ {
3335
+ form,
3336
+ disabled: policyLocked,
3337
+ field: "trustedProxies",
3338
+ id: "trusted-proxies",
3339
+ placeholder: "10.0.0.0/8",
3340
+ label: t("settings.config.clientIp.trustProxy.label", "Trusted proxies"),
3341
+ description: t(
3342
+ "settings.config.clientIp.trustProxy.hint",
3343
+ "Leave empty to use Strapi's server.proxy settings (koa, ipHeader, maxIpsCount). Otherwise list your proxies, one IP address or CIDR range per line: only a request that comes from a listed proxy has its X-Forwarded-For read, and the client is the right-most address that is not listed. Affects the recorded IP address, the IP lockout and location lookups."
3344
+ )
3345
+ }
3346
+ )
3347
+ ]
3326
3348
  }
3327
3349
  ),
3328
3350
  /* @__PURE__ */ jsxs(
@@ -4823,12 +4845,13 @@ const AlertsTab = ({ form }) => {
4823
4845
  ] }, field);
4824
4846
  }) }) })
4825
4847
  ] }),
4848
+ locked ? /* @__PURE__ */ jsx(ProtectedNotice, {}) : null,
4826
4849
  /* @__PURE__ */ jsxs(
4827
4850
  AdvancedSection,
4828
4851
  {
4829
4852
  label: t("settings.config.email.templates.label", "Edit email templates"),
4830
4853
  hasError: templateErrors,
4831
- disabled: emailTypesDisabled,
4854
+ disabled: emailTypesDisabled || locked,
4832
4855
  children: [
4833
4856
  /* @__PURE__ */ jsx(PersistentAlert, { variant: "warning", closeLabel: t("common.close", "Close"), title: "", children: t(
4834
4857
  "settings.config.email.templates.warning",
@@ -5198,220 +5221,18 @@ const AdminActivityTab = ({ form }) => {
5198
5221
  )
5199
5222
  ] });
5200
5223
  };
5201
- const TABLE_MIN_WIDTH = 720;
5202
- const keepActionKeys = (event) => {
5203
- if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
5204
- };
5205
- const ActiveImpersonationsCard = () => {
5206
- const { t } = useSettingsTranslate();
5207
- const { get, post } = useFetchClient();
5208
- const { toggleNotification } = useNotification();
5209
- const { formatDate } = useSessionFormatters();
5210
- const [widthRef, width] = useElementWidth();
5211
- const [rows, setRows] = useState(null);
5212
- const [error, setError] = useState(false);
5213
- const [refreshing, setRefreshing] = useState(false);
5214
- const refreshRef = useRef(null);
5215
- const requestRef = useRef(0);
5216
- const apply = useCallback(async (request, pending) => {
5217
- try {
5218
- const { data } = await pending;
5219
- if (request !== requestRef.current) return;
5220
- if (!Array.isArray(data?.data)) throw new Error("Invalid impersonation list");
5221
- setRows(data.data);
5222
- setError(false);
5223
- } catch (err) {
5224
- if (isCancelledRequest(err) || request !== requestRef.current) return;
5225
- logSafeAdminError("impersonation.list", err);
5226
- setError(true);
5227
- } finally {
5228
- if (request === requestRef.current) setRefreshing(false);
5229
- }
5230
- }, []);
5231
- const load = useCallback(() => {
5232
- const request = ++requestRef.current;
5233
- setRefreshing(true);
5234
- return apply(request, get(`/${pluginId}/impersonation/active`));
5235
- }, [apply, get]);
5236
- useEffect(() => {
5237
- apply(++requestRef.current, get(`/${pluginId}/impersonation/active`));
5238
- }, [apply, get]);
5239
- const end = async (row) => {
5240
- try {
5241
- await post(`/${pluginId}/impersonation/${row.id}/end`, {});
5242
- toggleNotification({
5243
- type: "success",
5244
- message: t("impersonation.ended", "Impersonation ended.")
5245
- });
5246
- } catch (err) {
5247
- logSafeAdminError("impersonation.end", err);
5248
- toggleNotification({
5249
- type: "danger",
5250
- message: t("impersonation.error.end", "The impersonation could not be ended.")
5251
- });
5252
- throw err;
5253
- } finally {
5254
- await load();
5255
- }
5256
- };
5257
- const endAction = (row) => /* @__PURE__ */ jsx(
5258
- ConfirmAction,
5259
- {
5260
- fallbackFocusRef: refreshRef,
5261
- title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
5262
- user: label(row)
5263
- }),
5264
- body: t(
5265
- "impersonation.confirm.body",
5266
- "The short-lived sign-in stops working at once. This is recorded in the security log."
5267
- ),
5268
- confirmLabel: t("impersonation.end", "End impersonation"),
5269
- onConfirm: () => end(row),
5270
- trigger: /* @__PURE__ */ jsx(
5271
- IconButton,
5272
- {
5273
- variant: "ghost",
5274
- label: t("impersonation.endLabel", "End impersonation of {user}", {
5275
- user: label(row)
5276
- }),
5277
- children: /* @__PURE__ */ jsx(SignOut, {})
5278
- }
5279
- )
5280
- },
5281
- row.id
5282
- );
5283
- const label = (row) => row.targetLabel || (row.targetType === "admin" ? t("impersonation.list.adminFallback", "Admin #{id}", { id: row.targetId }) : row.targetId);
5284
- const kind = (row) => row.targetType === "admin" ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "neutral800", children: t("impersonation.list.kind.admin", "Admin, view only") }) : null;
5285
- const time = (iso) => /* @__PURE__ */ jsx(Typography, { tag: "time", dateTime: iso, variant: "omega", textColor: "neutral800", children: formatDate(iso, { hour: "2-digit", minute: "2-digit" }) });
5286
- const startedBy = (row) => row.startedByYou ? t("impersonation.list.you", "You") : row.actorLabel || "—";
5287
- let content;
5288
- if (rows === null && !error) {
5289
- content = /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 6, children: /* @__PURE__ */ jsx(Loader, { small: true, children: t("impersonation.list.loading", "Loading impersonations…") }) });
5290
- } else if (error && rows === null) {
5291
- content = /* @__PURE__ */ jsx(
5292
- PersistentAlert,
5293
- {
5294
- variant: "danger",
5295
- closeLabel: t("common.close", "Close"),
5296
- title: t("impersonation.list.error", "Impersonations could not be loaded."),
5297
- action: /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: load, children: t("common.tryAgain", "Try again") }),
5298
- children: t(
5299
- "impersonation.list.errorBody",
5300
- "Running impersonations still end on time; only this list is missing."
5301
- )
5302
- }
5303
- );
5304
- } else if (rows.length === 0) {
5305
- content = /* @__PURE__ */ jsx(
5306
- EmptyStateLayout,
5307
- {
5308
- icon: /* @__PURE__ */ jsx(EmptyPermissions, { width: "16rem", height: "8rem" }),
5309
- content: t(
5310
- "impersonation.list.empty",
5311
- "No impersonation is running. Start one from a user’s entry in the Content Manager."
5312
- )
5313
- }
5314
- );
5315
- } else if (width === 0 || width >= TABLE_MIN_WIDTH) {
5316
- content = /* @__PURE__ */ jsx(Box, { hasRadius: true, borderColor: "neutral150", "data-impersonations-table": "", children: /* @__PURE__ */ jsxs(Table, { colCount: 5, rowCount: rows.length + 1, "aria-busy": refreshing, children: [
5317
- /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
5318
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.user", "User") }) }),
5319
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.startedBy", "Started by") }) }),
5320
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.reason", "Reason") }) }),
5321
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.ends", "Ends") }) }),
5322
- /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("impersonation.list.col.actions", "Actions") }) })
5323
- ] }) }),
5324
- /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxs(Tr, { "data-impersonation-row": "", children: [
5325
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
5326
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
5327
- kind(row)
5328
- ] }) }),
5329
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: startedBy(row) }) }),
5330
- /* @__PURE__ */ jsx(Td, { style: { maxWidth: 0, width: "40%" }, children: /* @__PURE__ */ jsx(
5331
- Typography,
5332
- {
5333
- variant: "omega",
5334
- textColor: "neutral800",
5335
- tag: "p",
5336
- style: { overflowWrap: "anywhere" },
5337
- children: row.reason
5338
- }
5339
- ) }),
5340
- /* @__PURE__ */ jsx(Td, { children: time(row.expiresAt) }),
5341
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
5342
- ] }, row.id)) })
5343
- ] }) });
5344
- } else {
5345
- content = /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, tag: "ul", "data-impersonations-list": "", children: rows.map((row) => /* @__PURE__ */ jsx(Box, { tag: "li", padding: 4, hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [
5346
- /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
5347
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
5348
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
5349
- kind(row)
5350
- ] }),
5351
- /* @__PURE__ */ jsx(
5352
- Typography,
5353
- {
5354
- variant: "pi",
5355
- textColor: "neutral800",
5356
- tag: "p",
5357
- style: { overflowWrap: "anywhere" },
5358
- children: row.reason
5359
- }
5360
- ),
5361
- /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t("impersonation.list.summary", "{admin}, until {time}", {
5362
- admin: startedBy(row),
5363
- time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
5364
- }) })
5365
- ] }),
5366
- /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
5367
- ] }) }, row.id)) });
5368
- }
5369
- return /* @__PURE__ */ jsx(
5370
- SectionCard,
5371
- {
5372
- id: "active-impersonations",
5373
- title: t("impersonation.list.title", "Active impersonations"),
5374
- subtitle: t(
5375
- "impersonation.list.intro",
5376
- "Each one ends by itself at the time shown. End stops it at once."
5377
- ),
5378
- action: /* @__PURE__ */ jsx(
5379
- Button,
5380
- {
5381
- ref: refreshRef,
5382
- variant: "tertiary",
5383
- startIcon: /* @__PURE__ */ jsx(ArrowClockwise, {}),
5384
- onClick: load,
5385
- loading: refreshing && rows !== null,
5386
- children: t("impersonation.list.refresh", "Refresh")
5387
- }
5388
- ),
5389
- children: /* @__PURE__ */ jsxs("div", { ref: widthRef, "aria-live": "polite", children: [
5390
- error && rows !== null ? /* @__PURE__ */ jsx(Box, { paddingBottom: 3, children: /* @__PURE__ */ jsx(
5391
- PersistentAlert,
5392
- {
5393
- variant: "warning",
5394
- closeLabel: t("common.close", "Close"),
5395
- title: t("impersonation.list.refreshErrorTitle", "Not refreshed"),
5396
- children: t(
5397
- "impersonation.list.refreshError",
5398
- "The list could not be refreshed. It shows the last known impersonations."
5399
- )
5400
- }
5401
- ) }) : null,
5402
- content
5403
- ] })
5404
- }
5405
- );
5406
- };
5407
5224
  const ImpersonationTab = ({ form }) => {
5408
5225
  const { t } = useSettingsTranslate();
5409
5226
  const { settings, handleChange } = form;
5410
5227
  const locked = form.canChangeProtected === false;
5411
5228
  const {
5412
5229
  isLoading,
5413
- allowedActions: { canUsers, canAdmins }
5414
- } = useRBAC([...pluginPermissions.impersonateUsers, ...pluginPermissions.impersonateAdmins]);
5230
+ allowedActions: { canUsers, canAdmins, canSignIn }
5231
+ } = useRBAC([
5232
+ ...pluginPermissions.impersonateUsers,
5233
+ ...pluginPermissions.impersonateAdmins,
5234
+ ...pluginPermissions.signInAsAdmin
5235
+ ]);
5415
5236
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
5416
5237
  /* @__PURE__ */ jsx(IntroText, { children: t(
5417
5238
  "settings.impersonation.intro",
@@ -5436,7 +5257,7 @@ const ImpersonationTab = ({ form }) => {
5436
5257
  ) })
5437
5258
  }
5438
5259
  ) }),
5439
- !isLoading && (canUsers || canAdmins) ? /* @__PURE__ */ jsx(ActiveImpersonationsCard, {}) : null
5260
+ !isLoading && (canUsers || canAdmins || canSignIn) ? /* @__PURE__ */ jsx(ActiveImpersonationsCard, {}) : null
5440
5261
  ] });
5441
5262
  };
5442
5263
  const INITIAL_SETTINGS = { ...SETTINGS_DEFAULTS, emailTemplates: fillMissingTemplates({}) };
@@ -350,8 +350,8 @@ const de = {
350
350
  "settings.config.failed.lockout.suffix": "fehlgeschlagenen Anmeldungen",
351
351
  "settings.config.clientIp.title": "Client-IP-Adresse",
352
352
  "settings.config.clientIp.intro": "Alle IP-basierten Regeln hängen davon ab, dass die echte Client-Adresse gelesen wird.",
353
- "settings.config.clientIp.trustProxy.label": "Proxy-Headern vertrauen",
354
- "settings.config.clientIp.trustProxy.hint": "Aktivieren Sie dies nur hinter einem Proxy, den Sie selbst betreiben. Wirkt sich auf die erfasste IP-Adresse, die IP-Sperre und Standortabfragen aus.",
353
+ "settings.config.clientIp.trustProxy.label": "Vertrauenswürdige Proxys",
354
+ "settings.config.clientIp.trustProxy.hint": "Leer lassen, um die Strapi-Einstellungen server.proxy (koa, ipHeader, maxIpsCount) zu verwenden. Andernfalls Ihre Proxys auflisten, eine IP-Adresse oder ein CIDR-Bereich pro Zeile: Nur bei einer Anfrage, die von einem aufgeführten Proxy kommt, wird X-Forwarded-For gelesen, und der Client ist die am weitesten rechts stehende Adresse, die nicht aufgeführt ist. Wirkt sich auf die erfasste IP-Adresse, die IP-Sperre und Standortabfragen aus.",
355
355
  "settings.config.suspicious.title": "Verdächtige Anmeldungen",
356
356
  "settings.config.suspicious.intro": "Weist neue Anmeldungen ab, die riskant wirken.",
357
357
  "settings.config.suspicious.reject.label": "Verdächtige Anmeldungen ablehnen",
@@ -990,6 +990,8 @@ const de = {
990
990
  "adminPanel.activity.read.signInsExport": "Anmeldeverlauf exportiert",
991
991
  "adminPanel.activity.read.signIns": "Anmeldeverlauf abgerufen",
992
992
  "adminPanel.activity.event.purged": "Alte Ereignisse gelöscht",
993
+ "adminPanel.activity.event.weakKey": "Schwacher Verschlüsselungsschlüssel",
994
+ "adminPanel.activity.event.weakKey.detail": "SESSION_ENCRYPTION_KEY ist kürzer als 32 Bytes. Die nächste Hauptversion startet damit nicht mehr.",
993
995
  "adminPanel.activity.event.userFailed": "Anmeldung fehlgeschlagen",
994
996
  "adminPanel.activity.event.userRefused": "Anmeldung abgelehnt",
995
997
  "adminPanel.activity.event.userLockout": "Gesperrt",
@@ -1018,7 +1020,7 @@ const de = {
1018
1020
  "impersonation.result.title": "Sie handeln als {user}",
1019
1021
  "impersonation.modal.title": "Als {user} anmelden",
1020
1022
  "impersonation.modal.intro": "Sie erhalten eine kurzlebige Anmeldung als dieser Benutzer, um ein Problem nachzustellen. Passwort, E-Mail-Adresse, Konto und Sitzungen lassen sich damit nicht ändern. Der Vorgang wird im Sicherheitsprotokoll festgehalten.",
1021
- "impersonation.reason.hint": "Wird im Sicherheitsprotokoll gespeichert und, falls Sie den Benutzer per E-Mail informieren, ihm angezeigt.",
1023
+ "impersonation.reason.hint": "Wird für Admins im Sicherheitsprotokoll gespeichert. Der Benutzer sieht ihn nur in der optionalen E-Mail; sein Datenexport nennt nur, dass ein Administrator das Konto geöffnet hat.",
1022
1024
  "impersonation.reason.label": "Grund",
1023
1025
  "impersonation.reason.placeholder": "Zum Beispiel: Ticket 4711",
1024
1026
  "impersonation.duration.label": "Dauer",
@@ -1082,7 +1084,7 @@ const de = {
1082
1084
  "impersonation.preview.conditions": "{action}: nur {conditions}",
1083
1085
  "impersonation.preview.error.start": "Die Vorschau konnte nicht geöffnet werden.",
1084
1086
  "impersonation.preview.ended": "Vorschau beendet.",
1085
- "impersonation.preview.title": "Als {name} ansehen",
1087
+ "impersonation.preview.title": "Berechtigungen von {name}",
1086
1088
  "impersonation.preview.intro": "Sehen Sie, welche Inhaltstypen und Aktionen dieser Admin nutzen kann, ermittelt aus seinen Rollen. Nur Ansicht: Niemand wird angemeldet und nichts kann geändert werden. Der Vorgang wird im Sicherheitsprotokoll festgehalten.",
1087
1089
  "impersonation.preview.reason.hint": "Wird im Sicherheitsprotokoll gespeichert.",
1088
1090
  "impersonation.preview.banner.ended": "Die Vorschau ist beendet.",
@@ -1094,8 +1096,6 @@ const de = {
1094
1096
  "impersonation.preview.other": "Weitere Berechtigungen",
1095
1097
  "impersonation.preview.close": "Beenden und schließen",
1096
1098
  "impersonation.preview.start": "Berechtigungen ansehen",
1097
- "adminPanel.actions.viewAs": "Als {name} ansehen",
1098
- "adminPanel.actions.viewAsShort": "Ansehen als",
1099
1099
  "adminPanel.activity.event.impersonationStarted": "Identitätsübernahme gestartet",
1100
1100
  "adminPanel.activity.event.impersonationEnded": "Identitätsübernahme beendet",
1101
1101
  "adminPanel.activity.event.impersonationExpired": "Identitätsübernahme abgelaufen",
@@ -1111,6 +1111,7 @@ const de = {
1111
1111
  "userActivity.detail.impersonation.callAccount": "Ein Datenexport oder „Das war ich nicht“ wurde abgewiesen",
1112
1112
  "userActivity.detail.impersonation.callCredentials": "Eine Anmelde-, Passwort- oder E-Mail-Anfrage wurde abgewiesen",
1113
1113
  "userActivity.detail.impersonation.callSessions": "Eine Anfrage zum Beenden von Sitzungen wurde abgewiesen",
1114
+ "userActivity.detail.impersonation.callMutation": "Eine GraphQL-Mutation wurde abgewiesen",
1114
1115
  "userActivity.detail.impersonation.disabled": "Die Identitätsübernahme ist ausgeschaltet",
1115
1116
  "userActivity.detail.impersonation.duration": "Für {minutes, plural, one {# Minute} other {# Minuten}}",
1116
1117
  "userActivity.detail.impersonation.endedByAdmin": "Von einem Admin beendet",
@@ -1164,7 +1165,47 @@ const de = {
1164
1165
  "userActivity.panel.title": "Sicherheitsaktivität",
1165
1166
  "userActivity.recent.empty": "Noch keine Sicherheitsereignisse von App-Benutzern.",
1166
1167
  "userActivity.recent.subtitle": "Die neuesten fehlgeschlagenen und abgelehnten Anmeldungen, Sperren, neuen Geräte, unmöglichen Reisen und Identitätsübernahmen der Benutzer Ihrer App. Wählen Sie ein Ereignis für die Details.",
1167
- "userActivity.recent.title": "Sicherheitsaktivität"
1168
+ "userActivity.recent.title": "Sicherheitsaktivität",
1169
+ "impersonation.tab.banner.signedInAs": "Angemeldet als {name}",
1170
+ "impersonation.tab.banner.changes": "Änderungen erlaubt",
1171
+ "impersonation.tab.banner.readOnly": "Nur lesen",
1172
+ "impersonation.tab.banner.endsIn": "Endet in {time}",
1173
+ "impersonation.tab.banner.end": "Identitätswechsel beenden",
1174
+ "impersonation.tab.landing.title": "Anmeldung als anderer Admin …",
1175
+ "impersonation.tab.failed.title": "Die Anmeldung hat nicht funktioniert",
1176
+ "impersonation.tab.failed.body": "Der Link wurde schon benutzt oder ist älter als eine Minute. Starten Sie erneut auf der Seite „Admin-Panel“ des Session Managers.",
1177
+ "impersonation.tab.ended.expiredTitle": "Der Identitätswechsel ist abgelaufen",
1178
+ "impersonation.tab.ended.title": "Der Identitätswechsel wurde beendet",
1179
+ "impersonation.tab.ended.body": "Sie sind nicht mehr als {name} angemeldet. Ihre anderen Tabs sind nicht betroffen. Sie können diesen Tab schließen.",
1180
+ "impersonation.tab.backToMyAdmin": "Zurück zu meinem Admin-Panel",
1181
+ "impersonation.tab.close": "Tab schließen",
1182
+ "impersonation.signIn.unsupported.lifespan": "Nicht verfügbar: Die Lebensdauer des Admin-Zugriffstokens ist kürzer als 15 Minuten.",
1183
+ "impersonation.signIn.unsupported.version": "Auf Strapi {version} nicht verfügbar: Diese Plugin-Version wurde mit Strapi 5.50 bis 5.64 getestet. Aktualisieren Sie das Plugin, um es zu nutzen.",
1184
+ "impersonation.signIn.error.start": "Die Anmeldung konnte nicht gestartet werden.",
1185
+ "impersonation.signIn.error.unsupported": "Die Anmeldung als anderer Admin ist auf dieser Strapi-Version nicht verfügbar.",
1186
+ "impersonation.signIn.error.self": "Sie können sich nicht als Sie selbst anmelden.",
1187
+ "impersonation.signIn.error.superAdmin": "Sie können sich nicht als Super Admin anmelden.",
1188
+ "impersonation.signIn.error.notSubset": "Dieser Admin hat Berechtigungen, die Sie nicht haben. Deshalb können Sie sich nicht als er anmelden.",
1189
+ "impersonation.signIn.error.inactive": "Dieses Admin-Konto ist nicht aktiv.",
1190
+ "impersonation.signIn.error.alreadyActive": "Jemand ist bereits als dieser Admin angemeldet. Beenden Sie zuerst diesen Identitätswechsel.",
1191
+ "impersonation.signIn.error.nested": "Während eines Identitätswechsels können Sie keinen weiteren starten.",
1192
+ "impersonation.signIn.title": "Als {name} anmelden",
1193
+ "impersonation.signIn.intro": "Öffnet einen neuen Tab, in dem Sie als dieser Admin angemeldet sind, mit seinem Menü und seinen Berechtigungen. Ihre anderen Tabs bleiben als Sie angemeldet. Start, Ende und jede Änderung werden im Sicherheitsprotokoll festgehalten.",
1194
+ "impersonation.signIn.allowChanges": "Änderungen erlauben",
1195
+ "impersonation.signIn.allowChanges.hint": "Aus: Der Tab ist schreibgeschützt. Konto, Passwort, Sitzungen, Admin-Benutzer, Rollen und API-Tokens lassen sich nie ändern.",
1196
+ "impersonation.signIn.allowChanges.warning": "Ihre Änderungen erscheinen in Strapi als Änderungen von {name} (zum Beispiel unter „Zuletzt bearbeitet von“). Das Sicherheitsprotokoll hält Sie als Urheber fest.",
1197
+ "impersonation.signIn.ready": "Bereit. Öffnen Sie den Tab innerhalb einer Minute; der Link funktioniert einmal. Beenden Sie den Identitätswechsel über die Leiste oben in diesem Tab oder auf dieser Seite.",
1198
+ "impersonation.signIn.open": "Tab als {name} öffnen",
1199
+ "impersonation.signIn.start": "Anmeldung starten",
1200
+ "impersonation.list.kind.adminChanges": "Admin, angemeldet, Änderungen erlaubt",
1201
+ "impersonation.list.kind.adminSignedIn": "Admin, angemeldet, nur lesen",
1202
+ "adminPanel.activity.filter.impersonation": "Identitätswechsel",
1203
+ "adminPanel.actions.viewPermissions": "Berechtigungen von {name} ansehen",
1204
+ "adminPanel.actions.viewPermissionsShort": "Berechtigungen ansehen",
1205
+ "adminPanel.actions.signInAs": "Als {name} anmelden",
1206
+ "adminPanel.actions.signInAsShort": "Anmelden als",
1207
+ "adminPanel.activity.event.impersonationWrite": "Änderung während der Anmeldung als dieser Admin",
1208
+ "impersonation.tab.banner.endShort": "Beenden"
1168
1209
  };
1169
1210
  export {
1170
1211
  de as default