strapi-plugin-magic-sessionmanager 4.22.1 → 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.
- package/CHANGELOG.md +31 -0
- package/README.md +116 -82
- package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
- package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
- package/dist/admin/{Analytics-CIHgaURb.mjs → Analytics-DGAHD19E.mjs} +1 -1
- package/dist/admin/{Analytics-B7BAjApz.js → Analytics-_WA68oHb.js} +1 -1
- package/dist/admin/{App-DJkJC06E.js → App-CfhAQ17e.js} +304 -104
- package/dist/admin/{App-CPE-CQGz.mjs → App-VB66H73A.mjs} +276 -76
- package/dist/admin/ImpersonationTabBanner-B6Ps5-oe.mjs +244 -0
- package/dist/admin/ImpersonationTabBanner-DdwXNmh4.js +244 -0
- package/dist/admin/{OnlineUsersWidget-Dou2hxGY.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CcjNfzzf.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
- package/dist/admin/{Settings--eEiHv_a.js → Settings-BBs2FDp7.js} +27 -229
- package/dist/admin/{Settings-h_exWUiI.mjs → Settings-CKDNGJhl.mjs} +19 -221
- package/dist/admin/{de-Wz5Emtrb.mjs → de-CK-HuY41.mjs} +42 -4
- package/dist/admin/{de-oBmcAcXj.js → de-CSRQPn6F.js} +42 -4
- package/dist/admin/{en-B1TN5F62.js → en-DCtAgGEa.js} +42 -4
- package/dist/admin/{en-B_1Ka64U.mjs → en-KZ5ajaAR.mjs} +42 -4
- package/dist/admin/{es-CVgw4zsj.mjs → es-B7k8taWV.mjs} +42 -4
- package/dist/admin/{es-Bb515J0p.js → es-CKT00l4K.js} +42 -4
- package/dist/admin/{fr-yDdwunmg.js → fr-B2EdBFSb.js} +42 -4
- package/dist/admin/{fr-0AgMxTFc.mjs → fr-Q2gmYqCn.mjs} +42 -4
- package/dist/admin/{index-DVQ7tdTC.mjs → index-BPbs1GyP.mjs} +365 -57
- package/dist/admin/{index-qtN2dOm4.js → index-Cho0XGZ1.js} +319 -11
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BAB07LY-.js → pt-CcMUcqDy.js} +42 -4
- package/dist/admin/{pt-DtM74ffN.mjs → pt-CmxZTaf2.mjs} +42 -4
- package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
- package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
- package/dist/server/index.js +867 -10
- package/dist/server/index.mjs +867 -10
- package/package.json +6 -2
- package/dist/admin/dashboardModel-DNT_l-Bk.js +0 -169
- package/dist/admin/dashboardModel-fApbKGay.mjs +0 -170
|
@@ -6,10 +6,10 @@ 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-Cho0XGZ1.js");
|
|
10
10
|
require("react-intl");
|
|
11
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
|
-
const
|
|
12
|
+
const ActiveImpersonationsCard = require("./ActiveImpersonationsCard-D1CVmV-w.js");
|
|
13
13
|
const symbols = require("@strapi/icons/symbols");
|
|
14
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -690,9 +690,9 @@ function sortLocks(locks) {
|
|
|
690
690
|
return Number.isFinite(until) && until !== 0 ? until : String(a.id).localeCompare(b.id);
|
|
691
691
|
});
|
|
692
692
|
}
|
|
693
|
-
const TABLE_MIN_WIDTH$
|
|
694
|
-
const keepActionKeys$
|
|
695
|
-
if (
|
|
693
|
+
const TABLE_MIN_WIDTH$1 = 640;
|
|
694
|
+
const keepActionKeys$1 = (event) => {
|
|
695
|
+
if (ActiveImpersonationsCard.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
696
696
|
};
|
|
697
697
|
const EMPTY_DRAFT = Object.freeze({
|
|
698
698
|
role: "",
|
|
@@ -778,10 +778,10 @@ const RoleRulesSection = ({ form }) => {
|
|
|
778
778
|
};
|
|
779
779
|
const fieldError = (key) => showErrors ? tError(draftErrors[key]) : void 0;
|
|
780
780
|
const availableRoles = (roles || []).filter((role) => !taken.includes(role.documentId));
|
|
781
|
-
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$
|
|
781
|
+
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$1;
|
|
782
782
|
const actions = (rule) => {
|
|
783
783
|
const name = roleName(rule.role);
|
|
784
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
784
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ActiveImpersonationsCard.RowActions, { onKeyDown: keepActionKeys$1, children: [
|
|
785
785
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
786
786
|
designSystem.IconButton,
|
|
787
787
|
{
|
|
@@ -2239,9 +2239,9 @@ function getAdjustedFields(submitted, stored, previous) {
|
|
|
2239
2239
|
(key) => !WRITE_ONLY_SETTINGS_KEYS.includes(key) && !areSettingsEqual(source[key], stored?.[key]) && (previous === void 0 || !areSettingsEqual(source[key], previous?.[key]))
|
|
2240
2240
|
);
|
|
2241
2241
|
}
|
|
2242
|
-
const TABLE_MIN_WIDTH
|
|
2243
|
-
const keepActionKeys
|
|
2244
|
-
if (
|
|
2242
|
+
const TABLE_MIN_WIDTH = 640;
|
|
2243
|
+
const keepActionKeys = (event) => {
|
|
2244
|
+
if (ActiveImpersonationsCard.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
2245
2245
|
};
|
|
2246
2246
|
const LockTarget = ({ lock }) => {
|
|
2247
2247
|
const { t } = index.useSettingsTranslate();
|
|
@@ -2360,7 +2360,7 @@ const LockedNowCard = () => {
|
|
|
2360
2360
|
}
|
|
2361
2361
|
};
|
|
2362
2362
|
const showActions = !permissionsLoading && canUnlock;
|
|
2363
|
-
const asTable = width === 0 || width >= TABLE_MIN_WIDTH
|
|
2363
|
+
const asTable = width === 0 || width >= TABLE_MIN_WIDTH;
|
|
2364
2364
|
const unlockAction = (lock) => showActions ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2365
2365
|
index.ConfirmAction,
|
|
2366
2366
|
{
|
|
@@ -2427,7 +2427,7 @@ const LockedNowCard = () => {
|
|
|
2427
2427
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(KindBadge, { kind: lock.kind }) }),
|
|
2428
2428
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
|
|
2429
2429
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: ends(lock) }),
|
|
2430
|
-
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2430
|
+
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard.RowActions, { onKeyDown: keepActionKeys, children: unlockAction(lock) }) }) : null
|
|
2431
2431
|
] }, lock.id)) })
|
|
2432
2432
|
] }) });
|
|
2433
2433
|
} else {
|
|
@@ -2450,7 +2450,7 @@ const LockedNowCard = () => {
|
|
|
2450
2450
|
}) })
|
|
2451
2451
|
] })
|
|
2452
2452
|
] }),
|
|
2453
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2453
|
+
/* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard.RowActions, { onKeyDown: keepActionKeys, children: unlockAction(lock) })
|
|
2454
2454
|
] })
|
|
2455
2455
|
},
|
|
2456
2456
|
lock.id
|
|
@@ -3133,8 +3133,8 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3133
3133
|
const lookupOff = !settings.enableGeolocation;
|
|
3134
3134
|
const locked = form.canChangeProtected === false;
|
|
3135
3135
|
const policyLocked = locked;
|
|
3136
|
-
const risk =
|
|
3137
|
-
const reject =
|
|
3136
|
+
const risk = ActiveImpersonationsCard.getRiskAvailability(form.geoIp.status);
|
|
3137
|
+
const reject = ActiveImpersonationsCard.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
3138
3138
|
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
3139
3139
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3140
3140
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -3852,7 +3852,7 @@ const RiskDataCard = ({ form }) => {
|
|
|
3852
3852
|
const { t } = index.useSettingsTranslate();
|
|
3853
3853
|
const { settings, geoIp } = form;
|
|
3854
3854
|
const lookupOff = !settings.enableGeolocation;
|
|
3855
|
-
const risk =
|
|
3855
|
+
const risk = ActiveImpersonationsCard.getRiskAvailability(geoIp.status);
|
|
3856
3856
|
const sourceLabels = {
|
|
3857
3857
|
"anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
|
|
3858
3858
|
"asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
|
|
@@ -3919,8 +3919,8 @@ const RiskDataCard = ({ form }) => {
|
|
|
3919
3919
|
const LocationDataTab = ({ form }) => {
|
|
3920
3920
|
const { t } = index.useSettingsTranslate();
|
|
3921
3921
|
const { settings, handleChange } = form;
|
|
3922
|
-
const risk =
|
|
3923
|
-
const scoring =
|
|
3922
|
+
const risk = ActiveImpersonationsCard.getRiskAvailability(form.geoIp.status);
|
|
3923
|
+
const scoring = ActiveImpersonationsCard.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
3924
3924
|
const locked = form.canChangeProtected === false;
|
|
3925
3925
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3926
3926
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
@@ -4742,7 +4742,7 @@ const AlertsTab = ({ form }) => {
|
|
|
4742
4742
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
4743
4743
|
const locked = form.canChangeProtected === false;
|
|
4744
4744
|
const templateErrors = index.fieldHasError(errors, "emailTemplates");
|
|
4745
|
-
const risk =
|
|
4745
|
+
const risk = ActiveImpersonationsCard.getRiskAvailability(form.geoIp.status);
|
|
4746
4746
|
const emailTypes = [
|
|
4747
4747
|
{
|
|
4748
4748
|
field: "alertOnSuspiciousLogin",
|
|
@@ -4829,7 +4829,7 @@ const AlertsTab = ({ form }) => {
|
|
|
4829
4829
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
|
|
4830
4830
|
!lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
|
|
4831
4831
|
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, needsTravel, hintId, label, hint }) => {
|
|
4832
|
-
const control = needsRiskData ?
|
|
4832
|
+
const control = needsRiskData ? ActiveImpersonationsCard.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
|
|
4833
4833
|
const travelOff = needsTravel && settings.impossibleTravelEnabled !== true;
|
|
4834
4834
|
const disabled = emailTypesDisabled || control.disabled || travelOff;
|
|
4835
4835
|
return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
|
|
@@ -5225,220 +5225,18 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5225
5225
|
)
|
|
5226
5226
|
] });
|
|
5227
5227
|
};
|
|
5228
|
-
const TABLE_MIN_WIDTH = 720;
|
|
5229
|
-
const keepActionKeys = (event) => {
|
|
5230
|
-
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
5231
|
-
};
|
|
5232
|
-
const ActiveImpersonationsCard = () => {
|
|
5233
|
-
const { t } = index.useSettingsTranslate();
|
|
5234
|
-
const { get, post } = StrapiAdmin.useFetchClient();
|
|
5235
|
-
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
5236
|
-
const { formatDate } = index.useSessionFormatters();
|
|
5237
|
-
const [widthRef, width] = index.useElementWidth();
|
|
5238
|
-
const [rows, setRows] = react.useState(null);
|
|
5239
|
-
const [error, setError] = react.useState(false);
|
|
5240
|
-
const [refreshing, setRefreshing] = react.useState(false);
|
|
5241
|
-
const refreshRef = react.useRef(null);
|
|
5242
|
-
const requestRef = react.useRef(0);
|
|
5243
|
-
const apply = react.useCallback(async (request, pending) => {
|
|
5244
|
-
try {
|
|
5245
|
-
const { data } = await pending;
|
|
5246
|
-
if (request !== requestRef.current) return;
|
|
5247
|
-
if (!Array.isArray(data?.data)) throw new Error("Invalid impersonation list");
|
|
5248
|
-
setRows(data.data);
|
|
5249
|
-
setError(false);
|
|
5250
|
-
} catch (err) {
|
|
5251
|
-
if (index.isCancelledRequest(err) || request !== requestRef.current) return;
|
|
5252
|
-
index.logSafeAdminError("impersonation.list", err);
|
|
5253
|
-
setError(true);
|
|
5254
|
-
} finally {
|
|
5255
|
-
if (request === requestRef.current) setRefreshing(false);
|
|
5256
|
-
}
|
|
5257
|
-
}, []);
|
|
5258
|
-
const load = react.useCallback(() => {
|
|
5259
|
-
const request = ++requestRef.current;
|
|
5260
|
-
setRefreshing(true);
|
|
5261
|
-
return apply(request, get(`/${index.pluginId}/impersonation/active`));
|
|
5262
|
-
}, [apply, get]);
|
|
5263
|
-
react.useEffect(() => {
|
|
5264
|
-
apply(++requestRef.current, get(`/${index.pluginId}/impersonation/active`));
|
|
5265
|
-
}, [apply, get]);
|
|
5266
|
-
const end = async (row) => {
|
|
5267
|
-
try {
|
|
5268
|
-
await post(`/${index.pluginId}/impersonation/${row.id}/end`, {});
|
|
5269
|
-
toggleNotification({
|
|
5270
|
-
type: "success",
|
|
5271
|
-
message: t("impersonation.ended", "Impersonation ended.")
|
|
5272
|
-
});
|
|
5273
|
-
} catch (err) {
|
|
5274
|
-
index.logSafeAdminError("impersonation.end", err);
|
|
5275
|
-
toggleNotification({
|
|
5276
|
-
type: "danger",
|
|
5277
|
-
message: t("impersonation.error.end", "The impersonation could not be ended.")
|
|
5278
|
-
});
|
|
5279
|
-
throw err;
|
|
5280
|
-
} finally {
|
|
5281
|
-
await load();
|
|
5282
|
-
}
|
|
5283
|
-
};
|
|
5284
|
-
const endAction = (row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5285
|
-
index.ConfirmAction,
|
|
5286
|
-
{
|
|
5287
|
-
fallbackFocusRef: refreshRef,
|
|
5288
|
-
title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
|
|
5289
|
-
user: label(row)
|
|
5290
|
-
}),
|
|
5291
|
-
body: t(
|
|
5292
|
-
"impersonation.confirm.body",
|
|
5293
|
-
"The short-lived sign-in stops working at once. This is recorded in the security log."
|
|
5294
|
-
),
|
|
5295
|
-
confirmLabel: t("impersonation.end", "End impersonation"),
|
|
5296
|
-
onConfirm: () => end(row),
|
|
5297
|
-
trigger: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5298
|
-
designSystem.IconButton,
|
|
5299
|
-
{
|
|
5300
|
-
variant: "ghost",
|
|
5301
|
-
label: t("impersonation.endLabel", "End impersonation of {user}", {
|
|
5302
|
-
user: label(row)
|
|
5303
|
-
}),
|
|
5304
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.SignOut, {})
|
|
5305
|
-
}
|
|
5306
|
-
)
|
|
5307
|
-
},
|
|
5308
|
-
row.id
|
|
5309
|
-
);
|
|
5310
|
-
const label = (row) => row.targetLabel || (row.targetType === "admin" ? t("impersonation.list.adminFallback", "Admin #{id}", { id: row.targetId }) : row.targetId);
|
|
5311
|
-
const kind = (row) => row.targetType === "admin" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "primary100", textColor: "neutral800", children: t("impersonation.list.kind.admin", "Admin, view only") }) : null;
|
|
5312
|
-
const time = (iso) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "time", dateTime: iso, variant: "omega", textColor: "neutral800", children: formatDate(iso, { hour: "2-digit", minute: "2-digit" }) });
|
|
5313
|
-
const startedBy = (row) => row.startedByYou ? t("impersonation.list.you", "You") : row.actorLabel || "—";
|
|
5314
|
-
let content;
|
|
5315
|
-
if (rows === null && !error) {
|
|
5316
|
-
content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: t("impersonation.list.loading", "Loading impersonations…") }) });
|
|
5317
|
-
} else if (error && rows === null) {
|
|
5318
|
-
content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5319
|
-
index.PersistentAlert,
|
|
5320
|
-
{
|
|
5321
|
-
variant: "danger",
|
|
5322
|
-
closeLabel: t("common.close", "Close"),
|
|
5323
|
-
title: t("impersonation.list.error", "Impersonations could not be loaded."),
|
|
5324
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: load, children: t("common.tryAgain", "Try again") }),
|
|
5325
|
-
children: t(
|
|
5326
|
-
"impersonation.list.errorBody",
|
|
5327
|
-
"Running impersonations still end on time; only this list is missing."
|
|
5328
|
-
)
|
|
5329
|
-
}
|
|
5330
|
-
);
|
|
5331
|
-
} else if (rows.length === 0) {
|
|
5332
|
-
content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5333
|
-
designSystem.EmptyStateLayout,
|
|
5334
|
-
{
|
|
5335
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyPermissions, { width: "16rem", height: "8rem" }),
|
|
5336
|
-
content: t(
|
|
5337
|
-
"impersonation.list.empty",
|
|
5338
|
-
"No impersonation is running. Start one from a user’s entry in the Content Manager."
|
|
5339
|
-
)
|
|
5340
|
-
}
|
|
5341
|
-
);
|
|
5342
|
-
} else if (width === 0 || width >= TABLE_MIN_WIDTH) {
|
|
5343
|
-
content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { hasRadius: true, borderColor: "neutral150", "data-impersonations-table": "", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 5, rowCount: rows.length + 1, "aria-busy": refreshing, children: [
|
|
5344
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
5345
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.user", "User") }) }),
|
|
5346
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.startedBy", "Started by") }) }),
|
|
5347
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.reason", "Reason") }) }),
|
|
5348
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.ends", "Ends") }) }),
|
|
5349
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: t("impersonation.list.col.actions", "Actions") }) })
|
|
5350
|
-
] }) }),
|
|
5351
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { "data-impersonation-row": "", children: [
|
|
5352
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
|
|
5353
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
|
|
5354
|
-
kind(row)
|
|
5355
|
-
] }) }),
|
|
5356
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: startedBy(row) }) }),
|
|
5357
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { maxWidth: 0, width: "40%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5358
|
-
designSystem.Typography,
|
|
5359
|
-
{
|
|
5360
|
-
variant: "omega",
|
|
5361
|
-
textColor: "neutral800",
|
|
5362
|
-
tag: "p",
|
|
5363
|
-
style: { overflowWrap: "anywhere" },
|
|
5364
|
-
children: row.reason
|
|
5365
|
-
}
|
|
5366
|
-
) }),
|
|
5367
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: time(row.expiresAt) }),
|
|
5368
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
|
|
5369
|
-
] }, row.id)) })
|
|
5370
|
-
] }) });
|
|
5371
|
-
} else {
|
|
5372
|
-
content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, tag: "ul", "data-impersonations-list": "", children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", padding: 4, hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [
|
|
5373
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
|
|
5374
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
|
|
5375
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
|
|
5376
|
-
kind(row)
|
|
5377
|
-
] }),
|
|
5378
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5379
|
-
designSystem.Typography,
|
|
5380
|
-
{
|
|
5381
|
-
variant: "pi",
|
|
5382
|
-
textColor: "neutral800",
|
|
5383
|
-
tag: "p",
|
|
5384
|
-
style: { overflowWrap: "anywhere" },
|
|
5385
|
-
children: row.reason
|
|
5386
|
-
}
|
|
5387
|
-
),
|
|
5388
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("impersonation.list.summary", "{admin}, until {time}", {
|
|
5389
|
-
admin: startedBy(row),
|
|
5390
|
-
time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
|
|
5391
|
-
}) })
|
|
5392
|
-
] }),
|
|
5393
|
-
/* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
|
|
5394
|
-
] }) }, row.id)) });
|
|
5395
|
-
}
|
|
5396
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5397
|
-
SectionCard.SectionCard,
|
|
5398
|
-
{
|
|
5399
|
-
id: "active-impersonations",
|
|
5400
|
-
title: t("impersonation.list.title", "Active impersonations"),
|
|
5401
|
-
subtitle: t(
|
|
5402
|
-
"impersonation.list.intro",
|
|
5403
|
-
"Each one ends by itself at the time shown. End stops it at once."
|
|
5404
|
-
),
|
|
5405
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5406
|
-
designSystem.Button,
|
|
5407
|
-
{
|
|
5408
|
-
ref: refreshRef,
|
|
5409
|
-
variant: "tertiary",
|
|
5410
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
|
|
5411
|
-
onClick: load,
|
|
5412
|
-
loading: refreshing && rows !== null,
|
|
5413
|
-
children: t("impersonation.list.refresh", "Refresh")
|
|
5414
|
-
}
|
|
5415
|
-
),
|
|
5416
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: widthRef, "aria-live": "polite", children: [
|
|
5417
|
-
error && rows !== null ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5418
|
-
index.PersistentAlert,
|
|
5419
|
-
{
|
|
5420
|
-
variant: "warning",
|
|
5421
|
-
closeLabel: t("common.close", "Close"),
|
|
5422
|
-
title: t("impersonation.list.refreshErrorTitle", "Not refreshed"),
|
|
5423
|
-
children: t(
|
|
5424
|
-
"impersonation.list.refreshError",
|
|
5425
|
-
"The list could not be refreshed. It shows the last known impersonations."
|
|
5426
|
-
)
|
|
5427
|
-
}
|
|
5428
|
-
) }) : null,
|
|
5429
|
-
content
|
|
5430
|
-
] })
|
|
5431
|
-
}
|
|
5432
|
-
);
|
|
5433
|
-
};
|
|
5434
5228
|
const ImpersonationTab = ({ form }) => {
|
|
5435
5229
|
const { t } = index.useSettingsTranslate();
|
|
5436
5230
|
const { settings, handleChange } = form;
|
|
5437
5231
|
const locked = form.canChangeProtected === false;
|
|
5438
5232
|
const {
|
|
5439
5233
|
isLoading,
|
|
5440
|
-
allowedActions: { canUsers, canAdmins }
|
|
5441
|
-
} = StrapiAdmin.useRBAC([
|
|
5234
|
+
allowedActions: { canUsers, canAdmins, canSignIn }
|
|
5235
|
+
} = StrapiAdmin.useRBAC([
|
|
5236
|
+
...index.pluginPermissions.impersonateUsers,
|
|
5237
|
+
...index.pluginPermissions.impersonateAdmins,
|
|
5238
|
+
...index.pluginPermissions.signInAsAdmin
|
|
5239
|
+
]);
|
|
5442
5240
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
5443
5241
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
5444
5242
|
"settings.impersonation.intro",
|
|
@@ -5463,7 +5261,7 @@ const ImpersonationTab = ({ form }) => {
|
|
|
5463
5261
|
) })
|
|
5464
5262
|
}
|
|
5465
5263
|
) }),
|
|
5466
|
-
!isLoading && (canUsers || canAdmins) ? /* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard, {}) : null
|
|
5264
|
+
!isLoading && (canUsers || canAdmins || canSignIn) ? /* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard.ActiveImpersonationsCard, {}) : null
|
|
5467
5265
|
] });
|
|
5468
5266
|
};
|
|
5469
5267
|
const INITIAL_SETTINGS = { ...SETTINGS_DEFAULTS, emailTemplates: fillMissingTemplates({}) };
|