strapi-plugin-magic-sessionmanager 4.19.1 → 4.21.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 (29) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +189 -35
  3. package/dist/admin/{Analytics-BElmzyNJ.js → Analytics-BqdZIBV4.js} +1 -1
  4. package/dist/admin/{Analytics-BqFlgLnN.mjs → Analytics-C-OLLzoB.mjs} +1 -1
  5. package/dist/admin/{App-0thsC_P9.mjs → App-BswHmNQT.mjs} +338 -4
  6. package/dist/admin/{App-D_J2eeEG.js → App-Cx9v6n_7.js} +337 -3
  7. package/dist/admin/{OnlineUsersWidget-DMZBwqdY.js → OnlineUsersWidget-BRmQPPp9.js} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-BgJ1ws-5.mjs → OnlineUsersWidget-Dusgjc1d.mjs} +1 -1
  9. package/dist/admin/{Settings-FOkui_ke.js → Settings-DWGuf_Z3.js} +288 -65
  10. package/dist/admin/{Settings-QN3Mu4AQ.mjs → Settings-DZyQheUS.mjs} +258 -35
  11. package/dist/admin/{de-CEyi4lpp.js → de-24TPqzG6.js} +94 -1
  12. package/dist/admin/{de-uGKSKVYD.mjs → de-DUnrmFWk.mjs} +94 -1
  13. package/dist/admin/{en-CSXeJYKy.js → en-8mBSkWOF.js} +94 -1
  14. package/dist/admin/{en-Yu7tfwqx.mjs → en-D8J__tyF.mjs} +94 -1
  15. package/dist/admin/{es-iNG9Amf9.mjs → es-BgpgWdk0.mjs} +94 -1
  16. package/dist/admin/{es-BrKqXhAU.js → es-ChUKey-Q.js} +94 -1
  17. package/dist/admin/{fr-DKZNfdlH.js → fr-DE_CWmgq.js} +94 -1
  18. package/dist/admin/{fr-CaFICHlf.mjs → fr-k1MHYKJo.mjs} +94 -1
  19. package/dist/admin/{index-DEYtqPc3.js → index-Ceh3Q1Ki.js} +622 -46
  20. package/dist/admin/{index-h-ksmM8A.mjs → index-meLDPPwt.mjs} +638 -62
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +2 -2
  23. package/dist/admin/{pt-IEagyVDL.js → pt-BjqU5ioB.js} +94 -1
  24. package/dist/admin/{pt-Bz2hWVrq.mjs → pt-DPO4DmDc.mjs} +94 -1
  25. package/dist/admin/{settingsTabs-D02CuEvs.mjs → settingsTabs-C1q5iMMw.mjs} +5 -1
  26. package/dist/admin/{settingsTabs-N4TFn-mw.js → settingsTabs-CfquZuKH.js} +5 -1
  27. package/dist/server/index.js +1965 -15
  28. package/dist/server/index.mjs +1965 -15
  29. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
- import { useState, useCallback, createContext, useContext, useMemo, useId, Fragment, useRef, useEffect, useLayoutEffect } from "react";
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 } from "@strapi/icons";
5
+ import { EyeStriked, Eye, Key, Duplicate, Plus, Pencil, Trash, Lock, ArrowClockwise, Cross, Download, Check, SignOut } from "@strapi/icons";
6
6
  import styled from "styled-components";
