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
|
@@ -1083,7 +1083,13 @@ const pluginPermissions = {
|
|
|
1083
1083
|
* admin. The server also requires `access`, the switch and the
|
|
1084
1084
|
* anti-escalation rules.
|
|
1085
1085
|
*/
|
|
1086
|
-
impersonateAdmins: [{ action: `plugin::${pluginId$1}.impersonate.admins`, subject: null }]
|
|
1086
|
+
impersonateAdmins: [{ action: `plugin::${pluginId$1}.impersonate.admins`, subject: null }],
|
|
1087
|
+
/**
|
|
1088
|
+
* "Sign in as this admin" (4.23): a real admin session of another admin in
|
|
1089
|
+
* a separate tab. The server also requires `access`, the switch, a tested
|
|
1090
|
+
* Strapi release and the anti-escalation rules.
|
|
1091
|
+
*/
|
|
1092
|
+
signInAsAdmin: [{ action: `plugin::${pluginId$1}.impersonate.admins.sign-in`, subject: null }]
|
|
1087
1093
|
};
|
|
1088
1094
|
const SAFE_SCOPE = /^[A-Za-z0-9_.:-]{1,48}$/;
|
|
1089
1095
|
const CANCEL_NAMES = /* @__PURE__ */ new Set(["AbortError", "TimeoutError", "CanceledError"]);
|
|
@@ -1415,7 +1421,7 @@ const ImpersonateUserModal = ({
|
|
|
1415
1421
|
error: showReasonError ? tError(reasonError) : void 0,
|
|
1416
1422
|
hint: t(
|
|
1417
1423
|
"impersonation.reason.hint",
|
|
1418
|
-
"Stored in the security log
|
|
1424
|
+
"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."
|
|
1419
1425
|
),
|
|
1420
1426
|
children: [
|
|
1421
1427
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("impersonation.reason.label", "Reason") }),
|
|
@@ -1696,7 +1702,7 @@ const CSV_HEADERS = Object.freeze([
|
|
|
1696
1702
|
"Minutes Idle",
|
|
1697
1703
|
"End Reason"
|
|
1698
1704
|
]);
|
|
1699
|
-
const FORMULA_START = /^[\s\u00ad\u200b-\u200f\u2060-\u2064\ufeff]*[=+\-@\uff1d\uff0b\uff0d\uff20\t\r\n]/;
|
|
1705
|
+
const FORMULA_START = /^[\s\u00ad\u061c\u180e\u200b-\u200f\u2060-\u2064\ufeff]*[=+\-@\uff1d\uff0b\uff0d\uff20\t\r\n]/;
|
|
1700
1706
|
const escapeCsvValue = (value) => {
|
|
1701
1707
|
const text = String(value ?? "");
|
|
1702
1708
|
const safe = typeof value === "string" && FORMULA_START.test(text) ? `'${text}` : text;
|
|
@@ -1920,7 +1926,7 @@ const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
|
1920
1926
|
genericWebhookUrl: ["settings.signedWebhook.url.label", "Webhook URL"],
|
|
1921
1927
|
genericWebhookSecret: ["settings.signedWebhook.secret.label", "Signing secret"],
|
|
1922
1928
|
sessionIpAnonymize: ["settings.config.privacy.shortIp.label", "Shorten IP addresses of sessions"],
|
|
1923
|
-
trustedProxies: ["settings.config.clientIp.trustProxy.label", "
|
|
1929
|
+
trustedProxies: ["settings.config.clientIp.trustProxy.label", "Trusted proxies"],
|
|
1924
1930
|
blockSuspiciousSessions: [
|
|
1925
1931
|
"settings.config.suspicious.reject.label",
|
|
1926
1932
|
"Reject suspicious sign-ins"
|
|
@@ -2021,7 +2027,13 @@ function getRevealScrollDelta(listRect, tabRect) {
|
|
|
2021
2027
|
if (tabRect.right > listRect.right + 0.5) return Math.round(tabRect.right - listRect.right);
|
|
2022
2028
|
return 0;
|
|
2023
2029
|
}
|
|
2024
|
-
const SIGN_IN_FILTER_OPTIONS = Object.freeze([
|
|
2030
|
+
const SIGN_IN_FILTER_OPTIONS = Object.freeze([
|
|
2031
|
+
"all",
|
|
2032
|
+
"succeeded",
|
|
2033
|
+
"failed",
|
|
2034
|
+
"signed-out",
|
|
2035
|
+
"impersonation"
|
|
2036
|
+
]);
|
|
2025
2037
|
const ALL_ADMINS_FILTER_OPTIONS = Object.freeze([...SIGN_IN_FILTER_OPTIONS, "changes"]);
|
|
2026
2038
|
const ACTIVITY_ACTION_OPTIONS = Object.freeze([
|
|
2027
2039
|
"all",
|
|
@@ -2171,6 +2183,18 @@ function getEventPresentation(row) {
|
|
|
2171
2183
|
label: message$1("adminPanel.activity.event.purged", "Old events deleted"),
|
|
2172
2184
|
detail: null
|
|
2173
2185
|
};
|
|
2186
|
+
// 4.22.1: recorded once per key at start-up.
|
|
2187
|
+
case "config.encryption-key.weak":
|
|
2188
|
+
return {
|
|
2189
|
+
key: "weak-key",
|
|
2190
|
+
tone: "danger",
|
|
2191
|
+
icon: "settings",
|
|
2192
|
+
label: message$1("adminPanel.activity.event.weakKey", "Weak encryption key"),
|
|
2193
|
+
detail: message$1(
|
|
2194
|
+
"adminPanel.activity.event.weakKey.detail",
|
|
2195
|
+
"SESSION_ENCRYPTION_KEY is shorter than 32 bytes. The next major version will refuse to start with it."
|
|
2196
|
+
)
|
|
2197
|
+
};
|
|
2174
2198
|
// App-user events (4.17 / 4.18), listed by the app-user Security activity (4.22) only.
|
|
2175
2199
|
// The admin lists never return them; the labels are plain because that view is about app
|
|
2176
2200
|
// users already.
|
|
@@ -2278,6 +2302,14 @@ function getEventPresentation(row) {
|
|
|
2278
2302
|
"adminPanel.activity.event.impersonationExpired",
|
|
2279
2303
|
"Impersonation timed out"
|
|
2280
2304
|
);
|
|
2305
|
+
case "impersonation.write":
|
|
2306
|
+
return appUserEvent(
|
|
2307
|
+
"impersonation-write",
|
|
2308
|
+
"warning",
|
|
2309
|
+
"impersonation",
|
|
2310
|
+
"adminPanel.activity.event.impersonationWrite",
|
|
2311
|
+
"Change made while signed in as this admin"
|
|
2312
|
+
);
|
|
2281
2313
|
case "impersonation.refused":
|
|
2282
2314
|
return appUserEvent(
|
|
2283
2315
|
"impersonation-refused",
|
|
@@ -2593,6 +2625,11 @@ const IMPERSONATION_REFUSALS = Object.freeze({
|
|
|
2593
2625
|
"call-sessions": message(
|
|
2594
2626
|
"userActivity.detail.impersonation.callSessions",
|
|
2595
2627
|
"A request to end sessions was blocked"
|
|
2628
|
+
),
|
|
2629
|
+
// 4.22.1: every GraphQL mutation is refused while impersonating.
|
|
2630
|
+
"call-mutation": message(
|
|
2631
|
+
"userActivity.detail.impersonation.callMutation",
|
|
2632
|
+
"A GraphQL mutation was blocked"
|
|
2596
2633
|
)
|
|
2597
2634
|
});
|
|
2598
2635
|
const UNKNOWN_ACCOUNT = message(
|
|
@@ -2811,7 +2848,7 @@ const changedSettingsText = (t, keys, { limit } = {}) => {
|
|
|
2811
2848
|
}) : text;
|
|
2812
2849
|
};
|
|
2813
2850
|
const changedSettingsLines = (t, keys) => groupChangedSettings(keys).map((group) => settingsGroupText(t, group));
|
|
2814
|
-
const noAdminText = (t, row) => row?.event === "security-log.retention.purged" ? t("adminPanel.activity.system", "System") : t("adminPanel.activity.unknownAccount", "Unknown account");
|
|
2851
|
+
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");
|
|
2815
2852
|
const deviceText = (t, row) => {
|
|
2816
2853
|
if (row.browser && row.os) {
|
|
2817
2854
|
return t("adminPanel.activity.browserOnOs", "{browser} on {os}", {
|
|
@@ -4510,6 +4547,290 @@ const SessionInfoPanel = ({ documentId, model, document: document2 }) => {
|
|
|
4510
4547
|
)
|
|
4511
4548
|
};
|
|
4512
4549
|
};
|
|
4550
|
+
const TAB_STATE_KEY = "magic-sessionmanager.admin-impersonation";
|
|
4551
|
+
const LANDING_PATH = "/plugins/magic-sessionmanager/impersonate/land";
|
|
4552
|
+
const CODE_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
4553
|
+
const COOKIE_NAME_PATTERN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]{1,64}$/;
|
|
4554
|
+
const TOKEN_KEY = "jwtToken";
|
|
4555
|
+
const STATUS_KEY = "isLoggedIn";
|
|
4556
|
+
function readTabState(win) {
|
|
4557
|
+
try {
|
|
4558
|
+
const raw = win.sessionStorage.getItem(TAB_STATE_KEY);
|
|
4559
|
+
const value = raw ? JSON.parse(raw) : null;
|
|
4560
|
+
return value && typeof value === "object" && typeof value.phase === "string" ? value : null;
|
|
4561
|
+
} catch {
|
|
4562
|
+
return null;
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
function writeTabState(win, state) {
|
|
4566
|
+
try {
|
|
4567
|
+
if (state) win.sessionStorage.setItem(TAB_STATE_KEY, JSON.stringify(state));
|
|
4568
|
+
else win.sessionStorage.removeItem(TAB_STATE_KEY);
|
|
4569
|
+
} catch {
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
function landingBase(pathname) {
|
|
4573
|
+
const path = String(pathname || "").replace(/\/+$/, "");
|
|
4574
|
+
if (!path.endsWith(LANDING_PATH)) return null;
|
|
4575
|
+
return path.slice(0, path.length - LANDING_PATH.length);
|
|
4576
|
+
}
|
|
4577
|
+
function parseLandingHash(hash) {
|
|
4578
|
+
const params = new URLSearchParams(String(hash || "").replace(/^#/, ""));
|
|
4579
|
+
const code = params.get("code") || "";
|
|
4580
|
+
const cookieName = params.get("c") || "jwtToken";
|
|
4581
|
+
if (!CODE_PATTERN.test(code) || !COOKIE_NAME_PATTERN.test(cookieName)) return null;
|
|
4582
|
+
return { code, cookieName };
|
|
4583
|
+
}
|
|
4584
|
+
function landingUrl(adminBase2, handoff) {
|
|
4585
|
+
const params = new URLSearchParams({ code: handoff.code, c: handoff.cookieName || "jwtToken" });
|
|
4586
|
+
return `${String(adminBase2 || "").replace(/\/+$/, "")}${LANDING_PATH}#${params.toString()}`;
|
|
4587
|
+
}
|
|
4588
|
+
function cookieValue(cookies, name2) {
|
|
4589
|
+
let result = null;
|
|
4590
|
+
for (const part of String(cookies || "").split(";")) {
|
|
4591
|
+
const index2 = part.indexOf("=");
|
|
4592
|
+
if (index2 < 0) continue;
|
|
4593
|
+
if (part.slice(0, index2).trim() === name2) {
|
|
4594
|
+
try {
|
|
4595
|
+
result = decodeURIComponent(part.slice(index2 + 1).trim());
|
|
4596
|
+
} catch {
|
|
4597
|
+
result = null;
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
return result;
|
|
4602
|
+
}
|
|
4603
|
+
function withoutCookie(cookies, name2) {
|
|
4604
|
+
return String(cookies || "").split(";").filter((part) => part.split("=")[0].trim() !== name2 && part.trim() !== "").map((part) => part.trim()).join("; ");
|
|
4605
|
+
}
|
|
4606
|
+
function readRealToken(win, cookieName) {
|
|
4607
|
+
try {
|
|
4608
|
+
const stored = win.localStorage.getItem(TOKEN_KEY);
|
|
4609
|
+
if (stored) return JSON.parse(stored);
|
|
4610
|
+
} catch {
|
|
4611
|
+
}
|
|
4612
|
+
try {
|
|
4613
|
+
return cookieValue(win.document.cookie, cookieName);
|
|
4614
|
+
} catch {
|
|
4615
|
+
return null;
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
function pathOf(win, input) {
|
|
4619
|
+
try {
|
|
4620
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input?.url || "";
|
|
4621
|
+
return new URL(url, win.location.href).pathname.replace(/\/+$/, "");
|
|
4622
|
+
} catch {
|
|
4623
|
+
return null;
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
function jsonResponse(win, status, body) {
|
|
4627
|
+
return new win.Response(JSON.stringify(body), {
|
|
4628
|
+
status,
|
|
4629
|
+
headers: { "Content-Type": "application/json" }
|
|
4630
|
+
});
|
|
4631
|
+
}
|
|
4632
|
+
function installTabShim(win, hooks = {}) {
|
|
4633
|
+
if (win.__msmImpersonationShim) return false;
|
|
4634
|
+
win.__msmImpersonationShim = true;
|
|
4635
|
+
const localStore = win.localStorage;
|
|
4636
|
+
const proto = win.Storage.prototype;
|
|
4637
|
+
const original = {
|
|
4638
|
+
getItem: proto.getItem,
|
|
4639
|
+
setItem: proto.setItem,
|
|
4640
|
+
removeItem: proto.removeItem
|
|
4641
|
+
};
|
|
4642
|
+
const shadowed = (store, key) => store === localStore && (key === TOKEN_KEY || key === STATUS_KEY) && readTabState(win) !== null;
|
|
4643
|
+
proto.getItem = function getItem(key) {
|
|
4644
|
+
if (shadowed(this, key)) {
|
|
4645
|
+
const state = readTabState(win);
|
|
4646
|
+
const active = state?.phase === "active" && typeof state.token === "string";
|
|
4647
|
+
if (key === TOKEN_KEY) return active ? JSON.stringify(state.token) : null;
|
|
4648
|
+
return active ? "true" : null;
|
|
4649
|
+
}
|
|
4650
|
+
return original.getItem.call(this, key);
|
|
4651
|
+
};
|
|
4652
|
+
proto.setItem = function setItem(key, value) {
|
|
4653
|
+
if (shadowed(this, key)) return void 0;
|
|
4654
|
+
return original.setItem.call(this, key, value);
|
|
4655
|
+
};
|
|
4656
|
+
proto.removeItem = function removeItem(key) {
|
|
4657
|
+
if (shadowed(this, key)) return void 0;
|
|
4658
|
+
return original.removeItem.call(this, key);
|
|
4659
|
+
};
|
|
4660
|
+
const cookieName = () => readTabState(win)?.cookieName || "jwtToken";
|
|
4661
|
+
const descriptor = Object.getOwnPropertyDescriptor(win.Document.prototype, "cookie");
|
|
4662
|
+
if (descriptor?.get && descriptor?.set) {
|
|
4663
|
+
Object.defineProperty(win.document, "cookie", {
|
|
4664
|
+
configurable: true,
|
|
4665
|
+
get() {
|
|
4666
|
+
const raw = descriptor.get.call(win.document);
|
|
4667
|
+
return readTabState(win) ? withoutCookie(raw, cookieName()) : raw;
|
|
4668
|
+
},
|
|
4669
|
+
set(value) {
|
|
4670
|
+
if (readTabState(win) && String(value).trim().startsWith(`${cookieName()}=`)) return;
|
|
4671
|
+
descriptor.set.call(win.document, value);
|
|
4672
|
+
}
|
|
4673
|
+
});
|
|
4674
|
+
}
|
|
4675
|
+
const originalFetch = win.fetch.bind(win);
|
|
4676
|
+
win.fetch = async (input, init) => {
|
|
4677
|
+
if (!readTabState(win)) return originalFetch(input, init);
|
|
4678
|
+
const path = pathOf(win, input) || "";
|
|
4679
|
+
if (/\/admin\/access-token$/.test(path)) {
|
|
4680
|
+
return jsonResponse(win, 401, {
|
|
4681
|
+
data: null,
|
|
4682
|
+
error: {
|
|
4683
|
+
status: 401,
|
|
4684
|
+
name: "UnauthorizedError",
|
|
4685
|
+
message: "An impersonation is not renewed",
|
|
4686
|
+
details: {}
|
|
4687
|
+
}
|
|
4688
|
+
});
|
|
4689
|
+
}
|
|
4690
|
+
if (/\/admin\/(login|register|register-admin|forgot-password|reset-password)$/.test(path)) {
|
|
4691
|
+
return jsonResponse(win, 403, {
|
|
4692
|
+
data: null,
|
|
4693
|
+
error: {
|
|
4694
|
+
status: 403,
|
|
4695
|
+
name: "ForbiddenError",
|
|
4696
|
+
message: "Not available in an impersonation tab",
|
|
4697
|
+
details: {}
|
|
4698
|
+
}
|
|
4699
|
+
});
|
|
4700
|
+
}
|
|
4701
|
+
if (/\/admin\/logout$/.test(path)) {
|
|
4702
|
+
hooks.onLogout?.();
|
|
4703
|
+
return jsonResponse(win, 200, { data: {} });
|
|
4704
|
+
}
|
|
4705
|
+
return originalFetch(input, init);
|
|
4706
|
+
};
|
|
4707
|
+
return true;
|
|
4708
|
+
}
|
|
4709
|
+
let landingCredential = null;
|
|
4710
|
+
let adminBase = null;
|
|
4711
|
+
let started = false;
|
|
4712
|
+
const backendURL = () => String(window.strapi?.backendURL || window.location.origin);
|
|
4713
|
+
const adminPath = () => {
|
|
4714
|
+
if (adminBase !== null) return adminBase;
|
|
4715
|
+
const stored = readTabState(window)?.adminBase;
|
|
4716
|
+
return typeof stored === "string" && /^(\/[A-Za-z0-9._~-]+)*$/.test(stored) ? stored : "/admin";
|
|
4717
|
+
};
|
|
4718
|
+
function markEnded(reason) {
|
|
4719
|
+
const state = readTabState(window);
|
|
4720
|
+
if (!state) return;
|
|
4721
|
+
writeTabState(window, {
|
|
4722
|
+
phase: state.phase === "landing" ? "failed" : "ended",
|
|
4723
|
+
cookieName: state.cookieName,
|
|
4724
|
+
adminBase: state.adminBase,
|
|
4725
|
+
impersonation: state.impersonation,
|
|
4726
|
+
reason
|
|
4727
|
+
});
|
|
4728
|
+
window.dispatchEvent(new Event("msm-impersonation-change"));
|
|
4729
|
+
}
|
|
4730
|
+
async function endImpersonation(reason = "ended") {
|
|
4731
|
+
const state = readTabState(window);
|
|
4732
|
+
if (state?.phase === "active" && state.token) {
|
|
4733
|
+
try {
|
|
4734
|
+
await window.fetch(`${backendURL()}/magic-sessionmanager/admin-impersonation/self/end`, {
|
|
4735
|
+
method: "POST",
|
|
4736
|
+
headers: { Authorization: `Bearer ${state.token}`, Accept: "application/json" }
|
|
4737
|
+
});
|
|
4738
|
+
} catch {
|
|
4739
|
+
}
|
|
4740
|
+
}
|
|
4741
|
+
markEnded(reason);
|
|
4742
|
+
}
|
|
4743
|
+
function leaveImpersonationTab() {
|
|
4744
|
+
writeTabState(window, null);
|
|
4745
|
+
window.location.replace(`${adminPath()}/`);
|
|
4746
|
+
}
|
|
4747
|
+
function bootImpersonationTab() {
|
|
4748
|
+
if (typeof window === "undefined" || !window.sessionStorage) return;
|
|
4749
|
+
const base = landingBase(window.location.pathname);
|
|
4750
|
+
if (base !== null) {
|
|
4751
|
+
adminBase = base;
|
|
4752
|
+
const handoff = parseLandingHash(window.location.hash);
|
|
4753
|
+
window.history.replaceState(null, "", window.location.pathname);
|
|
4754
|
+
if (handoff && readTabState(window)?.phase !== "active") {
|
|
4755
|
+
landingCredential = readRealToken(window, handoff.cookieName);
|
|
4756
|
+
writeTabState(window, {
|
|
4757
|
+
phase: "landing",
|
|
4758
|
+
code: handoff.code,
|
|
4759
|
+
cookieName: handoff.cookieName,
|
|
4760
|
+
adminBase: base
|
|
4761
|
+
});
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4764
|
+
const state = readTabState(window);
|
|
4765
|
+
if (!state) return;
|
|
4766
|
+
installTabShim(window, {
|
|
4767
|
+
onLogout: () => {
|
|
4768
|
+
endImpersonation("ended");
|
|
4769
|
+
}
|
|
4770
|
+
});
|
|
4771
|
+
}
|
|
4772
|
+
async function completeLanding() {
|
|
4773
|
+
const state = readTabState(window);
|
|
4774
|
+
if (state?.phase !== "landing") return;
|
|
4775
|
+
const credential = landingCredential;
|
|
4776
|
+
landingCredential = null;
|
|
4777
|
+
let data = null;
|
|
4778
|
+
if (credential && state.code) {
|
|
4779
|
+
try {
|
|
4780
|
+
const response = await window.fetch(
|
|
4781
|
+
`${backendURL()}/magic-sessionmanager/admin-impersonation/exchange`,
|
|
4782
|
+
{
|
|
4783
|
+
method: "POST",
|
|
4784
|
+
headers: {
|
|
4785
|
+
Authorization: `Bearer ${credential}`,
|
|
4786
|
+
"Content-Type": "application/json",
|
|
4787
|
+
Accept: "application/json"
|
|
4788
|
+
},
|
|
4789
|
+
body: JSON.stringify({ code: state.code })
|
|
4790
|
+
}
|
|
4791
|
+
);
|
|
4792
|
+
if (response.ok) data = (await response.json())?.data || null;
|
|
4793
|
+
} catch {
|
|
4794
|
+
data = null;
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
if (!data?.token) {
|
|
4798
|
+
writeTabState(window, {
|
|
4799
|
+
phase: "failed",
|
|
4800
|
+
cookieName: state.cookieName,
|
|
4801
|
+
adminBase: state.adminBase,
|
|
4802
|
+
reason: "exchange"
|
|
4803
|
+
});
|
|
4804
|
+
window.dispatchEvent(new Event("msm-impersonation-change"));
|
|
4805
|
+
return;
|
|
4806
|
+
}
|
|
4807
|
+
writeTabState(window, {
|
|
4808
|
+
phase: "active",
|
|
4809
|
+
token: data.token,
|
|
4810
|
+
expiresAt: data.expiresAt,
|
|
4811
|
+
cookieName: data.cookieName || state.cookieName,
|
|
4812
|
+
adminBase: state.adminBase,
|
|
4813
|
+
impersonation: data.impersonation
|
|
4814
|
+
});
|
|
4815
|
+
window.location.replace(`${adminPath()}/`);
|
|
4816
|
+
}
|
|
4817
|
+
function startImpersonationTab() {
|
|
4818
|
+
if (started || typeof window === "undefined") return;
|
|
4819
|
+
const state = readTabState(window);
|
|
4820
|
+
if (!state) return;
|
|
4821
|
+
started = true;
|
|
4822
|
+
if (state.phase === "landing") completeLanding();
|
|
4823
|
+
Promise.resolve().then(() => require("./ImpersonationTabBanner-DdwXNmh4.js")).then(
|
|
4824
|
+
({ mountImpersonationBanner }) => mountImpersonationBanner({
|
|
4825
|
+
end: endImpersonation,
|
|
4826
|
+
leave: leaveImpersonationTab,
|
|
4827
|
+
markEnded,
|
|
4828
|
+
backendURL
|
|
4829
|
+
})
|
|
4830
|
+
).catch(() => {
|
|
4831
|
+
});
|
|
4832
|
+
}
|
|
4833
|
+
bootImpersonationTab();
|
|
4513
4834
|
const prefixPluginTranslations = (data, pluginId2) => {
|
|
4514
4835
|
const prefixed = {};
|
|
4515
4836
|
Object.keys(data).forEach((key) => {
|
|
@@ -4521,6 +4842,7 @@ const name = pluginPkg.strapi.name;
|
|
|
4521
4842
|
const index = {
|
|
4522
4843
|
register(app) {
|
|
4523
4844
|
const pluginPermissions$1 = pluginPermissions.access;
|
|
4845
|
+
startImpersonationTab();
|
|
4524
4846
|
app.addMenuLink({
|
|
4525
4847
|
to: `plugins/${pluginId$1}`,
|
|
4526
4848
|
icon: PluginIcon,
|
|
@@ -4528,7 +4850,7 @@ const index = {
|
|
|
4528
4850
|
id: `${pluginId$1}.plugin.name`,
|
|
4529
4851
|
defaultMessage: pluginPkg.strapi.displayName
|
|
4530
4852
|
},
|
|
4531
|
-
Component: () => Promise.resolve().then(() => require("./App-
|
|
4853
|
+
Component: () => Promise.resolve().then(() => require("./App-CfhAQ17e.js")),
|
|
4532
4854
|
permissions: pluginPermissions$1
|
|
4533
4855
|
});
|
|
4534
4856
|
app.addSettingsLink(
|
|
@@ -4544,7 +4866,7 @@ const index = {
|
|
|
4544
4866
|
},
|
|
4545
4867
|
id: "general",
|
|
4546
4868
|
to: `${pluginId$1}/general`,
|
|
4547
|
-
Component: () => Promise.resolve().then(() => require("./Settings-
|
|
4869
|
+
Component: () => Promise.resolve().then(() => require("./Settings-BBs2FDp7.js")),
|
|
4548
4870
|
permissions: pluginPermissions$1
|
|
4549
4871
|
},
|
|
4550
4872
|
{
|
|
@@ -4554,7 +4876,7 @@ const index = {
|
|
|
4554
4876
|
},
|
|
4555
4877
|
id: "analytics",
|
|
4556
4878
|
to: `${pluginId$1}/analytics`,
|
|
4557
|
-
Component: () => Promise.resolve().then(() => require("./Analytics-
|
|
4879
|
+
Component: () => Promise.resolve().then(() => require("./Analytics-_WA68oHb.js")),
|
|
4558
4880
|
permissions: pluginPermissions$1
|
|
4559
4881
|
}
|
|
4560
4882
|
]
|
|
@@ -4580,7 +4902,7 @@ const index = {
|
|
|
4580
4902
|
href: `/plugins/${pluginId$1}`
|
|
4581
4903
|
},
|
|
4582
4904
|
component: async () => {
|
|
4583
|
-
const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-
|
|
4905
|
+
const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-CmBqFLAA.js"));
|
|
4584
4906
|
return component.default;
|
|
4585
4907
|
},
|
|
4586
4908
|
id: "online-users-widget",
|
|
@@ -4601,11 +4923,11 @@ const index = {
|
|
|
4601
4923
|
},
|
|
4602
4924
|
async registerTrads({ locales }) {
|
|
4603
4925
|
const importedTrads = {
|
|
4604
|
-
en: () => Promise.resolve().then(() => require("./en-
|
|
4605
|
-
de: () => Promise.resolve().then(() => require("./de-
|
|
4606
|
-
es: () => Promise.resolve().then(() => require("./es-
|
|
4607
|
-
fr: () => Promise.resolve().then(() => require("./fr-
|
|
4608
|
-
pt: () => Promise.resolve().then(() => require("./pt-
|
|
4926
|
+
en: () => Promise.resolve().then(() => require("./en-DCtAgGEa.js")),
|
|
4927
|
+
de: () => Promise.resolve().then(() => require("./de-CSRQPn6F.js")),
|
|
4928
|
+
es: () => Promise.resolve().then(() => require("./es-CKT00l4K.js")),
|
|
4929
|
+
fr: () => Promise.resolve().then(() => require("./fr-B2EdBFSb.js")),
|
|
4930
|
+
pt: () => Promise.resolve().then(() => require("./pt-CcMUcqDy.js"))
|
|
4609
4931
|
};
|
|
4610
4932
|
const translatedLanguages = Object.keys(importedTrads).filter((lang) => locales.includes(lang));
|
|
4611
4933
|
const translations = await Promise.all(
|
|
@@ -4704,6 +5026,7 @@ exports.isCancelledRequest = isCancelledRequest;
|
|
|
4704
5026
|
exports.isEndReasonFilter = isEndReasonFilter;
|
|
4705
5027
|
exports.isNativeOnlySession = isNativeOnlySession;
|
|
4706
5028
|
exports.isSessionFilter = isSessionFilter;
|
|
5029
|
+
exports.landingUrl = landingUrl;
|
|
4707
5030
|
exports.logSafeAdminError = logSafeAdminError;
|
|
4708
5031
|
exports.normalizeDeviceType = normalizeDeviceType;
|
|
4709
5032
|
exports.parseActivityPageQuery = parseActivityPageQuery;
|
|
@@ -4712,11 +5035,13 @@ exports.parseUserActivityQuery = parseUserActivityQuery;
|
|
|
4712
5035
|
exports.pluginId = pluginId$1;
|
|
4713
5036
|
exports.pluginPermissions = pluginPermissions;
|
|
4714
5037
|
exports.presentText = presentText;
|
|
5038
|
+
exports.readTabState = readTabState;
|
|
4715
5039
|
exports.refocusIfLost = refocusIfLost;
|
|
4716
5040
|
exports.requireSessionList = requireSessionList;
|
|
4717
5041
|
exports.requireSuccessfulMutation = requireSuccessfulMutation;
|
|
4718
5042
|
exports.resolveSettingsTab = resolveSettingsTab;
|
|
4719
5043
|
exports.restoreDialogFocus = restoreDialogFocus;
|
|
5044
|
+
exports.secondsUntil = secondsUntil;
|
|
4720
5045
|
exports.splitDuration = splitDuration;
|
|
4721
5046
|
exports.toValidDate = toValidDate;
|
|
4722
5047
|
exports.useElementWidth = useElementWidth;
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -352,8 +352,8 @@ const pt = {
|
|
|
352
352
|
"settings.config.failed.lockout.suffix": "inícios de sessão falhados",
|
|
353
353
|
"settings.config.clientIp.title": "Endereço IP do cliente",
|
|
354
354
|
"settings.config.clientIp.intro": "Todas as regras baseadas em IP dependem da leitura do endereço real do cliente.",
|
|
355
|
-
"settings.config.clientIp.trustProxy.label": "
|
|
356
|
-
"settings.config.clientIp.trustProxy.hint": "
|
|
355
|
+
"settings.config.clientIp.trustProxy.label": "Proxies de confiança",
|
|
356
|
+
"settings.config.clientIp.trustProxy.hint": "Deixe vazio para usar as definições server.proxy do Strapi (koa, ipHeader, maxIpsCount). Caso contrário, indique os seus proxies, um endereço IP ou intervalo CIDR por linha: só é lido o X-Forwarded-For de um pedido que vem de um proxy da lista, e o cliente é o endereço mais à direita que não está na lista. Afeta o endereço IP registado, o bloqueio de IP e as consultas de localização.",
|
|
357
357
|
"settings.config.suspicious.title": "Inícios de sessão suspeitos",
|
|
358
358
|
"settings.config.suspicious.intro": "Recusa novos inícios de sessão que parecem arriscados.",
|
|
359
359
|
"settings.config.suspicious.reject.label": "Rejeitar inícios de sessão suspeitos",
|
|
@@ -992,6 +992,8 @@ const pt = {
|
|
|
992
992
|
"adminPanel.activity.read.signInsExport": "Histórico de acessos exportado",
|
|
993
993
|
"adminPanel.activity.read.signIns": "Histórico de acessos consultado",
|
|
994
994
|
"adminPanel.activity.event.purged": "Eventos antigos excluídos",
|
|
995
|
+
"adminPanel.activity.event.weakKey": "Chave de criptografia fraca",
|
|
996
|
+
"adminPanel.activity.event.weakKey.detail": "SESSION_ENCRYPTION_KEY tem menos de 32 bytes. A próxima versão principal não vai iniciar com ela.",
|
|
995
997
|
"adminPanel.activity.event.userFailed": "Falha no acesso",
|
|
996
998
|
"adminPanel.activity.event.userRefused": "Acesso recusado",
|
|
997
999
|
"adminPanel.activity.event.userLockout": "Bloqueado",
|
|
@@ -1020,7 +1022,7 @@ const pt = {
|
|
|
1020
1022
|
"impersonation.result.title": "Agindo como {user}",
|
|
1021
1023
|
"impersonation.modal.title": "Agir como {user}",
|
|
1022
1024
|
"impersonation.modal.intro": "Você recebe um login de curta duração como este usuário para reproduzir um problema. Senha, e-mail, conta e sessões não podem ser alterados com ele. Isso é registrado no registro de segurança.",
|
|
1023
|
-
"impersonation.reason.hint": "Fica no registro de segurança
|
|
1025
|
+
"impersonation.reason.hint": "Fica no registro de segurança para os administradores. O usuário só o vê no e-mail opcional; a exportação dos dados dele indica apenas que um administrador abriu a conta.",
|
|
1024
1026
|
"impersonation.reason.label": "Motivo",
|
|
1025
1027
|
"impersonation.reason.placeholder": "Por exemplo: chamado 4711",
|
|
1026
1028
|
"impersonation.duration.label": "Duração",
|
|
@@ -1084,7 +1086,7 @@ const pt = {
|
|
|
1084
1086
|
"impersonation.preview.conditions": "{action}: somente {conditions}",
|
|
1085
1087
|
"impersonation.preview.error.start": "Não foi possível abrir a prévia.",
|
|
1086
1088
|
"impersonation.preview.ended": "Prévia encerrada.",
|
|
1087
|
-
"impersonation.preview.title": "
|
|
1089
|
+
"impersonation.preview.title": "Permissões de {name}",
|
|
1088
1090
|
"impersonation.preview.intro": "Veja quais tipos de conteúdo e ações este admin pode usar, com base nas funções dele. Somente leitura: ninguém faz login e nada pode ser alterado. Isso é registrado no registro de segurança.",
|
|
1089
1091
|
"impersonation.preview.reason.hint": "Fica no registro de segurança.",
|
|
1090
1092
|
"impersonation.preview.banner.ended": "A prévia terminou.",
|
|
@@ -1096,8 +1098,6 @@ const pt = {
|
|
|
1096
1098
|
"impersonation.preview.other": "Outras permissões",
|
|
1097
1099
|
"impersonation.preview.close": "Encerrar e fechar",
|
|
1098
1100
|
"impersonation.preview.start": "Ver permissões",
|
|
1099
|
-
"adminPanel.actions.viewAs": "Ver como {name}",
|
|
1100
|
-
"adminPanel.actions.viewAsShort": "Ver como",
|
|
1101
1101
|
"adminPanel.activity.event.impersonationStarted": "Acesso como usuário iniciado",
|
|
1102
1102
|
"adminPanel.activity.event.impersonationEnded": "Acesso como usuário encerrado",
|
|
1103
1103
|
"adminPanel.activity.event.impersonationExpired": "Acesso como usuário expirado",
|
|
@@ -1113,6 +1113,7 @@ const pt = {
|
|
|
1113
1113
|
"userActivity.detail.impersonation.callAccount": "Uma exportação de dados ou “Não fui eu” foi bloqueada",
|
|
1114
1114
|
"userActivity.detail.impersonation.callCredentials": "Uma solicitação de acesso, senha ou e-mail foi bloqueada",
|
|
1115
1115
|
"userActivity.detail.impersonation.callSessions": "Uma solicitação para encerrar sessões foi bloqueada",
|
|
1116
|
+
"userActivity.detail.impersonation.callMutation": "Uma mutação GraphQL foi bloqueada",
|
|
1116
1117
|
"userActivity.detail.impersonation.disabled": "O acesso como usuário está desativado",
|
|
1117
1118
|
"userActivity.detail.impersonation.duration": "Por {minutes, plural, one {# minuto} other {# minutos}}",
|
|
1118
1119
|
"userActivity.detail.impersonation.endedByAdmin": "Encerrado por um admin",
|
|
@@ -1166,6 +1167,46 @@ const pt = {
|
|
|
1166
1167
|
"userActivity.panel.title": "Atividade de segurança",
|
|
1167
1168
|
"userActivity.recent.empty": "Ainda não há eventos de segurança de usuários do aplicativo.",
|
|
1168
1169
|
"userActivity.recent.subtitle": "Os últimos acessos com falha e recusados, bloqueios, novos dispositivos, viagens impossíveis e acessos como usuário dos usuários do seu aplicativo. Selecione um evento para ver os detalhes.",
|
|
1169
|
-
"userActivity.recent.title": "Atividade de segurança"
|
|
1170
|
+
"userActivity.recent.title": "Atividade de segurança",
|
|
1171
|
+
"impersonation.tab.banner.signedInAs": "Sessão iniciada como {name}",
|
|
1172
|
+
"impersonation.tab.banner.changes": "Alterações permitidas",
|
|
1173
|
+
"impersonation.tab.banner.readOnly": "Só leitura",
|
|
1174
|
+
"impersonation.tab.banner.endsIn": "Termina em {time}",
|
|
1175
|
+
"impersonation.tab.banner.end": "Terminar personificação",
|
|
1176
|
+
"impersonation.tab.landing.title": "A iniciar sessão como outro administrador…",
|
|
1177
|
+
"impersonation.tab.failed.title": "O início de sessão não funcionou",
|
|
1178
|
+
"impersonation.tab.failed.body": "A ligação já foi usada ou tem mais de um minuto. Comece de novo na página Painel de administração do Session Manager.",
|
|
1179
|
+
"impersonation.tab.ended.expiredTitle": "A personificação expirou",
|
|
1180
|
+
"impersonation.tab.ended.title": "A personificação terminou",
|
|
1181
|
+
"impersonation.tab.ended.body": "Já não tem sessão iniciada como {name}. Os seus outros separadores não foram afetados. Pode fechar este separador.",
|
|
1182
|
+
"impersonation.tab.backToMyAdmin": "Voltar ao meu painel de administração",
|
|
1183
|
+
"impersonation.tab.close": "Fechar separador",
|
|
1184
|
+
"impersonation.signIn.unsupported.lifespan": "Indisponível: a duração do token de acesso de administração é inferior a 15 minutos.",
|
|
1185
|
+
"impersonation.signIn.unsupported.version": "Indisponível no Strapi {version}: esta versão do plugin foi testada com o Strapi 5.50 a 5.64. Atualize o plugin para o usar.",
|
|
1186
|
+
"impersonation.signIn.error.start": "Não foi possível iniciar a sessão.",
|
|
1187
|
+
"impersonation.signIn.error.unsupported": "Iniciar sessão como outro administrador não está disponível nesta versão do Strapi.",
|
|
1188
|
+
"impersonation.signIn.error.self": "Não pode iniciar sessão como si próprio.",
|
|
1189
|
+
"impersonation.signIn.error.superAdmin": "Não pode iniciar sessão como Super Admin.",
|
|
1190
|
+
"impersonation.signIn.error.notSubset": "Este administrador tem permissões que o utilizador não tem, por isso não pode iniciar sessão como ele.",
|
|
1191
|
+
"impersonation.signIn.error.inactive": "Esta conta de administrador não está ativa.",
|
|
1192
|
+
"impersonation.signIn.error.alreadyActive": "Alguém já iniciou sessão como este administrador. Termine primeiro essa personificação.",
|
|
1193
|
+
"impersonation.signIn.error.nested": "Não pode iniciar uma personificação durante outra.",
|
|
1194
|
+
"impersonation.signIn.title": "Iniciar sessão como {name}",
|
|
1195
|
+
"impersonation.signIn.intro": "Abre um novo separador com sessão iniciada como este administrador, com o menu e as permissões dele. Os seus outros separadores continuam com a sua sessão. O início, o fim e cada alteração ficam registados no registo de segurança.",
|
|
1196
|
+
"impersonation.signIn.allowChanges": "Permitir alterações",
|
|
1197
|
+
"impersonation.signIn.allowChanges.hint": "Desligado: o separador é só de leitura. A conta, a palavra-passe, as sessões, os administradores, as funções e os tokens de API nunca podem ser alterados.",
|
|
1198
|
+
"impersonation.signIn.allowChanges.warning": "As alterações que fizer aparecem no Strapi como feitas por {name} (por exemplo, em «Editado por último por»). O registo de segurança regista-o a si como autor.",
|
|
1199
|
+
"impersonation.signIn.ready": "Pronto. Abra o separador dentro de um minuto; a ligação funciona uma vez. Termine a personificação na barra no topo desse separador ou nesta página.",
|
|
1200
|
+
"impersonation.signIn.open": "Abrir separador como {name}",
|
|
1201
|
+
"impersonation.signIn.start": "Iniciar sessão",
|
|
1202
|
+
"impersonation.list.kind.adminChanges": "Administrador, sessão iniciada, alterações permitidas",
|
|
1203
|
+
"impersonation.list.kind.adminSignedIn": "Administrador, sessão iniciada, só leitura",
|
|
1204
|
+
"adminPanel.activity.filter.impersonation": "Personificação",
|
|
1205
|
+
"adminPanel.actions.viewPermissions": "Ver permissões de {name}",
|
|
1206
|
+
"adminPanel.actions.viewPermissionsShort": "Ver permissões",
|
|
1207
|
+
"adminPanel.actions.signInAs": "Iniciar sessão como {name}",
|
|
1208
|
+
"adminPanel.actions.signInAsShort": "Iniciar sessão como",
|
|
1209
|
+
"adminPanel.activity.event.impersonationWrite": "Alteração feita com a sessão deste administrador",
|
|
1210
|
+
"impersonation.tab.banner.endShort": "Terminar"
|
|
1170
1211
|
};
|
|
1171
1212
|
exports.default = pt;
|