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.
Files changed (35) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +116 -82
  3. package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
  4. package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
  5. package/dist/admin/{Analytics-CIHgaURb.mjs → Analytics-DGAHD19E.mjs} +1 -1
  6. package/dist/admin/{Analytics-B7BAjApz.js → Analytics-_WA68oHb.js} +1 -1
  7. package/dist/admin/{App-DJkJC06E.js → App-CfhAQ17e.js} +304 -104
  8. package/dist/admin/{App-CPE-CQGz.mjs → App-VB66H73A.mjs} +276 -76
  9. package/dist/admin/ImpersonationTabBanner-B6Ps5-oe.mjs +244 -0
  10. package/dist/admin/ImpersonationTabBanner-DdwXNmh4.js +244 -0
  11. package/dist/admin/{OnlineUsersWidget-Dou2hxGY.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
  12. package/dist/admin/{OnlineUsersWidget-CcjNfzzf.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
  13. package/dist/admin/{Settings--eEiHv_a.js → Settings-BBs2FDp7.js} +27 -229
  14. package/dist/admin/{Settings-h_exWUiI.mjs → Settings-CKDNGJhl.mjs} +19 -221
  15. package/dist/admin/{de-Wz5Emtrb.mjs → de-CK-HuY41.mjs} +42 -4
  16. package/dist/admin/{de-oBmcAcXj.js → de-CSRQPn6F.js} +42 -4
  17. package/dist/admin/{en-B1TN5F62.js → en-DCtAgGEa.js} +42 -4
  18. package/dist/admin/{en-B_1Ka64U.mjs → en-KZ5ajaAR.mjs} +42 -4
  19. package/dist/admin/{es-CVgw4zsj.mjs → es-B7k8taWV.mjs} +42 -4
  20. package/dist/admin/{es-Bb515J0p.js → es-CKT00l4K.js} +42 -4
  21. package/dist/admin/{fr-yDdwunmg.js → fr-B2EdBFSb.js} +42 -4
  22. package/dist/admin/{fr-0AgMxTFc.mjs → fr-Q2gmYqCn.mjs} +42 -4
  23. package/dist/admin/{index-DVQ7tdTC.mjs → index-BPbs1GyP.mjs} +365 -57
  24. package/dist/admin/{index-qtN2dOm4.js → index-Cho0XGZ1.js} +319 -11
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +2 -2
  27. package/dist/admin/{pt-BAB07LY-.js → pt-CcMUcqDy.js} +42 -4
  28. package/dist/admin/{pt-DtM74ffN.mjs → pt-CmxZTaf2.mjs} +42 -4
  29. package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
  30. package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
  31. package/dist/server/index.js +867 -10
  32. package/dist/server/index.mjs +867 -10
  33. package/package.json +6 -2
  34. package/dist/admin/dashboardModel-DNT_l-Bk.js +0 -169
  35. package/dist/admin/dashboardModel-fApbKGay.mjs +0 -170
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # [4.23.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.22.1...v4.23.0) (2026-11-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * sign in as another admin in an isolated tab, read-only by default, with audit and version guard ([#47](https://github.com/Schero94/Magic-Sessionmanager/issues/47)) ([16915a5](https://github.com/Schero94/Magic-Sessionmanager/commit/16915a51aaa607a9e1ac30c356e5153ecc67fe51))
7
+
8
+
9
+ Release type: minor (`feat`). Adds **Sign in as another admin**: a real admin session of another admin in a separate browser tab, read-only unless changes are allowed. No breaking change: the 4.21 permission preview stays, under the new name **View permissions**.
10
+
11
+ ### Features
12
+
13
+ * **Sign in as another admin.** Session Manager › Admin panel › row action **Sign in as** (key icon). The dialog asks for a reason, 15 or 30 minutes and **Allow changes** (off by default, with a warning that changes show as made by the other admin). **Open tab signed in as …** opens a new tab with that admin's menu and permissions and a bar on every page: who, read-only or changes allowed, time left, **End impersonation**. The starting admin's other tabs stay signed in as themselves.
14
+ * New permission **Sign in as another admin** (`plugin::magic-sessionmanager.impersonate.admins.sign-in`). The Super Admin role holds it automatically; other roles only when granted. The **Allow impersonation** switch must be on.
15
+ * The server creates the session with `strapi.sessionManager('admin').generateRefreshToken` on its own device id (`msm-admin-impersonation-…`), marks it in the session metadata, lets it expire with the impersonation and keeps the refresh token on the server. A one-time code (60 seconds, single use, only for the starting admin) in the URL fragment hands it to the new tab.
16
+ * Read-only by default: a server middleware refuses every non-GET admin request of the session (403 `impersonation-read-only`), except Strapi's read-only permission check. Never allowed, even with **Allow changes**: the other admin's account, password and sessions, admin users, roles, API and transfer tokens, SSO providers, sign-in and password routes and every change route of this plugin (403 `impersonation-identity`).
17
+ * `POST /admin/logout` from the impersonation tab ends only the impersonation; Strapi's logout (which without a device id deletes every session of the signed-in admin) never runs for the other admin.
18
+ * Ending: the bar, **Active impersonations** (now also on the Admin panel page), Strapi's **Log out** in the tab, signing out in the starting admin's own tab, the switch, or the end of the duration. Only the impersonation's own session is deleted.
19
+ * Attribution: every allowed change is recorded as `impersonation.write` with the real admin as actor and `meta.impersonating`, `meta.method`, `meta.route` and `meta.status`; refused requests as `impersonation.refused` (`call-read-only`, `call-identity`). New filter **Impersonation** in the admin sign-in history.
20
+ * Version guard: enabled only on the Strapi releases it was tested against (5.50 to 5.64). On any other release **Sign in as** is disabled with the reason and the server answers 403 `unsupported`. `GET /impersonation/status` reports `adminSignIn: { supported, version, reason, durations }`.
21
+ * New routes: `POST /impersonation/admins/:adminId/sign-in`, `POST /admin-impersonation/exchange`, `GET /admin-impersonation/self`, `POST /admin-impersonation/self/end`. `GET /impersonation/active` rows carry `allowChanges`; `handoff` can be `admin-session`.
22
+
23
+ ### Changed
24
+
25
+ * "View as admin" is now **View permissions** (row action, dialog title "Permissions of …", permission display name "View admin permissions (read-only preview)"). Same permission id, route and behaviour.
26
+
27
+ ### Migration
28
+
29
+ * Nothing to do. The impersonation table gets the `allowChanges` column (default false); Strapi adds it at start-up.
30
+ * To use the feature, grant **Sign in as another admin** to the roles that need it (Super Admin has it). With **Allow changes**, Strapi's own "Last edited by", history and audit log show the other admin as the author; the plugin's security log is the record of who really made the change. Agree its use with your works council where one exists (see README › Impersonation).
31
+
1
32
  ## [4.22.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.22.0...v4.22.1) (2026-11-25)
2
33
 
3
34
 
package/README.md CHANGED
@@ -61,20 +61,21 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
61
61
 
62
62
  ## Features
63
63
 
64
- | Area | What you get |
65
- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
66
- | Overview | A sessions dashboard with Active, Idle and Ended counts, search, filters, CSV and JSON export, and a details dialog per session (device, browser, IP address, location, and a security score when a [risk data source](#risk-data-vpn-proxy-tor) is set up). |
67
- | Control | End one session, end all sessions of a user, delete a record, or block a user. Ended sessions are rejected on the next request with 401 and a reason header. |
68
- | Your users | Content API routes for "my sessions", "current session", log out, log out everywhere and log out other devices. Each user only ever sees their own sessions. |
69
- | Login protection | Temporary IP lockout after failed sign-ins, Content API rate limits, optional rejection of VPN, proxy or low-score sign-ins (needs a [risk data source](#risk-data-vpn-proxy-tor)), and country allow or block lists. |
70
- | Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off. |
71
- | Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
72
- | Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
73
- | Admin panel sessions | Who can use the Strapi admin panel, who is signed in, on which browser and since when. Sign an admin out of one browser or everywhere; it takes effect on their next click. |
74
- | Admin activity | A sign-in history per admin (sign-ins, failed attempts, lockouts, sign-outs, who signed out whom) with IP address, browser and location, and optional Content Manager activity. |
75
- | Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
76
- | Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
77
- | Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
64
+ | Area | What you get |
65
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
66
+ | Overview | A sessions dashboard with Active, Idle and Ended counts, search, filters, CSV and JSON export, and a details dialog per session (device, browser, IP address, location, and a security score when a [risk data source](#risk-data-vpn-proxy-tor) is set up). |
67
+ | Control | End one session, end all sessions of a user, delete a record, or block a user. Ended sessions are rejected on the next request with 401 and a reason header. |
68
+ | Your users | Content API routes for "my sessions", "current session", log out, log out everywhere and log out other devices. Each user only ever sees their own sessions. |
69
+ | Login protection | Temporary IP lockout after failed sign-ins, Content API rate limits, optional rejection of VPN, proxy or low-score sign-ins (needs a [risk data source](#risk-data-vpn-proxy-tor)), and country allow or block lists. |
70
+ | Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off. |
71
+ | Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
72
+ | Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
73
+ | Admin panel sessions | Who can use the Strapi admin panel, who is signed in, on which browser and since when. Sign an admin out of one browser or everywhere; it takes effect on their next click. |
74
+ | Admin activity | A sign-in history per admin (sign-ins, failed attempts, lockouts, sign-outs, who signed out whom) with IP address, browser and location, and optional Content Manager activity. |
75
+ | Impersonation | Act as an app user for up to an hour, see which permissions an admin has, or sign in as another admin in a separate tab (read-only unless changes are allowed). Off by default, with a reason, a time limit and every step in the security log; see [Impersonation](#impersonation). |
76
+ | Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
77
+ | Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
78
+ | Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
78
79
 
79
80
  ---
80
81
 
@@ -768,62 +769,67 @@ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authe
768
769
 
769
770
  The **Admin panel sessions** routes need two more permissions, which only the Super Admin role has by default (Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel):
770
771
 
771
- | Permission | Name in the role editor | Allows |
772
- | ---------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
773
- | `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
774
- | `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
775
- | `plugin::magic-sessionmanager.admin-activity.read` | View admin activity | Sign-in history, Activity, Recent security activity and the Security activity page, CSV exports and changing the Admin activity settings (also needs read) |
776
- | `plugin::magic-sessionmanager.user-activity.read` | View app-user security activity | **Security activity** on the App users tab and in the user's Sessions panel, the full page and its CSV export (also needs `access`, not `admin-sessions.read`); see [Security activity of app users](#security-activity-of-app-users) |
777
- | `plugin::magic-sessionmanager.settings.update` | Change protected settings (location lookup, webhooks, security log, sign-in policies) | Changing IP location lookup, provider, lookup failure mode and database file, team notification webhooks, the sign-in and session policies (lockout, trusted addresses, session limit, password-change sign-out, role rules), the signed webhook and its **Send test**, the event selection, impossible travel and shortened session IPs, and (with View admin activity) the security log settings. Since 4.17; Super Admin only by default |
778
- | `plugin::magic-sessionmanager.lockouts.unlock` | Unlock locked sign-ins | **Unlock** in Login protection › Locked now (also needs `access`) |
779
- | `plugin::magic-sessionmanager.impersonate.users` | Impersonate app users | Starting, listing and ending impersonations of app users (also needs `access` and the **Allow impersonation** switch); see [Impersonation](#impersonation). Since 4.20 |
780
- | `plugin::magic-sessionmanager.impersonate.admins` | View as admin (read-only permission preview) | **View as** in the Admin panel view, and listing and ending such previews (also needs `access` and the switch); see [View as admin](#view-as-admin-read-only-permission-preview). Since 4.20 |
772
+ | Permission | Name in the role editor | Allows |
773
+ | --------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
774
+ | `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
775
+ | `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
776
+ | `plugin::magic-sessionmanager.admin-activity.read` | View admin activity | Sign-in history, Activity, Recent security activity and the Security activity page, CSV exports and changing the Admin activity settings (also needs read) |
777
+ | `plugin::magic-sessionmanager.user-activity.read` | View app-user security activity | **Security activity** on the App users tab and in the user's Sessions panel, the full page and its CSV export (also needs `access`, not `admin-sessions.read`); see [Security activity of app users](#security-activity-of-app-users) |
778
+ | `plugin::magic-sessionmanager.settings.update` | Change protected settings (location lookup, webhooks, security log, sign-in policies) | Changing IP location lookup, provider, lookup failure mode and database file, team notification webhooks, the sign-in and session policies (lockout, trusted addresses, session limit, password-change sign-out, role rules), the signed webhook and its **Send test**, the event selection, impossible travel and shortened session IPs, and (with View admin activity) the security log settings. Since 4.17; Super Admin only by default |
779
+ | `plugin::magic-sessionmanager.lockouts.unlock` | Unlock locked sign-ins | **Unlock** in Login protection › Locked now (also needs `access`) |
780
+ | `plugin::magic-sessionmanager.impersonate.users` | Impersonate app users | Starting, listing and ending impersonations of app users (also needs `access` and the **Allow impersonation** switch); see [Impersonation](#impersonation). Since 4.20 |
781
+ | `plugin::magic-sessionmanager.impersonate.admins` | View admin permissions (read-only preview) | **View permissions** in the Admin panel view, and listing and ending such previews (also needs `access` and the switch); see [View permissions](#view-permissions-of-an-admin-read-only-preview). Since 4.20 |
782
+ | `plugin::magic-sessionmanager.impersonate.admins.sign-in` | Sign in as another admin | **Sign in as** in the Admin panel view: a real admin session of another admin in a separate tab, read-only unless changes are allowed; listing and ending them (also needs `access` and the switch); see [Sign in as another admin](#sign-in-as-another-admin). Since 4.23 |
781
783
 
782
784
  **What the admin panel view shows about other admins (4.17).** Names, emails and roles of admins are Strapi's own user data. The Admin panel view and the sign-in history return them only to roles that may also read them in Settings › Users: email and name need Strapi's **Read** permission on Users (`admin::users.read`), role names need it or **Read** on Roles (`admin::roles.read`). Without them the list shows "Admin #12", "Email hidden" and "Hidden" (roles), and the search matches the admin id only. Every admin always sees their own row. Grant `admin::users.read` to roles that should keep seeing names and emails.
783
785
 
784
786
  **Protected settings (4.17).** `PUT /settings` still needs only `access`, so roles that change the session, login-protection, alert-email and retention options keep working. Changing a protected key needs **Change protected settings** as well, else 403 with `error.details.reason: "settings-update-permission"`: `enableGeolocation`, `geoIpProvider`, `geoLookupFailureMode`, `geoIpDatabasePath`, `enableWebhooks`, `discordWebhookUrl`, `slackWebhookUrl`, every security log key (those also keep needing **View admin activity**, reason `admin-activity-permission`) and the sign-in and session policy keys (`maxFailedLoginsPerAccount`, `lockoutWindowMinutes`, `lockoutDurationMinutes`, `lockoutTrustedAddresses`, `lockoutNotifyUser`, `recordUserSignInEvents`, `maxSessionsPerUser`, `sessionLimitPolicy`, `endOtherSessionsOnPasswordChange`, `roleRules`), and the detection and integration keys (`impossibleTravelEnabled`, `impossibleTravelSpeedKmh`, `impossibleTravelMinDistanceKm`, `impossibleTravelAction`, `webhookEvents`, `genericWebhookEnabled`, `genericWebhookUrl`, `genericWebhookSecret`, `sessionIpAnonymize`), and `impersonationEnabled` (4.20), and since 4.22.1 `trustedProxies`, `maxFailedLogins` (the IP threshold) and `emailTemplates` (the alert texts go to app users from your address). The new-device and impossible-travel email switches stay with `access`, like the other alert emails. Sending a protected key back with its stored value is not a change, so these roles can still save the whole form. The admin UI shows these controls read-only for them.
785
787
 
786
- | Method | Path | Admin UI action |
787
- | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
788
- | GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
789
- | GET | `/sessions/active` | Active sessions only; same paging parameters |
790
- | GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
791
- | GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
792
- | POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
793
- | GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
794
- | GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
795
- | GET | `/user/:userId/sessions` | Sessions panel |
796
- | POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
797
- | DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
798
- | POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
799
- | POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
800
- | POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
801
- | GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
802
- | GET | `/geolocation/:ipAddress` | **Look up location** |
803
- | GET | `/geoip/status` | GeoIP database status, plus `risk` (`available`, `source`, and per risk database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`) |
804
- | PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
805
- | POST | `/geoip/update` | Update database / Force download. Body `{ "force"?: boolean, "database"?: "location" \| "anonymous-ip" \| "asn" }` (default `location`; anything else is 400). A 401/403 from MaxMind answers 502 "MaxMind refused the download…" |
806
- | GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input). Webhook URLs are never returned: `hasDiscordWebhook`, `hasSlackWebhook` and a hint (`https://discord.com/…`); see below |
807
- | POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
808
- | GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email; the admin id only without `admin::users.read`), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read` |
809
- | GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
810
- | POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
811
- | POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
812
- | GET | `/admin-activity/sign-ins` | **Sign-in history**, **Recent security activity** and the **Security activity** page: `adminId`, `event` (`all`, `succeeded`, `failed`, `signed-out`, `changes`), `from`, `to` (ISO dates), `page`, `pageSize` (1-100); needs `admin-activity.read` |
813
- | GET | `/admin-activity/sign-ins/export` | CSV export batches of 500 rows, newest first; same filters plus `cursor`; follow `meta.nextCursor` |
814
- | GET | `/admin-activity/content` | **Activity**: `adminId`, `action` (`all`, `view`, `create`, `update`, `publish`, `unpublish`, `discard`, `delete`, `clone`), `contentType` (uid), `from`, `to`, `page`, `pageSize`; needs `admin-activity.read` |
815
- | GET | `/admin-activity/content/export` | CSV export batches of 500 rows; same filters plus `cursor` |
816
- | GET | `/user-activity` | **Security activity of app users**: `event` (`all`, `failed`, `lockouts`, `suspicious`, `sessions`, `privacy`, `impersonation`), `userId` (documentId), `from`, `to`, `page`, `pageSize` (1-100); needs `user-activity.read` |
817
- | GET | `/user-activity/export` | CSV export batches of 500 rows; same filters plus `cursor`; the first batch of every export is recorded in the security log |
818
- | GET | `/lockouts` | **Locked now**: `{ data: [{ id, kind: 'ip' \| 'account', ip, user, failures, lockedAt, until }] }`; read rate limit |
819
- | POST | `/lockouts/unlock` | **Unlock**: body `{ id }` from the list; needs `lockouts.unlock`; 404 when the lock already ended; 10 per minute |
820
- | GET | `/roles` | Users & Permissions roles (without Public) for **Different rules for some roles** |
821
- | GET | `/impersonation/status` | `{ data: { enabled, handoff: 'frontend' \| 'token', frontendOrigin, durations, mode } }` |
822
- | POST | `/impersonation/users/:userId` | **Start impersonation**: body `{ reason, durationMinutes: 15 \| 30 \| 60, notifyUser? }`; needs `impersonate.users`; signed-in admins only; 201 `{ data: { impersonation, handoff } }` (`Cache-Control: no-store`); 10 per 10 minutes |
823
- | POST | `/impersonation/admins/:adminId/preview` | **View as**: body `{ reason, durationMinutes: 15 \| 30 }`; needs `impersonate.admins`; signed-in admins only; 201 `{ data: { impersonation, preview: { admin, contentTypes, otherPermissions } } }`; 403 `self`, `super-admin`, `not-subset`; 10 per 10 minutes |
824
- | GET | `/impersonation/previews/:id` | The running preview, for the admin who started it; 404 otherwise or once it ended |
825
- | GET | `/impersonation/active` | **Active impersonations**: `{ data: [{ id, targetType, targetId, targetLabel, actorId, actorLabel, startedByYou, reason, durationMinutes, handoff, credentialIssued, startedAt, expiresAt, state }] }`; app users with `impersonate.users`, admin previews with `impersonate.admins` |
826
- | POST | `/impersonation/:id/end` | **End impersonation**: `{ data: { ended } }`; needs the impersonate permission of its kind; 404 for unknown ids |
788
+ | Method | Path | Admin UI action |
789
+ | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
790
+ | GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
791
+ | GET | `/sessions/active` | Active sessions only; same paging parameters |
792
+ | GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
793
+ | GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
794
+ | POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
795
+ | GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
796
+ | GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
797
+ | GET | `/user/:userId/sessions` | Sessions panel |
798
+ | POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
799
+ | DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
800
+ | POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
801
+ | POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
802
+ | POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
803
+ | GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
804
+ | GET | `/geolocation/:ipAddress` | **Look up location** |
805
+ | GET | `/geoip/status` | GeoIP database status, plus `risk` (`available`, `source`, and per risk database `editionId`, `exists`, `usable`, `fromEnvironment`, `metadata`) |
806
+ | PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
807
+ | POST | `/geoip/update` | Update database / Force download. Body `{ "force"?: boolean, "database"?: "location" \| "anonymous-ip" \| "asn" }` (default `location`; anything else is 400). A 401/403 from MaxMind answers 502 "MaxMind refused the download…" |
808
+ | GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input). Webhook URLs are never returned: `hasDiscordWebhook`, `hasSlackWebhook` and a hint (`https://discord.com/…`); see below |
809
+ | POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
810
+ | GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email; the admin id only without `admin::users.read`), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read` |
811
+ | GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
812
+ | POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
813
+ | POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
814
+ | GET | `/admin-activity/sign-ins` | **Sign-in history**, **Recent security activity** and the **Security activity** page: `adminId`, `event` (`all`, `succeeded`, `failed`, `signed-out`, `changes`), `from`, `to` (ISO dates), `page`, `pageSize` (1-100); needs `admin-activity.read` |
815
+ | GET | `/admin-activity/sign-ins/export` | CSV export batches of 500 rows, newest first; same filters plus `cursor`; follow `meta.nextCursor` |
816
+ | GET | `/admin-activity/content` | **Activity**: `adminId`, `action` (`all`, `view`, `create`, `update`, `publish`, `unpublish`, `discard`, `delete`, `clone`), `contentType` (uid), `from`, `to`, `page`, `pageSize`; needs `admin-activity.read` |
817
+ | GET | `/admin-activity/content/export` | CSV export batches of 500 rows; same filters plus `cursor` |
818
+ | GET | `/user-activity` | **Security activity of app users**: `event` (`all`, `failed`, `lockouts`, `suspicious`, `sessions`, `privacy`, `impersonation`), `userId` (documentId), `from`, `to`, `page`, `pageSize` (1-100); needs `user-activity.read` |
819
+ | GET | `/user-activity/export` | CSV export batches of 500 rows; same filters plus `cursor`; the first batch of every export is recorded in the security log |
820
+ | GET | `/lockouts` | **Locked now**: `{ data: [{ id, kind: 'ip' \| 'account', ip, user, failures, lockedAt, until }] }`; read rate limit |
821
+ | POST | `/lockouts/unlock` | **Unlock**: body `{ id }` from the list; needs `lockouts.unlock`; 404 when the lock already ended; 10 per minute |
822
+ | GET | `/roles` | Users & Permissions roles (without Public) for **Different rules for some roles** |
823
+ | GET | `/impersonation/status` | `{ data: { enabled, handoff: 'frontend' \| 'token', frontendOrigin, durations, mode } }` |
824
+ | POST | `/impersonation/users/:userId` | **Start impersonation**: body `{ reason, durationMinutes: 15 \| 30 \| 60, notifyUser? }`; needs `impersonate.users`; signed-in admins only; 201 `{ data: { impersonation, handoff } }` (`Cache-Control: no-store`); 10 per 10 minutes |
825
+ | POST | `/impersonation/admins/:adminId/preview` | **View permissions**: body `{ reason, durationMinutes: 15 \| 30 }`; needs `impersonate.admins`; signed-in admins only; 201 `{ data: { impersonation, preview: { admin, contentTypes, otherPermissions } } }`; 403 `self`, `super-admin`, `not-subset`; 10 per 10 minutes |
826
+ | GET | `/impersonation/previews/:id` | The running preview, for the admin who started it; 404 otherwise or once it ended |
827
+ | POST | `/impersonation/admins/:adminId/sign-in` | **Sign in as** (4.23): body `{ reason, durationMinutes: 15 \| 30, allowChanges?: boolean }`; needs `impersonate.admins.sign-in`; signed-in admins only; 201 `{ data: { impersonation, handoff: { type: 'admin-tab', path, cookieName, code, codeExpiresAt } } }`; 403 `disabled`, `unsupported`, `nested`, `self`, `super-admin`, `inactive`, `not-subset`, `already-active`, `api-token`; 10 per 10 minutes |
828
+ | POST | `/admin-impersonation/exchange` | The new tab exchanges the one-time code with the starting admin's own token: `{ data: { token, expiresAt, cookieName, impersonation } }`; needs `impersonate.admins.sign-in`; any unusable code 400; 10 per minute |
829
+ | GET | `/admin-impersonation/self` | The impersonation of the calling tab (its own token only, recognised by the guard; the target may lack plugin access): `{ data: { id, expiresAt, allowChanges } }`; 401 for anyone else |
830
+ | POST | `/admin-impersonation/self/end` | Ends the impersonation of the calling tab (its own session only): `{ data: { ended } }`; 401 for anyone else |
831
+ | GET | `/impersonation/active` | **Active impersonations**: `{ data: [{ id, targetType, targetId, targetLabel, actorId, actorLabel, startedByYou, reason, durationMinutes, handoff, allowChanges, credentialIssued, startedAt, expiresAt, state }] }`; app users with `impersonate.users`, admin previews and sign-ins with `impersonate.admins` or `impersonate.admins.sign-in` |
832
+ | POST | `/impersonation/:id/end` | **End impersonation**: `{ data: { ended } }`; needs the impersonate permission of its kind; 404 for unknown ids |
827
833
 
828
834
  **Session list parameters.** `page` (from 1), `pageSize` (1-100), `status` (`all`, `open`, `active`, `idle`, `ended`), `reason` (with `status=ended`: `logout`, `idle`, `expired`, `manual`, `blocked`, `unrecorded`), `search` (up to 100 characters; matches email, username, IP address, browser, operating system and device type) and `sort` (`loginTime:desc`, `loginTime:asc`, `lastActive:desc`, `lastActive:asc`). The response is `{ data, meta: { pagination: { page, pageSize, total, pageCount } } }` with exact totals. Unknown or out-of-range parameters return 400. Pages that start after the first 50,000 matching sessions return 400; narrow the filter or use the export, which walks every row with a cursor. Without `page` and `pageSize`, `GET /sessions` keeps the 4.x response (latest 1,000 rows, `meta.truncated`) for existing scripts.
829
835
 
@@ -1069,11 +1075,11 @@ body[data-impersonating]::before {
1069
1075
  - What: a credential of the user's own permissions, never more; credential, account and session changes are refused.
1070
1076
  - How long: at most 60 minutes, enforced server-side; codes 60 seconds and single use.
1071
1077
  - Accountability: reason, duration, actor and target in the security log; optional email to the user.
1072
- - Not covered: requests your own routes make on the user's behalf are not restricted unless they match the list above; review custom routes that change credentials or emails. Admins of the admin panel cannot be impersonated; see [View as admin](#view-as-admin-read-only-permission-preview).
1078
+ - Not covered: requests your own routes make on the user's behalf are not restricted unless they match the list above; review custom routes that change credentials or emails. For admins of the admin panel see [View permissions](#view-permissions-of-an-admin-read-only-preview) and [Sign in as another admin](#sign-in-as-another-admin).
1073
1079
 
1074
- ### View as admin (read-only permission preview)
1080
+ ### View permissions of an admin (read-only preview)
1075
1081
 
1076
- **What it does.** In Session Manager › Admin panel, the row action **View as** (the person icon next to **View sessions** and **Sign out everywhere**; on narrow screens a **View as** button) opens a dialog that asks for a reason and a duration (15 or 30 minutes) and then shows which content types that admin can open and with which actions (Create, Read, Update, Delete, Publish; "restricted" when fields, locales or conditions limit them), their roles and their other permissions, computed on the server from their role permissions with Strapi's permission service. A banner on top reads "You are viewing as … · read-only · ends in mm:ss · End". Nobody is signed in and nothing can be changed: the preview creates no session and no token, so read-only holds by construction. Closing the dialog, **End**, the end of the duration or turning the switch off ends it; it also shows in **Active impersonations** while it runs. Needs **View as admin (read-only permission preview)** (`plugin::magic-sessionmanager.impersonate.admins`) and the **Allow impersonation** switch.
1082
+ **What it does.** In Session Manager › Admin panel, the row action **View permissions** (the person icon next to **View sessions** and **Sign out everywhere**; on narrow screens a **View permissions** button; called **View as** up to 4.22) opens a dialog that asks for a reason and a duration (15 or 30 minutes) and then shows which content types that admin can open and with which actions (Create, Read, Update, Delete, Publish; "restricted" when fields, locales or conditions limit them), their roles and their other permissions, computed on the server from their role permissions with Strapi's permission service. A banner on top reads "You are viewing as … · read-only · ends in mm:ss · End". Nobody is signed in and nothing can be changed: the preview creates no session and no token, so read-only holds by construction. Closing the dialog, **End**, the end of the duration or turning the switch off ends it; it also shows in **Active impersonations** while it runs. Needs **View admin permissions (read-only preview)** (`plugin::magic-sessionmanager.impersonate.admins`) and the **Allow impersonation** switch.
1077
1083
 
1078
1084
  **Anti-escalation (server-side).** Refused with 403 and `details.reason`:
1079
1085
 
@@ -1085,9 +1091,36 @@ body[data-impersonating]::before {
1085
1091
 
1086
1092
  The preview is visible only to the admin who started it. Admin names in it and in the list need Strapi's **Read** permission on Users (`admin::users.read`), as in the Admin panel view.
1087
1093
 
1088
- **Why not a real admin session.** Strapi 5.63 has no impersonation in its admin, core, Users & Permissions or Content Manager packages, and no documented way for a plugin to sign a browser in as another admin. The server side would be possible (`strapi.sessionManager('admin').generateRefreshToken(adminId, deviceId, { metadata })`, and a global middleware could refuse every non-GET request of such a session). But the admin panel keeps its access token in internal storage (`localStorage.jwtToken` or a cookie whose name is built into the bundle) that no public admin API can set (`useAuth` only offers `login` with credentials), every open tab adopts a changed token, the admin panel has no global injection zone for a banner on every page (`admin.injectionZones` is empty and the plugin `initializer` unmounts once plugins are ready), and Strapi's `POST /admin/logout` without a device id deletes every session of the signed-in admin, which in an impersonated tab would be the other admin's sessions. Building on those internals could break with any Strapi update and could sign the real admin out or act with the wrong identity, so the plugin offers the honest preview instead. Content Manager activity is therefore never attributed to an impersonation (`meta.impersonatedBy` does not occur): a preview cannot do anything.
1094
+ **Signing in as the admin.** To work in the admin panel as that admin, with their menu and permissions, use [Sign in as another admin](#sign-in-as-another-admin) (4.23). The preview stays the lighter option: it creates no session and cannot change anything, so Content Manager activity is never attributed to a preview.
1089
1095
 
1090
- **Works councils and GDPR (information, not legal advice).** Acting as a user processes that user's personal data. A typical basis is a legitimate interest in support and in fixing faults (Art. 6(1)(f) GDPR) or the contract with the user; tell users in your privacy information (Art. 13) and consider turning on the email notice. The security log shows which admin did what and when; in Germany a technical system that can monitor employees' behaviour or performance is subject to the works council's co-determination (Section 87(1) no. 6 BetrVG), and comparable rules exist elsewhere. Agree the feature with the works council where there is one before you turn it on, keep the circle of roles small, and check whether a data protection impact assessment (Art. 35 GDPR) is needed.
1096
+ ### Sign in as another admin
1097
+
1098
+ Since 4.23 an admin can work in the admin panel **as another admin**, with that admin's menu, content types and permissions, in a separate browser tab, for 15 or 30 minutes. The admin's own tabs stay signed in as themselves the whole time. Off by default.
1099
+
1100
+ **Turn it on.** The **Allow impersonation** switch (Settings › Session Manager › Impersonation) and the permission **Sign in as another admin** (`plugin::magic-sessionmanager.impersonate.admins.sign-in`, Settings › Administration Panel › Roles › Plugins › Session Manager › Impersonation). The Super Admin role holds it automatically; other roles only when granted. It is a separate permission from **View admin permissions**.
1101
+
1102
+ **Start.** Session Manager › Admin panel › row action **Sign in as** (the key icon; on narrow screens a **Sign in as** button). The dialog asks for a reason (3 to 255 characters, stored in the security log), the duration (15 or 30 minutes) and **Allow changes** (off by default; when you tick it, a warning explains that your changes will show as made by the other admin). **Start sign-in** then offers **Open tab signed in as …**: a link that opens a new tab and works once, within one minute. The new tab shows a dark bar on every page: "Signed in as … · Read-only (or Changes allowed) · Ends in mm:ss · End impersonation".
1103
+
1104
+ **End.** **End impersonation** in the bar; **End** in **Active impersonations** (on the Admin panel page and in Settings › Impersonation); Strapi's own **Log out** in that tab; signing out in your own tab; turning the switch off; or the end of the duration. The tab then shows "The impersonation ended" with **Close tab** and **Back to my admin panel**. Ending deletes exactly one Strapi admin session, the one created for the impersonation. Your own sessions and the other admin's own sessions are never touched (real-HTTP and two-tab browser tests prove it).
1105
+
1106
+ **Security model.**
1107
+
1108
+ - **Who.** Only roles with **Sign in as another admin**, only while the switch is on, only signed-in admins (admin API tokens: 403 `api-token`). Never yourself (`self`), never a Super Admin, Super Admins included (`super-admin`; a caller without `admin::users.read` gets 404 instead, as for the preview), never an account that is not active (`inactive`), and a non-Super-Admin only an admin whose every effective permission they hold themselves (`not-subset`, the same comparison as the preview). One running sign-in per target admin (`already-active`). No nesting: an impersonation session cannot start another one (`nested`), and every route of this plugin except its own two tab routes refuses changes from it.
1109
+ - **The session.** When the new tab redeems the code, the server creates a Strapi admin session for the target with `strapi.sessionManager('admin').generateRefreshToken(adminId, deviceId, { type: 'session', metadata })` on its own device id (`msm-admin-impersonation-…`, metadata `deviceName: 'Impersonation'`, `msmImpersonation: <id>`), sets the session's expiry to the end of the impersonation (Strapi's admin auth strategy checks it on every request), and returns one access token. The refresh token never leaves the server, so the tab cannot renew the session, and Strapi's access-token lifespan (`admin.auth.sessions.accessTokenLifespan`, default 30 minutes) is the upper bound: durations longer than it are not offered. The other admin sees the session as "Impersonation" in their own **Profile › Sessions** while it runs.
1110
+ - **The code.** 32 random bytes, stored as a SHA-256 hash, valid 60 seconds, single use (atomic). It travels in the URL fragment (`#code=…`), which browsers never send to a server, and the tab removes it from the address bar at once. Only the admin who started the sign-in can redeem it: the exchange runs with that admin's own token and still needs the permission.
1111
+ - **Read-only by default.** A server middleware recognises the session (signed token plus the session marker) on every admin request and refuses every method other than GET, HEAD and OPTIONS with 403 `impersonation-read-only`, except Strapi's read-only `POST /admin/permissions/check`. Strapi shows the refusal as a normal error notification.
1112
+ - **Never, even with "Allow changes".** 403 `impersonation-identity` for the other admin's account, password and sessions (`/admin/users/me…`), admin users and invitations (`/admin/users…`), roles, API and transfer tokens, SSO providers, sign-in, registration, password reset and token renewal routes, and every change route of this plugin.
1113
+ - **Logout.** `POST /admin/logout` with the impersonation's token never reaches Strapi: Strapi's logout without a device id deletes every session of the signed-in admin, which here would be the other admin's. The middleware ends the impersonation instead and answers 200.
1114
+ - **Attribution.** With **Allow changes** Strapi records changes as made by the other admin: `updatedBy`/`createdBy`, "Last edited by", the history and Strapi's own audit log show that admin, because Strapi has no notion of acting on behalf of someone. The plugin records every allowed change in its security log as `impersonation.write` with the real admin as the actor and `meta.impersonating` = the other admin, plus `meta.method`, `meta.route` (no query string, no body) and `meta.status`. Refused requests are recorded as `impersonation.refused` (`call-read-only`, `call-identity`; at most one per minute and reason). The sign-in history of the other admin lists all of it under the filter **Impersonation**.
1115
+ - **Expiry.** At most 30 minutes, enforced on the server (session expiry, the middleware and the 30-second sweep) and shown in the bar.
1116
+
1117
+ **How the tab stays separate.** Strapi's admin panel keeps one access token for all tabs of a browser (`localStorage.jwtToken`, or the access cookie when "Remember me" is off) and renews it with `POST /admin/access-token` and the shared httpOnly refresh cookie; no public API sets it per tab. The plugin's admin code therefore isolates the impersonation tab itself, and only while that tab's own `sessionStorage` holds the impersonation (sessionStorage belongs to one tab): reads of `jwtToken` and `isLoggedIn` answer with the impersonation token and writes to them are dropped, the access cookie is hidden in that tab, and its `fetch` never calls `/admin/access-token` (so the real admin's refresh cookie is neither used nor rotated), never signs in, and turns `/admin/logout` into "end this impersonation". This runs before Strapi reads the token. Every other tab keeps reading the shared storage, so it stays the real admin. A tab duplicated from the impersonation tab inherits its sessionStorage and is the same impersonation.
1118
+
1119
+ **Version guard.** The tab separation relies on Strapi admin internals that have been identical from 5.50.0 to 5.64.0 (checked in the installed sources: `reducer.mjs` `getStoredToken`, `utils/getFetchClient.mjs`, `features/Auth.mjs`). On any other Strapi release (an untested minor such as 5.65, or a new major) **Sign in as** is disabled with the reason shown in its tooltip and dialog, and the server answers 403 `unsupported`, until a plugin release has been tested against it. `GET /impersonation/status` reports `adminSignIn: { supported, version, reason, durations }`.
1120
+
1121
+ **Not covered.** The impersonation tab uses the other admin's permissions, nothing more; it cannot reach the Content API with that token. Requests your own admin routes make are restricted like every other admin request (read-only unless allowed; identity paths never). Browser extensions or scripts in the same browser profile can read sessionStorage like any page script.
1122
+
1123
+ **Works councils and GDPR (information, not legal advice).** Acting as a user processes that user's personal data. A typical basis is a legitimate interest in support and in fixing faults (Art. 6(1)(f) GDPR) or the contract with the user; tell users in your privacy information (Art. 13) and consider turning on the email notice. The security log shows which admin did what and when; in Germany a technical system that can monitor employees' behaviour or performance is subject to the works council's co-determination (Section 87(1) no. 6 BetrVG), and comparable rules exist elsewhere. Agree the feature with the works council where there is one before you turn it on, keep the circle of roles small, and check whether a data protection impact assessment (Art. 35 GDPR) is needed. **Sign in as another admin** concerns employees on both sides: the admin who is signed in as sees the other admin's work view, and, with **Allow changes**, Strapi shows the changes as that admin's work, while the security log records who really made them. In Germany both the impersonation itself and the log of what the impersonating admin did are matters for co-determination; agree when it may be used (for example only with a ticket and with the other admin informed), whether **Allow changes** may be used at all, and who may read the log. Tell the admins concerned that their account can be used this way.
1091
1124
 
1092
1125
  ## Running several instances (Railway replicas, pm2 cluster)
1093
1126
 
@@ -1277,7 +1310,7 @@ The plugin sits in the request path of every authenticated Content API call, so
1277
1310
  - **Reporting a vulnerability.** Please do not post exploit details in a public issue. Open an issue that asks for a private contact, or use the email address on the maintainer's GitHub profile, and you will get a reply before anything is published.
1278
1311
  - **Secrets.** MaxMind license keys are never returned to the browser. Webhook URLs grant posting rights to your channel; treat them as secrets. Exports never contain tokens.
1279
1312
  - **Admin panel sessions.** The Admin panel view reads Strapi's own `admin::session` records (origin `admin`). Only Super Admin can see or sign out admins until another role is granted `admin-sessions.read` / `admin-sessions.revoke`; a delegated role cannot sign out a Super Admin. Sign-outs need a signed-in administrator (not an admin API token), are rate limited and logged with admin ids and counts only.
1280
- - **Impersonation.** Off by default; only roles with **Impersonate app users**, only signed-in admins, at most 60 minutes, credential and account changes refused, every start, end, expiry and refusal in the security log. Admins are never impersonated; **View as** shows a read-only permission preview with anti-escalation rules. Details: [Impersonation](#impersonation).
1313
+ - **Impersonation.** Off by default; only roles with **Impersonate app users**, only signed-in admins, at most 60 minutes, credential and account changes refused, every start, end, expiry and refusal in the security log. **View permissions** shows a read-only permission preview of an admin; **Sign in as another admin** (4.23) opens a separate tab with a real admin session of another admin, read-only unless changes are allowed, never for Super Admins or wider roles, every change recorded for the real admin. Details: [Impersonation](#impersonation).
1281
1314
  - **Admin activity and sign-in history.** The plugin's security log stores admin sign-ins with IP address and user agent (on by default; IP anonymisation and retention configurable) and, only when you turn it on, Content Manager activity. Only Super Admin sees it until another role gets `admin-activity.read`. Typed emails of failed sign-ins, passwords and request bodies are never stored. Details and legal notes: [Admin activity and sign-in history](#admin-activity-and-sign-in-history).
1282
1315
 
1283
1316
  ---
@@ -1286,17 +1319,18 @@ The plugin sits in the request path of every authenticated Content API call, so
1286
1319
 
1287
1320
  Information for your records of processing, a data protection impact assessment or a works agreement (Germany: section 87(1) no. 6 BetrVG when the users are employees). It describes the software, not your legal basis; it is not legal advice.
1288
1321
 
1289
- | Data | When it is recorded | Where | Kept for | Who can see it | Switch |
1290
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
1291
- | App-user session: user, sign-in, last activity and sign-out time, end reason, IP address, browser, system, device type, country and city (when location lookup is on) | Every sign-in and while the session is used | `magic_sessions` | Ended sessions: `retentionDays` (default 90; presets 7, 90, 365; or forever) | Admins with **Access the Session Manager plugin**; the user through the Content API | IP shortening: **Shorten IP addresses of sessions** (off); location: **IP location lookup** |
1292
- | Device key (HMAC of browser family, system family, device type and the app's `deviceId`) | Every sign-in | `magic_sessions.device_key` | With the session | Nobody in the UI (used only to compare devices) | Always; it cannot be turned back into the device |
1293
- | Rounded location (0.1 degree, about 11 km) | Every sign-in while **Detect impossible travel** is on | Inside the session's location | With the session | Admins with plugin access | **Detect impossible travel** (off) |
1294
- | Failed and refused app-user sign-ins, locks, unlocks (with the admin who unlocked), session-limit and password-change endings, new device, impossible travel, "This wasn't me", data exports | When they happen | `magic_sessions_security_events` | `securityLogRetentionDays` (default 90) | Admins with **View app-user security activity** (emails only with Content Manager read access to users), the user (own-data export) | **Record failed and refused sign-ins** (on) for failed/refused/locks; the others only while their feature is on |
1295
- | Unknown-account sign-ins | Once per anonymised address per 5 minutes | Same log, without account and without the typed name | Same | Same | Same |
1296
- | Lock counters | During the counting window and the lock | `magic_sm_counters` (SHA-256 hashes of IP and identifier) | Until the lock ends | Nobody (hashes) | Lockout thresholds; 0 turns a lock off |
1297
- | "Locked now" entries | While a lock lasts | `magic_sm_cache` | Until the lock ends | Admins with plugin access | Follows the log's IP options |
1298
- | Admin sign-ins and, opt-in, Content Manager activity | See [Admin activity](#admin-activity-and-sign-in-history) | Security log | `securityLogRetentionDays` | Admins with **View admin activity** | **Record admin sign-ins** (on), **Record Content Manager activity** (off) |
1299
- | Impersonations: admin, user, reason, duration, start and end; refused starts and refused requests | When an admin impersonates a user | `magic_sessions_impersonations` and the security log | Table: 7 days after the end; log: `securityLogRetentionDays` | Admins with **Impersonate app users** (list), **View admin activity** (log) | **Allow impersonation** (off) |
1322
+ | Data | When it is recorded | Where | Kept for | Who can see it | Switch |
1323
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
1324
+ | App-user session: user, sign-in, last activity and sign-out time, end reason, IP address, browser, system, device type, country and city (when location lookup is on) | Every sign-in and while the session is used | `magic_sessions` | Ended sessions: `retentionDays` (default 90; presets 7, 90, 365; or forever) | Admins with **Access the Session Manager plugin**; the user through the Content API | IP shortening: **Shorten IP addresses of sessions** (off); location: **IP location lookup** |
1325
+ | Device key (HMAC of browser family, system family, device type and the app's `deviceId`) | Every sign-in | `magic_sessions.device_key` | With the session | Nobody in the UI (used only to compare devices) | Always; it cannot be turned back into the device |
1326
+ | Rounded location (0.1 degree, about 11 km) | Every sign-in while **Detect impossible travel** is on | Inside the session's location | With the session | Admins with plugin access | **Detect impossible travel** (off) |
1327
+ | Failed and refused app-user sign-ins, locks, unlocks (with the admin who unlocked), session-limit and password-change endings, new device, impossible travel, "This wasn't me", data exports | When they happen | `magic_sessions_security_events` | `securityLogRetentionDays` (default 90) | Admins with **View app-user security activity** (emails only with Content Manager read access to users), the user (own-data export) | **Record failed and refused sign-ins** (on) for failed/refused/locks; the others only while their feature is on |
1328
+ | Unknown-account sign-ins | Once per anonymised address per 5 minutes | Same log, without account and without the typed name | Same | Same | Same |
1329
+ | Lock counters | During the counting window and the lock | `magic_sm_counters` (SHA-256 hashes of IP and identifier) | Until the lock ends | Nobody (hashes) | Lockout thresholds; 0 turns a lock off |
1330
+ | "Locked now" entries | While a lock lasts | `magic_sm_cache` | Until the lock ends | Admins with plugin access | Follows the log's IP options |
1331
+ | Admin sign-ins and, opt-in, Content Manager activity | See [Admin activity](#admin-activity-and-sign-in-history) | Security log | `securityLogRetentionDays` | Admins with **View admin activity** | **Record admin sign-ins** (on), **Record Content Manager activity** (off) |
1332
+ | Impersonations: admin, user, reason, duration, start and end; refused starts and refused requests | When an admin impersonates a user | `magic_sessions_impersonations` and the security log | Table: 7 days after the end; log: `securityLogRetentionDays` | Admins with **Impersonate app users** (list), **View admin activity** (log) | **Allow impersonation** (off) |
1333
+ | Sign-ins as another admin (4.23): real admin, target admin, reason, duration, whether changes were allowed, start and end; every change made (method, path, status) and every refused request | When an admin signs in as another admin | `magic_sessions_impersonations`, the security log, and one Strapi `admin::session` row for the duration | Table: 7 days after the end; log: `securityLogRetentionDays`; session: deleted at the end | Admins with **Sign in as another admin** or **View admin permissions** (list), **View admin activity** (log); the target admin sees the session in their own profile | **Allow impersonation** (off) |
1300
1334
 
1301
1335
  What leaves the server, only when you turn it on: security emails through Strapi's email provider; Discord, Slack and the signed webhook with the selected events (user documentId, IP as the log stores it, browser, country, city, event details; never email addresses or passwords); IP lookups at ipapi.co only with the `auto`/`ipapi` provider. No telemetry.
1302
1336