7
- import { y as ReadableParagraphs, b as getTranslation, l as logSafeAdminError, R as ReadableText, f as pluginId, n as isCancelledRequest, h as PersistentAlert, z as EqualGrid, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, P as PropertyList, A as formatSessionDate, B as refocusIfLost, F as requireSuccessfulMutation, q as PageShell } from "./index-h-ksmM8A.mjs";
8
- import { useIntl } from "react-intl";
9
- import { v as buildTabSearch, x as buildSelectOptions, u as useElementWidth, b as RowActions, s as shouldIsolateActionKey, y as SELECT_PRESETS, z as fieldHasError, B as getRiskAvailability, C as riskDependentControl, E as usesLocalDatabase, F as getErrorTab, G as buildSavePayload, q as SETTINGS_FIELD_LABELS, H as getVisibleSettingsTabs, I as resolveSettingsTab, J as getRevealScrollDelta, t as SETTINGS_TAB_LABELS } from "./settingsTabs-D02CuEvs.mjs";
7
+ import { G as ReadableParagraphs, y as useSettingsTranslate, l as logSafeAdminError, R as ReadableText, f as pluginId, n as isCancelledRequest, h as PersistentAlert, H as EqualGrid, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, P as PropertyList, I as formatSessionDate, J as refocusIfLost, K as copyText, L as requireSuccessfulMutation, q as PageShell } from "./index-meLDPPwt.mjs";
8
+ import "react-intl";
9
+ import { v as buildTabSearch, x as buildSelectOptions, u as useElementWidth, b as RowActions, s as shouldIsolateActionKey, y as SELECT_PRESETS, z as fieldHasError, B as getRiskAvailability, C as riskDependentControl, E as usesLocalDatabase, F as getErrorTab, G as buildSavePayload, q as SETTINGS_FIELD_LABELS, H as getVisibleSettingsTabs, I as resolveSettingsTab, J as getRevealScrollDelta, t as SETTINGS_TAB_LABELS } from "./settingsTabs-C1q5iMMw.mjs";
10
10
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
11
11
  import { EmptyPermissions } from "@strapi/icons/symbols";
12
12
  const FieldFrame = styled.div`
@@ -286,18 +286,6 @@ const SecretTextInput = ({
286
286
  }
287
287
  );
288
288
  };
289
- function useSettingsTranslate() {
290
- const { formatMessage, locale } = useIntl();
291
- const t = useCallback(
292
- (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values),
293
- [formatMessage]
294
- );
295
- const tError = useCallback(
296
- (descriptor) => descriptor ? t(descriptor.messageId, descriptor.defaultMessage, descriptor.values) : void 0,
297
- [t]
298
- );
299
- return { t, tError, locale };
300
- }
301
289
  const EnvPreview = styled(Box)`
302
290
  overflow-wrap: anywhere;
303
291
 
@@ -690,8 +678,8 @@ function sortLocks(locks) {
690
678
  return Number.isFinite(until) && until !== 0 ? until : String(a.id).localeCompare(b.id);
691
679
  });
692
680
  }
693
- const TABLE_MIN_WIDTH$1 = 640;
694
- const keepActionKeys$1 = (event) => {
681
+ const TABLE_MIN_WIDTH$2 = 640;
682
+ const keepActionKeys$2 = (event) => {
695
683
  if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
696
684
  };
697
685
  const EMPTY_DRAFT = Object.freeze({
@@ -778,10 +766,10 @@ const RoleRulesSection = ({ form }) => {
778
766
  };
779
767
  const fieldError = (key) => showErrors ? tError(draftErrors[key]) : void 0;
780
768
  const availableRoles = (roles || []).filter((role) => !taken.includes(role.documentId));
781
- const asTable = width === 0 || width >= TABLE_MIN_WIDTH$1;
769
+ const asTable = width === 0 || width >= TABLE_MIN_WIDTH$2;
782
770
  const actions = (rule) => {
783
771
  const name = roleName(rule.role);
784
- return /* @__PURE__ */ jsxs(RowActions, { onKeyDown: keepActionKeys$1, children: [
772
+ return /* @__PURE__ */ jsxs(RowActions, { onKeyDown: keepActionKeys$2, children: [
785
773
  /* @__PURE__ */ jsx(
786
774
  IconButton,
787
775
  {
@@ -2110,7 +2098,9 @@ const SETTINGS_DEFAULTS = Object.freeze({
2110
2098
  securityLogGeoLookup: false,
2111
2099
  securityLogRetentionDays: 90,
2112
2100
  ...POLICY_FORM_DEFAULTS,
2113
- ...SIGNALS_FORM_DEFAULTS
2101
+ ...SIGNALS_FORM_DEFAULTS,
2102
+ // Impersonation of app users (4.20), off by default.
2103
+ impersonationEnabled: false
2114
2104
  });
2115
2105
  const WRITE_ONLY_SETTINGS_KEYS = Object.freeze([
2116
2106
  "discordWebhookUrl",
@@ -2235,8 +2225,8 @@ function getAdjustedFields(submitted, stored, previous) {
2235
2225
  (key) => !WRITE_ONLY_SETTINGS_KEYS.includes(key) && !areSettingsEqual(source[key], stored?.[key]) && (previous === void 0 || !areSettingsEqual(source[key], previous?.[key]))
2236
2226
  );
2237
2227
  }
2238
- const TABLE_MIN_WIDTH = 640;
2239
- const keepActionKeys = (event) => {
2228
+ const TABLE_MIN_WIDTH$1 = 640;
2229
+ const keepActionKeys$1 = (event) => {
2240
2230
  if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
2241
2231
  };
2242
2232
  const LockTarget = ({ lock }) => {
@@ -2356,7 +2346,7 @@ const LockedNowCard = () => {
2356
2346
  }
2357
2347
  };
2358
2348
  const showActions = !permissionsLoading && canUnlock;
2359
- const asTable = width === 0 || width >= TABLE_MIN_WIDTH;
2349
+ const asTable = width === 0 || width >= TABLE_MIN_WIDTH$1;
2360
2350
  const unlockAction = (lock) => showActions ? /* @__PURE__ */ jsx(
2361
2351
  ConfirmAction,
2362
2352
  {
@@ -2423,7 +2413,7 @@ const LockedNowCard = () => {
2423
2413
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(KindBadge, { kind: lock.kind }) }),
2424
2414
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
2425
2415
  /* @__PURE__ */ jsx(Td, { children: ends(lock) }),
2426
- showActions ? /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: unlockAction(lock) }) }) : null
2416
+ showActions ? /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
2427
2417
  ] }, lock.id)) })
2428
2418
  ] }) });
