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.
- package/CHANGELOG.md +80 -0
- package/README.md +163 -119
- package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
- package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
- package/dist/admin/{Analytics-WbCUmkQQ.mjs → Analytics-DGAHD19E.mjs} +1 -1
- package/dist/admin/{Analytics-DeDLGiCe.js → Analytics-_WA68oHb.js} +1 -1
- package/dist/admin/{App-Bkv-W0Sv.js → App-CfhAQ17e.js} +304 -104
- package/dist/admin/{App-C4bihk2K.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-q0Z6nbbO.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CSvNe2rC.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
- package/dist/admin/{Settings-xokFI5LO.js → Settings-BBs2FDp7.js} +87 -266
- package/dist/admin/{Settings-avD0DbXP.mjs → Settings-CKDNGJhl.mjs} +79 -258
- package/dist/admin/{de-BQlEdBMr.mjs → de-CK-HuY41.mjs} +48 -7
- package/dist/admin/{de-HcJ19LKI.js → de-CSRQPn6F.js} +48 -7
- package/dist/admin/{en-DI-98CPM.js → en-DCtAgGEa.js} +48 -7
- package/dist/admin/{en-DzuXWL1W.mjs → en-KZ5ajaAR.mjs} +48 -7
- package/dist/admin/{es-BfyED9YI.mjs → es-B7k8taWV.mjs} +48 -7
- package/dist/admin/{es-Cm0Eklav.js → es-CKT00l4K.js} +48 -7
- package/dist/admin/{fr-C3nzszsI.js → fr-B2EdBFSb.js} +48 -7
- package/dist/admin/{fr-CzFNGWq0.mjs → fr-Q2gmYqCn.mjs} +48 -7
- package/dist/admin/{index-6zc5D8eb.mjs → index-BPbs1GyP.mjs} +386 -61
- package/dist/admin/{index-Dk5Jqe5U.js → index-Cho0XGZ1.js} +340 -15
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BPZ6chPT.js → pt-CcMUcqDy.js} +48 -7
- package/dist/admin/{pt-DmyQnGI_.mjs → pt-CmxZTaf2.mjs} +48 -7
- package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
- package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
- package/dist/server/index.js +1809 -400
- package/dist/server/index.mjs +1809 -400
- package/package.json +9 -4
- package/dist/admin/dashboardModel-BBNRgcEr.mjs +0 -170
- package/dist/admin/dashboardModel-D4389iIV.js +0 -169
|
@@ -1080,7 +1080,13 @@ const pluginPermissions = {
|
|
|
1080
1080
|
* admin. The server also requires `access`, the switch and the
|
|
1081
1081
|
* anti-escalation rules.
|
|
1082
1082
|
*/
|
|
1083
|
-
impersonateAdmins: [{ action: `plugin::${pluginId$1}.impersonate.admins`, subject: null }]
|
|
1083
|
+
impersonateAdmins: [{ action: `plugin::${pluginId$1}.impersonate.admins`, subject: null }],
|
|
1084
|
+
/**
|
|
1085
|
+
* "Sign in as this admin" (4.23): a real admin session of another admin in
|
|
1086
|
+
* a separate tab. The server also requires `access`, the switch, a tested
|
|
1087
|
+
* Strapi release and the anti-escalation rules.
|
|
1088
|
+
*/
|
|
1089
|
+
signInAsAdmin: [{ action: `plugin::${pluginId$1}.impersonate.admins.sign-in`, subject: null }]
|
|
1084
1090
|
};
|
|
1085
1091
|
const SAFE_SCOPE = /^[A-Za-z0-9_.:-]{1,48}$/;
|
|
1086
1092
|
const CANCEL_NAMES = /* @__PURE__ */ new Set(["AbortError", "TimeoutError", "CanceledError"]);
|
|
@@ -1412,7 +1418,7 @@ const ImpersonateUserModal = ({
|
|
|
1412
1418
|
error: showReasonError ? tError(reasonError) : void 0,
|
|
1413
1419
|
hint: t(
|
|
1414
1420
|
"impersonation.reason.hint",
|
|
1415
|
-
"Stored in the security log
|
|
1421
|
+
"Stored in the security log for admins. The user sees it only in the optional email; their data export says only that an administrator opened the account."
|
|
1416
1422
|
),
|
|
1417
1423
|
children: [
|
|
1418
1424
|
/* @__PURE__ */ jsx(Field.Label, { children: t("impersonation.reason.label", "Reason") }),
|
|
@@ -1693,7 +1699,7 @@ const CSV_HEADERS = Object.freeze([
|
|
|
1693
1699
|
"Minutes Idle",
|
|
1694
1700
|
"End Reason"
|
|
1695
1701
|
]);
|
|
1696
|
-
const FORMULA_START = /^[\s\u00ad\u200b-\u200f\u2060-\u2064\ufeff]*[=+\-@\uff1d\uff0b\uff0d\uff20\t\r\n]/;
|
|
1702
|
+
const FORMULA_START = /^[\s\u00ad\u061c\u180e\u200b-\u200f\u2060-\u2064\ufeff]*[=+\-@\uff1d\uff0b\uff0d\uff20\t\r\n]/;
|
|
1697
1703
|
const escapeCsvValue = (value) => {
|
|
1698
1704
|
const text = String(value ?? "");
|
|
1699
1705
|
const safe = typeof value === "string" && FORMULA_START.test(text) ? `'${text}` : text;
|
|
@@ -1917,7 +1923,7 @@ const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
|
1917
1923
|
genericWebhookUrl: ["settings.signedWebhook.url.label", "Webhook URL"],
|
|
1918
1924
|
genericWebhookSecret: ["settings.signedWebhook.secret.label", "Signing secret"],
|
|
1919
1925
|
sessionIpAnonymize: ["settings.config.privacy.shortIp.label", "Shorten IP addresses of sessions"],
|
|
1920
|
-
trustedProxies: ["settings.config.clientIp.trustProxy.label", "
|
|
1926
|
+
trustedProxies: ["settings.config.clientIp.trustProxy.label", "Trusted proxies"],
|
|
1921
1927
|
blockSuspiciousSessions: [
|
|
1922
1928
|
"settings.config.suspicious.reject.label",
|
|
1923
1929
|
"Reject suspicious sign-ins"
|
|
@@ -2018,7 +2024,13 @@ function getRevealScrollDelta(listRect, tabRect) {
|
|
|
2018
2024
|
if (tabRect.right > listRect.right + 0.5) return Math.round(tabRect.right - listRect.right);
|
|
2019
2025
|
return 0;
|
|
2020
2026
|
}
|
|
2021
|
-
const SIGN_IN_FILTER_OPTIONS = Object.freeze([
|
|
2027
|
+
const SIGN_IN_FILTER_OPTIONS = Object.freeze([
|
|
2028
|
+
"all",
|
|
2029
|
+
"succeeded",
|
|
2030
|
+
"failed",
|
|
2031
|
+
"signed-out",
|
|
2032
|
+
"impersonation"
|
|
2033
|
+
]);
|
|
2022
2034
|
const ALL_ADMINS_FILTER_OPTIONS = Object.freeze([...SIGN_IN_FILTER_OPTIONS, "changes"]);
|
|
2023
2035
|
const ACTIVITY_ACTION_OPTIONS = Object.freeze([
|
|
2024
2036
|
"all",
|
|
@@ -2168,6 +2180,18 @@ function getEventPresentation(row) {
|
|
|
2168
2180
|
label: message$1("adminPanel.activity.event.purged", "Old events deleted"),
|
|
2169
2181
|
detail: null
|
|
2170
2182
|
};
|
|
2183
|
+
// 4.22.1: recorded once per key at start-up.
|
|
2184
|
+
case "config.encryption-key.weak":
|
|
2185
|
+
return {
|
|
2186
|
+
key: "weak-key",
|
|
2187
|
+
tone: "danger",
|
|
2188
|
+
icon: "settings",
|
|
2189
|
+
label: message$1("adminPanel.activity.event.weakKey", "Weak encryption key"),
|
|
2190
|
+
detail: message$1(
|
|
2191
|
+
"adminPanel.activity.event.weakKey.detail",
|
|
2192
|
+
"SESSION_ENCRYPTION_KEY is shorter than 32 bytes. The next major version will refuse to start with it."
|
|
2193
|
+
)
|
|
2194
|
+
};
|
|
2171
2195
|
// App-user events (4.17 / 4.18), listed by the app-user Security activity (4.22) only.
|
|
2172
2196
|
// The admin lists never return them; the labels are plain because that view is about app
|
|
2173
2197
|
// users already.
|
|
@@ -2275,6 +2299,14 @@ function getEventPresentation(row) {
|
|
|
2275
2299
|
"adminPanel.activity.event.impersonationExpired",
|
|
2276
2300
|
"Impersonation timed out"
|
|
2277
2301
|
);
|
|
2302
|
+
case "impersonation.write":
|
|
2303
|
+
return appUserEvent(
|
|
2304
|
+
"impersonation-write",
|
|
2305
|
+
"warning",
|
|
2306
|
+
"impersonation",
|
|
2307
|
+
"adminPanel.activity.event.impersonationWrite",
|
|
2308
|
+
"Change made while signed in as this admin"
|
|
2309
|
+
);
|
|
2278
2310
|
case "impersonation.refused":
|
|
2279
2311
|
return appUserEvent(
|
|
2280
2312
|
"impersonation-refused",
|
|
@@ -2590,6 +2622,11 @@ const IMPERSONATION_REFUSALS = Object.freeze({
|
|
|
2590
2622
|
"call-sessions": message(
|
|
2591
2623
|
"userActivity.detail.impersonation.callSessions",
|
|
2592
2624
|
"A request to end sessions was blocked"
|
|
2625
|
+
),
|
|
2626
|
+
// 4.22.1: every GraphQL mutation is refused while impersonating.
|
|
2627
|
+
"call-mutation": message(
|
|
2628
|
+
"userActivity.detail.impersonation.callMutation",
|
|
2629
|
+
"A GraphQL mutation was blocked"
|
|
2593
2630
|
)
|
|
2594
2631
|
});
|
|
2595
2632
|
const UNKNOWN_ACCOUNT = message(
|
|
@@ -2808,7 +2845,7 @@ const changedSettingsText = (t, keys, { limit } = {}) => {
|
|
|
2808
2845
|
}) : text;
|
|
2809
2846
|
};
|
|
2810
2847
|
const changedSettingsLines = (t, keys) => groupChangedSettings(keys).map((group) => settingsGroupText(t, group));
|
|
2811
|
-
const noAdminText = (t, row) => row?.event === "security-log.retention.purged" ? t("adminPanel.activity.system", "System") : t("adminPanel.activity.unknownAccount", "Unknown account");
|
|
2848
|
+
const noAdminText = (t, row) => row?.event === "security-log.retention.purged" || row?.event === "config.encryption-key.weak" ? t("adminPanel.activity.system", "System") : t("adminPanel.activity.unknownAccount", "Unknown account");
|
|
2812
2849
|
const deviceText = (t, row) => {
|
|
2813
2850
|
if (row.browser && row.os) {
|
|
2814
2851
|
return t("adminPanel.activity.browserOnOs", "{browser} on {os}", {
|
|
@@ -4507,6 +4544,290 @@ const SessionInfoPanel = ({ documentId, model, document: document2 }) => {
|
|
|
4507
4544
|
)
|
|
4508
4545
|
};
|
|
4509
4546
|
};
|
|
4547
|
+
const TAB_STATE_KEY = "magic-sessionmanager.admin-impersonation";
|
|
4548
|
+
const LANDING_PATH = "/plugins/magic-sessionmanager/impersonate/land";
|
|
4549
|
+
const CODE_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
4550
|
+
const COOKIE_NAME_PATTERN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]{1,64}$/;
|
|
4551
|
+
const TOKEN_KEY = "jwtToken";
|
|
4552
|
+
const STATUS_KEY = "isLoggedIn";
|
|
4553
|
+
function readTabState(win) {
|
|
4554
|
+
try {
|
|
4555
|
+
const raw = win.sessionStorage.getItem(TAB_STATE_KEY);
|
|
4556
|
+
const value = raw ? JSON.parse(raw) : null;
|
|
4557
|
+
return value && typeof value === "object" && typeof value.phase === "string" ? value : null;
|
|
4558
|
+
} catch {
|
|
4559
|
+
return null;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
function writeTabState(win, state) {
|
|
4563
|
+
try {
|
|
4564
|
+
if (state) win.sessionStorage.setItem(TAB_STATE_KEY, JSON.stringify(state));
|
|
4565
|
+
else win.sessionStorage.removeItem(TAB_STATE_KEY);
|
|
4566
|
+
} catch {
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
function landingBase(pathname) {
|
|
4570
|
+
const path = String(pathname || "").replace(/\/+$/, "");
|
|
4571
|
+
if (!path.endsWith(LANDING_PATH)) return null;
|
|
4572
|
+
return path.slice(0, path.length - LANDING_PATH.length);
|
|
4573
|
+
}
|
|
4574
|
+
function parseLandingHash(hash) {
|
|
4575
|
+
const params = new URLSearchParams(String(hash || "").replace(/^#/, ""));
|
|
4576
|
+
const code = params.get("code") || "";
|
|
4577
|
+
const cookieName = params.get("c") || "jwtToken";
|
|
4578
|
+
if (!CODE_PATTERN.test(code) || !COOKIE_NAME_PATTERN.test(cookieName)) return null;
|
|
4579
|
+
return { code, cookieName };
|
|
4580
|
+
}
|
|
4581
|
+
function landingUrl(adminBase2, handoff) {
|
|
4582
|
+
const params = new URLSearchParams({ code: handoff.code, c: handoff.cookieName || "jwtToken" });
|
|
4583
|
+
return `${String(adminBase2 || "").replace(/\/+$/, "")}${LANDING_PATH}#${params.toString()}`;
|
|
4584
|
+
}
|
|
4585
|
+
function cookieValue(cookies, name2) {
|
|
4586
|
+
let result = null;
|
|
4587
|
+
for (const part of String(cookies || "").split(";")) {
|
|
4588
|
+
const index2 = part.indexOf("=");
|
|
4589
|
+
if (index2 < 0) continue;
|
|
4590
|
+
if (part.slice(0, index2).trim() === name2) {
|
|
4591
|
+
try {
|
|
4592
|
+
result = decodeURIComponent(part.slice(index2 + 1).trim());
|
|
4593
|
+
} catch {
|
|
4594
|
+
result = null;
|
|
4595
|
+
}
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
return result;
|
|
4599
|
+
}
|
|
4600
|
+
function withoutCookie(cookies, name2) {
|
|
4601
|
+
return String(cookies || "").split(";").filter((part) => part.split("=")[0].trim() !== name2 && part.trim() !== "").map((part) => part.trim()).join("; ");
|
|
4602
|
+
}
|
|
4603
|
+
function readRealToken(win, cookieName) {
|
|
4604
|
+
try {
|
|
4605
|
+
const stored = win.localStorage.getItem(TOKEN_KEY);
|
|
4606
|
+
if (stored) return JSON.parse(stored);
|
|
4607
|
+
} catch {
|
|
4608
|
+
}
|
|
4609
|
+
try {
|
|
4610
|
+
return cookieValue(win.document.cookie, cookieName);
|
|
4611
|
+
} catch {
|
|
4612
|
+
return null;
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4615
|
+
function pathOf(win, input) {
|
|
4616
|
+
try {
|
|
4617
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input?.url || "";
|
|
4618
|
+
return new URL(url, win.location.href).pathname.replace(/\/+$/, "");
|
|
4619
|
+
} catch {
|
|
4620
|
+
return null;
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
function jsonResponse(win, status, body) {
|
|
4624
|
+
return new win.Response(JSON.stringify(body), {
|
|
4625
|
+
status,
|
|
4626
|
+
headers: { "Content-Type": "application/json" }
|
|
4627
|
+
});
|
|
4628
|
+
}
|
|
4629
|
+
function installTabShim(win, hooks = {}) {
|
|
4630
|
+
if (win.__msmImpersonationShim) return false;
|
|
4631
|
+
win.__msmImpersonationShim = true;
|
|
4632
|
+
const localStore = win.localStorage;
|
|
4633
|
+
const proto = win.Storage.prototype;
|
|
4634
|
+
const original = {
|
|
4635
|
+
getItem: proto.getItem,
|
|
4636
|
+
setItem: proto.setItem,
|
|
4637
|
+
removeItem: proto.removeItem
|
|
4638
|
+
};
|
|
4639
|
+
const shadowed = (store, key) => store === localStore && (key === TOKEN_KEY || key === STATUS_KEY) && readTabState(win) !== null;
|
|
4640
|
+
proto.getItem = function getItem(key) {
|
|
4641
|
+
if (shadowed(this, key)) {
|
|
4642
|
+
const state = readTabState(win);
|
|
4643
|
+
const active = state?.phase === "active" && typeof state.token === "string";
|
|
4644
|
+
if (key === TOKEN_KEY) return active ? JSON.stringify(state.token) : null;
|
|
4645
|
+
return active ? "true" : null;
|
|
4646
|
+
}
|
|
4647
|
+
return original.getItem.call(this, key);
|
|
4648
|
+
};
|
|
4649
|
+
proto.setItem = function setItem(key, value) {
|
|
4650
|
+
if (shadowed(this, key)) return void 0;
|
|
4651
|
+
return original.setItem.call(this, key, value);
|
|
4652
|
+
};
|
|
4653
|
+
proto.removeItem = function removeItem(key) {
|
|
4654
|
+
if (shadowed(this, key)) return void 0;
|
|
4655
|
+
return original.removeItem.call(this, key);
|
|
4656
|
+
};
|
|
4657
|
+
const cookieName = () => readTabState(win)?.cookieName || "jwtToken";
|
|
4658
|
+
const descriptor = Object.getOwnPropertyDescriptor(win.Document.prototype, "cookie");
|
|
4659
|
+
if (descriptor?.get && descriptor?.set) {
|
|
4660
|
+
Object.defineProperty(win.document, "cookie", {
|
|
4661
|
+
configurable: true,
|
|
4662
|
+
get() {
|
|
4663
|
+
const raw = descriptor.get.call(win.document);
|
|
4664
|
+
return readTabState(win) ? withoutCookie(raw, cookieName()) : raw;
|
|
4665
|
+
},
|
|
4666
|
+
set(value) {
|
|
4667
|
+
if (readTabState(win) && String(value).trim().startsWith(`${cookieName()}=`)) return;
|
|
4668
|
+
descriptor.set.call(win.document, value);
|
|
4669
|
+
}
|
|
4670
|
+
});
|
|
4671
|
+
}
|
|
4672
|
+
const originalFetch = win.fetch.bind(win);
|
|
4673
|
+
win.fetch = async (input, init) => {
|
|
4674
|
+
if (!readTabState(win)) return originalFetch(input, init);
|
|
4675
|
+
const path = pathOf(win, input) || "";
|
|
4676
|
+
if (/\/admin\/access-token$/.test(path)) {
|
|
4677
|
+
return jsonResponse(win, 401, {
|
|
4678
|
+
data: null,
|
|
4679
|
+
error: {
|
|
4680
|
+
status: 401,
|
|
4681
|
+
name: "UnauthorizedError",
|
|
4682
|
+
message: "An impersonation is not renewed",
|
|
4683
|
+
details: {}
|
|
4684
|
+
}
|
|
4685
|
+
});
|
|
4686
|
+
}
|
|
4687
|
+
if (/\/admin\/(login|register|register-admin|forgot-password|reset-password)$/.test(path)) {
|
|
4688
|
+
return jsonResponse(win, 403, {
|
|
4689
|
+
data: null,
|
|
4690
|
+
error: {
|
|
4691
|
+
status: 403,
|
|
4692
|
+
name: "ForbiddenError",
|
|
4693
|
+
message: "Not available in an impersonation tab",
|
|
4694
|
+
details: {}
|
|
4695
|
+
}
|
|
4696
|
+
});
|
|
4697
|
+
}
|
|
4698
|
+
if (/\/admin\/logout$/.test(path)) {
|
|
4699
|
+
hooks.onLogout?.();
|
|
4700
|
+
return jsonResponse(win, 200, { data: {} });
|
|
4701
|
+
}
|
|
4702
|
+
return originalFetch(input, init);
|
|
4703
|
+
};
|
|
4704
|
+
return true;
|
|
4705
|
+
}
|
|
4706
|
+
let landingCredential = null;
|
|
4707
|
+
let adminBase = null;
|
|
4708
|
+
let started = false;
|
|
4709
|
+
const backendURL = () => String(window.strapi?.backendURL || window.location.origin);
|
|
4710
|
+
const adminPath = () => {
|
|
4711
|
+
if (adminBase !== null) return adminBase;
|
|
4712
|
+
const stored = readTabState(window)?.adminBase;
|
|
4713
|
+
return typeof stored === "string" && /^(\/[A-Za-z0-9._~-]+)*$/.test(stored) ? stored : "/admin";
|
|
4714
|
+
};
|
|
4715
|
+
function markEnded(reason) {
|
|
4716
|
+
const state = readTabState(window);
|
|
4717
|
+
if (!state) return;
|
|
4718
|
+
writeTabState(window, {
|
|
4719
|
+
phase: state.phase === "landing" ? "failed" : "ended",
|
|
4720
|
+
cookieName: state.cookieName,
|
|
4721
|
+
adminBase: state.adminBase,
|
|
4722
|
+
impersonation: state.impersonation,
|
|
4723
|
+
reason
|
|
4724
|
+
});
|
|
4725
|
+
window.dispatchEvent(new Event("msm-impersonation-change"));
|
|
4726
|
+
}
|
|
4727
|
+
async function endImpersonation(reason = "ended") {
|
|
4728
|
+
const state = readTabState(window);
|
|
4729
|
+
if (state?.phase === "active" && state.token) {
|
|
4730
|
+
try {
|
|
4731
|
+
await window.fetch(`${backendURL()}/magic-sessionmanager/admin-impersonation/self/end`, {
|
|
4732
|
+
method: "POST",
|
|
4733
|
+
headers: { Authorization: `Bearer ${state.token}`, Accept: "application/json" }
|
|
4734
|
+
});
|
|
4735
|
+
} catch {
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
markEnded(reason);
|
|
4739
|
+
}
|
|
4740
|
+
function leaveImpersonationTab() {
|
|
4741
|
+
writeTabState(window, null);
|
|
4742
|
+
window.location.replace(`${adminPath()}/`);
|
|
4743
|
+
}
|
|
4744
|
+
function bootImpersonationTab() {
|
|
4745
|
+
if (typeof window === "undefined" || !window.sessionStorage) return;
|
|
4746
|
+
const base = landingBase(window.location.pathname);
|
|
4747
|
+
if (base !== null) {
|
|
4748
|
+
adminBase = base;
|
|
4749
|
+
const handoff = parseLandingHash(window.location.hash);
|
|
4750
|
+
window.history.replaceState(null, "", window.location.pathname);
|
|
4751
|
+
if (handoff && readTabState(window)?.phase !== "active") {
|
|
4752
|
+
landingCredential = readRealToken(window, handoff.cookieName);
|
|
4753
|
+
writeTabState(window, {
|
|
4754
|
+
phase: "landing",
|
|
4755
|
+
code: handoff.code,
|
|
4756
|
+
cookieName: handoff.cookieName,
|
|
4757
|
+
adminBase: base
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
const state = readTabState(window);
|
|
4762
|
+
if (!state) return;
|
|
4763
|
+
installTabShim(window, {
|
|
4764
|
+
onLogout: () => {
|
|
4765
|
+
endImpersonation("ended");
|
|
4766
|
+
}
|
|
4767
|
+
});
|
|
4768
|
+
}
|
|
4769
|
+
async function completeLanding() {
|
|
4770
|
+
const state = readTabState(window);
|
|
4771
|
+
if (state?.phase !== "landing") return;
|
|
4772
|
+
const credential = landingCredential;
|
|
4773
|
+
landingCredential = null;
|
|
4774
|
+
let data = null;
|
|
4775
|
+
if (credential && state.code) {
|
|
4776
|
+
try {
|
|
4777
|
+
const response = await window.fetch(
|
|
4778
|
+
`${backendURL()}/magic-sessionmanager/admin-impersonation/exchange`,
|
|
4779
|
+
{
|
|
4780
|
+
method: "POST",
|
|
4781
|
+
headers: {
|
|
4782
|
+
Authorization: `Bearer ${credential}`,
|
|
4783
|
+
"Content-Type": "application/json",
|
|
4784
|
+
Accept: "application/json"
|
|
4785
|
+
},
|
|
4786
|
+
body: JSON.stringify({ code: state.code })
|
|
4787
|
+
}
|
|
4788
|
+
);
|
|
4789
|
+
if (response.ok) data = (await response.json())?.data || null;
|
|
4790
|
+
} catch {
|
|
4791
|
+
data = null;
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
if (!data?.token) {
|
|
4795
|
+
writeTabState(window, {
|
|
4796
|
+
phase: "failed",
|
|
4797
|
+
cookieName: state.cookieName,
|
|
4798
|
+
adminBase: state.adminBase,
|
|
4799
|
+
reason: "exchange"
|
|
4800
|
+
});
|
|
4801
|
+
window.dispatchEvent(new Event("msm-impersonation-change"));
|
|
4802
|
+
return;
|
|
4803
|
+
}
|
|
4804
|
+
writeTabState(window, {
|
|
4805
|
+
phase: "active",
|
|
4806
|
+
token: data.token,
|
|
4807
|
+
expiresAt: data.expiresAt,
|
|
4808
|
+
cookieName: data.cookieName || state.cookieName,
|
|
4809
|
+
adminBase: state.adminBase,
|
|
4810
|
+
impersonation: data.impersonation
|
|
4811
|
+
});
|
|
4812
|
+
window.location.replace(`${adminPath()}/`);
|
|
4813
|
+
}
|
|
4814
|
+
function startImpersonationTab() {
|
|
4815
|
+
if (started || typeof window === "undefined") return;
|
|
4816
|
+
const state = readTabState(window);
|
|
4817
|
+
if (!state) return;
|
|
4818
|
+
started = true;
|
|
4819
|
+
if (state.phase === "landing") completeLanding();
|
|
4820
|
+
import("./ImpersonationTabBanner-B6Ps5-oe.mjs").then(
|
|
4821
|
+
({ mountImpersonationBanner }) => mountImpersonationBanner({
|
|
4822
|
+
end: endImpersonation,
|
|
4823
|
+
leave: leaveImpersonationTab,
|
|
4824
|
+
markEnded,
|
|
4825
|
+
backendURL
|
|
4826
|
+
})
|
|
4827
|
+
).catch(() => {
|
|
4828
|
+
});
|
|
4829
|
+
}
|
|
4830
|
+
bootImpersonationTab();
|
|
4510
4831
|
const prefixPluginTranslations = (data, pluginId2) => {
|
|
4511
4832
|
const prefixed = {};
|
|
4512
4833
|
Object.keys(data).forEach((key) => {
|
|
@@ -4518,6 +4839,7 @@ const name = pluginPkg.strapi.name;
|
|
|
4518
4839
|
const index = {
|
|
4519
4840
|
register(app) {
|
|
4520
4841
|
const pluginPermissions$1 = pluginPermissions.access;
|
|
4842
|
+
startImpersonationTab();
|
|
4521
4843
|
app.addMenuLink({
|
|
4522
4844
|
to: `plugins/${pluginId$1}`,
|
|
4523
4845
|
icon: PluginIcon,
|
|
@@ -4525,7 +4847,7 @@ const index = {
|
|
|
4525
4847
|
id: `${pluginId$1}.plugin.name`,
|
|
4526
4848
|
defaultMessage: pluginPkg.strapi.displayName
|
|
4527
4849
|
},
|
|
4528
|
-
Component: () => import("./App-
|
|
4850
|
+
Component: () => import("./App-VB66H73A.mjs"),
|
|
4529
4851
|
permissions: pluginPermissions$1
|
|
4530
4852
|
});
|
|
4531
4853
|
app.addSettingsLink(
|
|
@@ -4541,7 +4863,7 @@ const index = {
|
|
|
4541
4863
|
},
|
|
4542
4864
|
id: "general",
|
|
4543
4865
|
to: `${pluginId$1}/general`,
|
|
4544
|
-
Component: () => import("./Settings-
|
|
4866
|
+
Component: () => import("./Settings-CKDNGJhl.mjs"),
|
|
4545
4867
|
permissions: pluginPermissions$1
|
|
4546
4868
|
},
|
|
4547
4869
|
{
|
|
@@ -4551,7 +4873,7 @@ const index = {
|
|
|
4551
4873
|
},
|
|
4552
4874
|
id: "analytics",
|
|
4553
4875
|
to: `${pluginId$1}/analytics`,
|
|
4554
|
-
Component: () => import("./Analytics-
|
|
4876
|
+
Component: () => import("./Analytics-DGAHD19E.mjs"),
|
|
4555
4877
|
permissions: pluginPermissions$1
|
|
4556
4878
|
}
|
|
4557
4879
|
]
|
|
@@ -4577,7 +4899,7 @@ const index = {
|
|
|
4577
4899
|
href: `/plugins/${pluginId$1}`
|
|
4578
4900
|
},
|
|
4579
4901
|
component: async () => {
|
|
4580
|
-
const component = await import("./OnlineUsersWidget-
|
|
4902
|
+
const component = await import("./OnlineUsersWidget-2u-fYMb7.mjs");
|
|
4581
4903
|
return component.default;
|
|
4582
4904
|
},
|
|
4583
4905
|
id: "online-users-widget",
|
|
@@ -4598,11 +4920,11 @@ const index = {
|
|
|
4598
4920
|
},
|
|
4599
4921
|
async registerTrads({ locales }) {
|
|
4600
4922
|
const importedTrads = {
|
|
4601
|
-
en: () => import("./en-
|
|
4602
|
-
de: () => import("./de-
|
|
4603
|
-
es: () => import("./es-
|
|
4604
|
-
fr: () => import("./fr-
|
|
4605
|
-
pt: () => import("./pt-
|
|
4923
|
+
en: () => import("./en-KZ5ajaAR.mjs"),
|
|
4924
|
+
de: () => import("./de-CK-HuY41.mjs"),
|
|
4925
|
+
es: () => import("./es-B7k8taWV.mjs"),
|
|
4926
|
+
fr: () => import("./fr-Q2gmYqCn.mjs"),
|
|
4927
|
+
pt: () => import("./pt-CmxZTaf2.mjs")
|
|
4606
4928
|
};
|
|
4607
4929
|
const translatedLanguages = Object.keys(importedTrads).filter((lang) => locales.includes(lang));
|
|
4608
4930
|
const translations = await Promise.all(
|
|
@@ -4655,52 +4977,55 @@ export {
|
|
|
4655
4977
|
validateReason as a3,
|
|
4656
4978
|
REASON_MAX as a4,
|
|
4657
4979
|
formatClock as a5,
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4980
|
+
landingUrl as a6,
|
|
4981
|
+
parseAdminPanelQuery as a7,
|
|
4982
|
+
buildAdminListParams as a8,
|
|
4983
|
+
withIdentityPlaceholders as a9,
|
|
4984
|
+
refocusIfLost as aA,
|
|
4985
|
+
getErrorTab as aB,
|
|
4986
|
+
copyText as aC,
|
|
4987
|
+
buildSavePayload as aD,
|
|
4988
|
+
SETTINGS_FIELD_LABELS as aE,
|
|
4989
|
+
requireSuccessfulMutation as aF,
|
|
4990
|
+
getVisibleSettingsTabs as aG,
|
|
4991
|
+
resolveSettingsTab as aH,
|
|
4992
|
+
getRevealScrollDelta as aI,
|
|
4993
|
+
SETTINGS_TAB_LABELS as aJ,
|
|
4994
|
+
isSessionFilter as aK,
|
|
4995
|
+
DEFAULT_SESSION_FILTER as aL,
|
|
4996
|
+
isEndReasonFilter as aM,
|
|
4997
|
+
DEFAULT_END_REASON_FILTER as aN,
|
|
4998
|
+
normalizeDeviceType as aO,
|
|
4999
|
+
getDeviceTypeMessage as aP,
|
|
5000
|
+
readTabState as aQ,
|
|
5001
|
+
secondsUntil as aR,
|
|
5002
|
+
index as aS,
|
|
5003
|
+
ADMIN_FILTER_OPTIONS as aa,
|
|
5004
|
+
ADMIN_PAGE_SIZE_OPTIONS as ab,
|
|
5005
|
+
ADMIN_DEFAULT_PAGE_SIZE as ac,
|
|
5006
|
+
hasAdminFilters as ad,
|
|
5007
|
+
getSignOutErrorMessage as ae,
|
|
5008
|
+
splitDuration as af,
|
|
5009
|
+
parseActivityPageQuery as ag,
|
|
5010
|
+
EVENT_PAGE_SIZE as ah,
|
|
5011
|
+
ACTIVITY_PAGE_SIZE_OPTIONS as ai,
|
|
5012
|
+
ALL_ADMINS_FILTER_OPTIONS as aj,
|
|
5013
|
+
hasActivityPageFilters as ak,
|
|
5014
|
+
parseUserActivityQuery as al,
|
|
5015
|
+
userText as am,
|
|
5016
|
+
buildUserActivityCsv as an,
|
|
5017
|
+
USER_ACTIVITY_SETTINGS_PATH as ao,
|
|
5018
|
+
USER_ACTIVITY_FILTER_OPTIONS as ap,
|
|
5019
|
+
USER_ACTIVITY_FILTER_LABELS as aq,
|
|
5020
|
+
hasUserActivityFilters as ar,
|
|
5021
|
+
ReadableParagraphs as as,
|
|
5022
|
+
buildTabSearch as at,
|
|
5023
|
+
buildSelectOptions as au,
|
|
5024
|
+
EqualGrid as av,
|
|
5025
|
+
SELECT_PRESETS as aw,
|
|
5026
|
+
fieldHasError as ax,
|
|
5027
|
+
usesLocalDatabase as ay,
|
|
5028
|
+
formatSessionDate as az,
|
|
4704
5029
|
getTranslation as b,
|
|
4705
5030
|
getSessionStatus as c,
|
|
4706
5031
|
getDevicePresentation as d,
|