2429
2419
  } else {
@@ -2446,7 +2436,7 @@ const LockedNowCard = () => {
2446
2436
  }) })
2447
2437
  ] })
2448
2438
  ] }),
2449
- /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: unlockAction(lock) })
2439
+ /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
2450
2440
  ] })
2451
2441
  },
2452
2442
  lock.id
@@ -5208,15 +5198,247 @@ const AdminActivityTab = ({ form }) => {
5208
5198
  )
5209
5199
  ] });
5210
5200
  };
5211
- async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
5212
- if (typeof value !== "string") {
5213
- throw new TypeError("clipboard_value_must_be_text");
5214
- }
5215
- if (!clipboard || typeof clipboard.writeText !== "function") {
5216
- throw new Error("clipboard_unavailable");
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)) });
5217
5368
  }
5218
- await clipboard.writeText(value);
5219
- }
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
+ const ImpersonationTab = ({ form }) => {
5408
+ const { t } = useSettingsTranslate();
5409
+ const { settings, handleChange } = form;
5410
+ const locked = form.canChangeProtected === false;
5411
+ const {
5412
+ isLoading,
5413
+ allowedActions: { canUsers, canAdmins }
5414
+ } = useRBAC([...pluginPermissions.impersonateUsers, ...pluginPermissions.impersonateAdmins]);
5415
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
5416
+ /* @__PURE__ */ jsx(IntroText, { children: t(
5417
+ "settings.impersonation.intro",
5418
+ "Support staff can act as an app user for up to an hour to reproduce a problem, with a reason that is recorded. Who may do this is set per role under Settings > Roles > Session Manager."
5419
+ ) }),
5420
+ locked ? /* @__PURE__ */ jsx(ProtectedNotice, {}) : null,
5421
+ /* @__PURE__ */ jsx(SectionCard, { title: t("settings.impersonation.title", "Impersonation of app users"), children: /* @__PURE__ */ jsx(
5422
+ SettingsToggleRow,
5423
+ {
5424
+ id: "impersonation-enabled",
5425
+ title: t("settings.impersonation.enable.label", "Allow impersonation"),
5426
+ description: t(
5427
+ "settings.impersonation.enable.hint",
5428
+ "Off by default. Turning it off ends every running impersonation at once."
5429
+ ),
5430
+ checked: settings.impersonationEnabled === true,
5431
+ disabled: locked,
5432
+ onChange: (checked) => handleChange("impersonationEnabled", checked),
5433
+ children: /* @__PURE__ */ jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
5434
+ "settings.impersonation.notice",
5435
+ "Acting as a person processes their personal data. Tell your users in the privacy notice, and in Germany check whether the works council must agree, because the log shows what each admin did."
5436
+ ) })
5437
+ }
5438
+ ) }),
5439
+ !isLoading && (canUsers || canAdmins) ? /* @__PURE__ */ jsx(ActiveImpersonationsCard, {}) : null
5440
+ ] });
5441
+ };
5220
5442
  const INITIAL_SETTINGS = { ...SETTINGS_DEFAULTS, emailTemplates: fillMissingTemplates({}) };
5221
5443
  const BUILD_DATE_OPTIONS = Object.freeze({ dateStyle: "medium" });
5222
5444
  const getServerMessage = (error) => {
@@ -5588,6 +5810,7 @@ const TAB_COMPONENTS = {
5588
5810
  "location-data": LocationDataTab,
5589
5811
  alerts: AlertsTab,
5590
5812
  "data-retention": DataRetentionTab,
5813
+ impersonation: ImpersonationTab,
5591
5814
  "admin-activity": AdminActivityTab
5592
5815
  };
5593
5816
  const DraftSync = ({ values }) => {
@@ -1004,6 +1004,99 @@ const de = {
1004
1004
  "adminPanel.activity.event.userExport": "Personenbezogene Daten exportiert",
1005
1005
  "adminPanel.activity.event.impersonation": "Als anderer Benutzer angemeldet",
1006
1006
  "adminPanel.activity.event.webhook": "Webhook-Zustellung",
1007
- "adminPanel.activity.settingsGroup": "{tab}: {fields}"
1007
+ "adminPanel.activity.settingsGroup": "{tab}: {fields}",
1008
+ "impersonation.error.disabled": "Die Identitätsübernahme ist in den Einstellungen ausgeschaltet.",
1009
+ "impersonation.error.alreadyActive": "Für diesen Benutzer läuft bereits eine Identitätsübernahme. Beenden Sie sie zuerst.",
1010
+ "impersonation.error.blocked": "Gesperrte Konten können nicht übernommen werden.",
1011
+ "impersonation.error.apiToken": "API-Token können keine Identität übernehmen.",
1012
+ "impersonation.result.copied": "In die Zwischenablage kopiert.",
1013
+ "impersonation.result.copyFailed": "Kopieren fehlgeschlagen. Markieren und kopieren Sie den Text selbst.",
1014
+ "impersonation.result.copy": "{name} kopieren",
1015
+ "impersonation.error.rateLimited": "Es wurden zu viele Identitätsübernahmen gestartet. Versuchen Sie es in einigen Minuten erneut.",
1016
+ "impersonation.error.start": "Die Identitätsübernahme konnte nicht gestartet werden.",
1017
+ "impersonation.ended": "Identitätsübernahme beendet.",
1018
+ "impersonation.error.end": "Die Identitätsübernahme konnte nicht beendet werden.",
1019
+ "impersonation.error.frontend": "Das Frontend konnte nicht geöffnet werden.",
1020
+ "impersonation.result.title": "Sie handeln als {user}",
1021
+ "impersonation.modal.title": "Als {user} anmelden",
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.",
1023
+ "impersonation.reason.hint": "Wird im Sicherheitsprotokoll gespeichert und, falls Sie den Benutzer per E-Mail informieren, ihm angezeigt.",
1024
+ "impersonation.reason.label": "Grund",
1025
+ "impersonation.reason.placeholder": "Zum Beispiel: Ticket 4711",
1026
+ "impersonation.duration.label": "Dauer",
1027
+ "impersonation.duration.minutes": "{count, plural, one {# Minute} other {# Minuten}}",
1028
+ "impersonation.notify.label": "Den Benutzer per E-Mail informieren, dass sein Konto geöffnet wurde",
1029
+ "impersonation.notify.hint": "Wird über das E-Mail-Plugin von Strapi gesendet, mit Grund und Dauer.",
1030
+ "impersonation.result.frontendBody": "Öffnen Sie {origin} innerhalb einer Minute. Der Anmeldelink funktioniert einmal und wird gesendet, ohne in der Adresszeile zu erscheinen.",
1031
+ "impersonation.result.openFrontend": "Frontend öffnen",
1032
+ "impersonation.result.tokenBody": "Wird nur einmal angezeigt. Wer dieses Token hat, handelt bis zum Ende als {user}. Speichern oder teilen Sie es nicht.",
1033
+ "impersonation.result.accessToken": "Zugriffstoken",
1034
+ "impersonation.result.refreshToken": "Aktualisierungstoken",
1035
+ "impersonation.result.endsIn": "Endet in {time}.",
1036
+ "impersonation.end": "Identitätsübernahme beenden",
1037
+ "impersonation.result.done": "Fertig",
1038
+ "impersonation.start": "Identitätsübernahme starten",
1039
+ "impersonation.confirm.title": "Identitätsübernahme von {user} beenden?",
1040
+ "impersonation.confirm.body": "Die kurzlebige Anmeldung funktioniert sofort nicht mehr. Der Vorgang wird im Sicherheitsprotokoll festgehalten.",
1041
+ "impersonation.endLabel": "Identitätsübernahme von {user} beenden",
1042
+ "impersonation.list.you": "Sie",
1043
+ "impersonation.list.loading": "Identitätsübernahmen werden geladen…",
1044
+ "impersonation.list.error": "Die Identitätsübernahmen konnten nicht geladen werden.",
1045
+ "impersonation.list.errorBody": "Laufende Identitätsübernahmen enden trotzdem pünktlich; nur diese Liste fehlt.",
1046
+ "impersonation.list.empty": "Es läuft keine Identitätsübernahme. Starten Sie eine im Eintrag eines Benutzers im Content Manager.",
1047
+ "impersonation.list.col.user": "Benutzer",
1048
+ "impersonation.list.col.startedBy": "Gestartet von",
1049
+ "impersonation.list.col.reason": "Grund",
1050
+ "impersonation.list.col.ends": "Endet",
1051
+ "impersonation.list.col.actions": "Aktionen",
1052
+ "impersonation.list.summary": "{admin}, bis {time}",
1053
+ "impersonation.list.title": "Laufende Identitätsübernahmen",
1054
+ "impersonation.list.intro": "Jede endet von selbst zur angezeigten Zeit. Mit Beenden stoppen Sie sie sofort.",
1055
+ "impersonation.list.refresh": "Aktualisieren",
1056
+ "impersonation.list.refreshErrorTitle": "Nicht aktualisiert",
1057
+ "impersonation.list.refreshError": "Die Liste konnte nicht aktualisiert werden. Sie zeigt die zuletzt bekannten Identitätsübernahmen.",
1058
+ "impersonation.panel.title": "Identitätsübernahme",
1059
+ "impersonation.panel.running": "Läuft bis {time}.",
1060
+ "impersonation.panel.start": "Als Benutzer anmelden…",
1061
+ "settings.impersonation.intro": "Support-Mitarbeitende können bis zu einer Stunde als App-Benutzer handeln, um ein Problem nachzustellen; der Grund wird festgehalten. Wer das darf, legen Sie pro Rolle unter Einstellungen > Rollen > Session Manager fest.",
1062
+ "settings.impersonation.title": "Identitätsübernahme von App-Benutzern",
1063
+ "settings.impersonation.enable.label": "Identitätsübernahme erlauben",
1064
+ "settings.impersonation.enable.hint": "Standardmäßig aus. Beim Ausschalten enden alle laufenden Identitätsübernahmen sofort.",
1065
+ "settings.impersonation.notice": "Wer als eine Person handelt, verarbeitet deren personenbezogene Daten. Informieren Sie Ihre Benutzer in der Datenschutzerklärung, und prüfen Sie in Deutschland, ob der Betriebsrat zustimmen muss, weil das Protokoll zeigt, was jeder Admin getan hat.",
1066
+ "settings.config.tab.impersonation": "Identitätsübernahme",
1067
+ "impersonation.reason.tooShort": "Geben Sie einen Grund mit mindestens {min} Zeichen ein.",
1068
+ "impersonation.reason.tooLong": "Verwenden Sie höchstens {max} Zeichen.",
1069
+ "impersonation.error.csp": "Die Sicherheitseinstellungen von Strapi verhindern, dass die Anmeldung an {origin} gesendet wird. Fügen Sie diesen Ursprung zu form-action der Content-Security-Policy hinzu (siehe Dokumentation) und starten Sie erneut.",
1070
+ "impersonation.list.adminFallback": "Admin Nr. {id}",
1071
+ "impersonation.list.kind.admin": "Admin, nur Ansicht",
1072
+ "impersonation.preview.error.self": "Sie können sich nicht selbst als anderer Admin ansehen.",
1073
+ "impersonation.preview.error.superAdmin": "Super Admins können nicht als anderer Admin angesehen werden.",
1074
+ "impersonation.preview.error.notSubset": "Dieser Admin hat Berechtigungen, die Sie nicht haben. Deshalb können Sie ihn nicht ansehen.",
1075
+ "impersonation.preview.action.create": "Erstellen",
1076
+ "impersonation.preview.action.read": "Lesen",
1077
+ "impersonation.preview.action.update": "Bearbeiten",
1078
+ "impersonation.preview.action.delete": "Löschen",
1079
+ "impersonation.preview.action.publish": "Veröffentlichen",
1080
+ "impersonation.preview.condition.creator": "selbst erstellte Einträge",
1081
+ "impersonation.preview.condition.sameRole": "Einträge von Personen mit derselben Rolle",
1082
+ "impersonation.preview.restricted": "{action} (eingeschränkt)",
1083
+ "impersonation.preview.fields": "{action}: {count, plural, one {# Feld} other {# Felder}}",
1084
+ "impersonation.preview.conditions": "{action}: nur {conditions}",
1085
+ "impersonation.preview.error.start": "Die Vorschau konnte nicht geöffnet werden.",
1086
+ "impersonation.preview.ended": "Vorschau beendet.",
1087
+ "impersonation.preview.title": "Als {name} ansehen",
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.",
1089
+ "impersonation.preview.reason.hint": "Wird im Sicherheitsprotokoll gespeichert.",
1090
+ "impersonation.preview.banner.ended": "Die Vorschau ist beendet.",
1091
+ "impersonation.preview.banner": "Sie sehen die Ansicht von {name} · nur lesen · endet in {time}",
1092
+ "impersonation.preview.end": "Beenden",
1093
+ "impersonation.preview.roles": "Rollen: {roles}",
1094
+ "impersonation.preview.contentTypes": "Inhaltstypen",
1095
+ "impersonation.preview.noContentTypes": "Dieser Admin kann keinen Inhaltstyp im Content Manager öffnen.",
1096
+ "impersonation.preview.other": "Weitere Berechtigungen",
1097
+ "impersonation.preview.close": "Beenden und schließen",
1098
+ "impersonation.preview.start": "Berechtigungen ansehen",
1099
+ "adminPanel.actions.viewAs": "Als {name} ansehen",
1100
+ "adminPanel.actions.viewAsShort": "Ansehen als"
1008
1101
  };
1009
1102
  exports.default = de;
@@ -1002,7 +1002,100 @@ const de = {
1002
1002
  "adminPanel.activity.event.userExport": "Personenbezogene Daten exportiert",
1003
1003
  "adminPanel.activity.event.impersonation": "Als anderer Benutzer angemeldet",
1004
1004
  "adminPanel.activity.event.webhook": "Webhook-Zustellung",
1005
- "adminPanel.activity.settingsGroup": "{tab}: {fields}"
1005
+ "adminPanel.activity.settingsGroup": "{tab}: {fields}",
1006
+ "impersonation.error.disabled": "Die Identitätsübernahme ist in den Einstellungen ausgeschaltet.",
1007
+ "impersonation.error.alreadyActive": "Für diesen Benutzer läuft bereits eine Identitätsübernahme. Beenden Sie sie zuerst.",
1008
+ "impersonation.error.blocked": "Gesperrte Konten können nicht übernommen werden.",
1009
+ "impersonation.error.apiToken": "API-Token können keine Identität übernehmen.",
1010
+ "impersonation.result.copied": "In die Zwischenablage kopiert.",
1011
+ "impersonation.result.copyFailed": "Kopieren fehlgeschlagen. Markieren und kopieren Sie den Text selbst.",
1012
+ "impersonation.result.copy": "{name} kopieren",
1013
+ "impersonation.error.rateLimited": "Es wurden zu viele Identitätsübernahmen gestartet. Versuchen Sie es in einigen Minuten erneut.",
1014
+ "impersonation.error.start": "Die Identitätsübernahme konnte nicht gestartet werden.",
1015
+ "impersonation.ended": "Identitätsübernahme beendet.",
1016
+ "impersonation.error.end": "Die Identitätsübernahme konnte nicht beendet werden.",
1017
+ "impersonation.error.frontend": "Das Frontend konnte nicht geöffnet werden.",
1018
+ "impersonation.result.title": "Sie handeln als {user}",
1019
+ "impersonation.modal.title": "Als {user} anmelden",
1020
+ "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.",
1022
+ "impersonation.reason.label": "Grund",
1023
+ "impersonation.reason.placeholder": "Zum Beispiel: Ticket 4711",
1024
+ "impersonation.duration.label": "Dauer",
1025
+ "impersonation.duration.minutes": "{count, plural, one {# Minute} other {# Minuten}}",
1026
+ "impersonation.notify.label": "Den Benutzer per E-Mail informieren, dass sein Konto geöffnet wurde",
1027
+ "impersonation.notify.hint": "Wird über das E-Mail-Plugin von Strapi gesendet, mit Grund und Dauer.",
1028
+ "impersonation.result.frontendBody": "Öffnen Sie {origin} innerhalb einer Minute. Der Anmeldelink funktioniert einmal und wird gesendet, ohne in der Adresszeile zu erscheinen.",
1029
+ "impersonation.result.openFrontend": "Frontend öffnen",
1030
+ "impersonation.result.tokenBody": "Wird nur einmal angezeigt. Wer dieses Token hat, handelt bis zum Ende als {user}. Speichern oder teilen Sie es nicht.",
1031
+ "impersonation.result.accessToken": "Zugriffstoken",
1032
+ "impersonation.result.refreshToken": "Aktualisierungstoken",
1033
+ "impersonation.result.endsIn": "Endet in {time}.",
1034
+ "impersonation.end": "Identitätsübernahme beenden",
1035
+ "impersonation.result.done": "Fertig",
1036
+ "impersonation.start": "Identitätsübernahme starten",
1037
+ "impersonation.confirm.title": "Identitätsübernahme von {user} beenden?",
1038
+ "impersonation.confirm.body": "Die kurzlebige Anmeldung funktioniert sofort nicht mehr. Der Vorgang wird im Sicherheitsprotokoll festgehalten.",
1039
+ "impersonation.endLabel": "Identitätsübernahme von {user} beenden",
1040
+ "impersonation.list.you": "Sie",
1041
+ "impersonation.list.loading": "Identitätsübernahmen werden geladen…",
1042
+ "impersonation.list.error": "Die Identitätsübernahmen konnten nicht geladen werden.",
1043
+ "impersonation.list.errorBody": "Laufende Identitätsübernahmen enden trotzdem pünktlich; nur diese Liste fehlt.",
1044
+ "impersonation.list.empty": "Es läuft keine Identitätsübernahme. Starten Sie eine im Eintrag eines Benutzers im Content Manager.",
1045
+ "impersonation.list.col.user": "Benutzer",
1046
+ "impersonation.list.col.startedBy": "Gestartet von",
1047
+ "impersonation.list.col.reason": "Grund",
1048
+ "impersonation.list.col.ends": "Endet",
1049
+ "impersonation.list.col.actions": "Aktionen",
1050
+ "impersonation.list.summary": "{admin}, bis {time}",
1051
+ "impersonation.list.title": "Laufende Identitätsübernahmen",
1052
+ "impersonation.list.intro": "Jede endet von selbst zur angezeigten Zeit. Mit Beenden stoppen Sie sie sofort.",
1053
+ "impersonation.list.refresh": "Aktualisieren",
1054
+ "impersonation.list.refreshErrorTitle": "Nicht aktualisiert",
1055
+ "impersonation.list.refreshError": "Die Liste konnte nicht aktualisiert werden. Sie zeigt die zuletzt bekannten Identitätsübernahmen.",
1056
+ "impersonation.panel.title": "Identitätsübernahme",
1057
+ "impersonation.panel.running": "Läuft bis {time}.",
1058
+ "impersonation.panel.start": "Als Benutzer anmelden…",
1059
+ "settings.impersonation.intro": "Support-Mitarbeitende können bis zu einer Stunde als App-Benutzer handeln, um ein Problem nachzustellen; der Grund wird festgehalten. Wer das darf, legen Sie pro Rolle unter Einstellungen > Rollen > Session Manager fest.",
1060
+ "settings.impersonation.title": "Identitätsübernahme von App-Benutzern",
1061
+ "settings.impersonation.enable.label": "Identitätsübernahme erlauben",
1062
+ "settings.impersonation.enable.hint": "Standardmäßig aus. Beim Ausschalten enden alle laufenden Identitätsübernahmen sofort.",
1063
+ "settings.impersonation.notice": "Wer als eine Person handelt, verarbeitet deren personenbezogene Daten. Informieren Sie Ihre Benutzer in der Datenschutzerklärung, und prüfen Sie in Deutschland, ob der Betriebsrat zustimmen muss, weil das Protokoll zeigt, was jeder Admin getan hat.",
1064
+ "settings.config.tab.impersonation": "Identitätsübernahme",
1065
+ "impersonation.reason.tooShort": "Geben Sie einen Grund mit mindestens {min} Zeichen ein.",
1066
+ "impersonation.reason.tooLong": "Verwenden Sie höchstens {max} Zeichen.",
1067
+ "impersonation.error.csp": "Die Sicherheitseinstellungen von Strapi verhindern, dass die Anmeldung an {origin} gesendet wird. Fügen Sie diesen Ursprung zu form-action der Content-Security-Policy hinzu (siehe Dokumentation) und starten Sie erneut.",
1068
+ "impersonation.list.adminFallback": "Admin Nr. {id}",
1069
+ "impersonation.list.kind.admin": "Admin, nur Ansicht",
1070
+ "impersonation.preview.error.self": "Sie können sich nicht selbst als anderer Admin ansehen.",
1071
+ "impersonation.preview.error.superAdmin": "Super Admins können nicht als anderer Admin angesehen werden.",
1072
+ "impersonation.preview.error.notSubset": "Dieser Admin hat Berechtigungen, die Sie nicht haben. Deshalb können Sie ihn nicht ansehen.",
1073
+ "impersonation.preview.action.create": "Erstellen",
1074
+ "impersonation.preview.action.read": "Lesen",
1075
+ "impersonation.preview.action.update": "Bearbeiten",
1076
+ "impersonation.preview.action.delete": "Löschen",
1077
+ "impersonation.preview.action.publish": "Veröffentlichen",
1078
+ "impersonation.preview.condition.creator": "selbst erstellte Einträge",
1079
+ "impersonation.preview.condition.sameRole": "Einträge von Personen mit derselben Rolle",
1080
+ "impersonation.preview.restricted": "{action} (eingeschränkt)",
1081
+ "impersonation.preview.fields": "{action}: {count, plural, one {# Feld} other {# Felder}}",
1082
+ "impersonation.preview.conditions": "{action}: nur {conditions}",
1083
+ "impersonation.preview.error.start": "Die Vorschau konnte nicht geöffnet werden.",
1084
+ "impersonation.preview.ended": "Vorschau beendet.",
1085
+ "impersonation.preview.title": "Als {name} ansehen",
1086
+ "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
+ "impersonation.preview.reason.hint": "Wird im Sicherheitsprotokoll gespeichert.",
1088
+ "impersonation.preview.banner.ended": "Die Vorschau ist beendet.",
1089
+ "impersonation.preview.banner": "Sie sehen die Ansicht von {name} · nur lesen · endet in {time}",
1090
+ "impersonation.preview.end": "Beenden",
1091
+ "impersonation.preview.roles": "Rollen: {roles}",
1092
+ "impersonation.preview.contentTypes": "Inhaltstypen",
1093
+ "impersonation.preview.noContentTypes": "Dieser Admin kann keinen Inhaltstyp im Content Manager öffnen.",
1094
+ "impersonation.preview.other": "Weitere Berechtigungen",
1095
+ "impersonation.preview.close": "Beenden und schließen",
1096
+ "impersonation.preview.start": "Berechtigungen ansehen",
1097
+ "adminPanel.actions.viewAs": "Als {name} ansehen",
1098
+ "adminPanel.actions.viewAsShort": "Ansehen als"
1006
1099
  };
1007
1100
  export {
1008
1101
  de as default