strapi-plugin-magic-sessionmanager 4.13.1 → 4.14.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 (27) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +99 -53
  3. package/dist/admin/{Analytics-BikQQx_J.js → Analytics-DSG3shUY.js} +1 -1
  4. package/dist/admin/{Analytics-DIY51RI_.mjs → Analytics-oW2QbDj4.mjs} +1 -1
  5. package/dist/admin/{App-B3vaybSO.mjs → App-BRj2qIUs.mjs} +1036 -11
  6. package/dist/admin/{App-BV1LM9Bp.js → App-DcxqQfMT.js} +1034 -9
  7. package/dist/admin/{OnlineUsersWidget-fJogM1xl.js → OnlineUsersWidget-CCTnV-aE.js} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-T-2upsDd.mjs → OnlineUsersWidget-wxDYyK5v.mjs} +1 -1
  9. package/dist/admin/{Settings-BpBlXyMY.mjs → Settings-BNPO9cXS.mjs} +1 -1
  10. package/dist/admin/{Settings-AyYka8wn.js → Settings-XdBlPves.js} +1 -1
  11. package/dist/admin/{de-z0aHRwdw.js → de-B0CBR1Dw.js} +89 -1
  12. package/dist/admin/{de-BSCDuq1i.mjs → de-BlKn1pSD.mjs} +89 -1
  13. package/dist/admin/{en-BWPOiiMt.js → en-D0ZGIIjz.js} +89 -1
  14. package/dist/admin/{en-B4Cuq9JN.mjs → en-IT0YTY8f.mjs} +89 -1
  15. package/dist/admin/{es-DBAmysKi.mjs → es-BCGzaaCh.mjs} +89 -1
  16. package/dist/admin/{es-CMskkUh-.js → es-CWee-XCR.js} +89 -1
  17. package/dist/admin/{fr-ClJ2BkrE.js → fr-rQS1M7jE.js} +89 -1
  18. package/dist/admin/{fr-BNGdtjEl.mjs → fr-xBIH4Byq.mjs} +89 -1
  19. package/dist/admin/{index-DyE1rLW0.js → index-BBZNey0n.js} +15 -10
  20. package/dist/admin/{index-mCVi1j7e.mjs → index-BcQdNWzu.mjs} +33 -28
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +2 -2
  23. package/dist/admin/{pt-CRh_J7JS.js → pt-C-yTLhnS.js} +89 -1
  24. package/dist/admin/{pt-Cl7TWsOV.mjs → pt-DWDeIDVa.mjs} +89 -1
  25. package/dist/server/index.js +666 -1
  26. package/dist/server/index.mjs +666 -1
  27. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # [4.14.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.13.1...v4.14.0) (2026-11-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * see and sign out Strapi admin panel sessions ([#22](https://github.com/Schero94/Magic-Sessionmanager/issues/22)) ([a088b03](https://github.com/Schero94/Magic-Sessionmanager/commit/a088b039968c6679676e0df9cb0d34fc440b047b))
7
+
8
+
9
+ Release type: minor (`feat`), no breaking change. Existing routes, responses, numbers, widgets, settings and Content API features are unchanged. No migration needed.
10
+
11
+ ### Added
12
+
13
+ * **Admin panel sessions.** A new **Admin panel** view on the Session Manager page (`/admin/plugins/magic-sessionmanager/admin-panel`), next to the app-user dashboard, shows who can use the Strapi admin panel and who is signed in: every admin with roles, status (Signed in, Not signed in, Deactivated, Invited), last activity and the signed-in browsers (Strapi's device label, signed in, last active, latest end, "This browser", "Remember me"). Search, a sign-in status filter and pagination run on the server. All five languages.
14
+ * **Sign admins out.** **Sign out** (one browser) and **Sign out everywhere**, each confirmed. Strapi 5.62 checks the admin session on every admin request, so the admin is signed out on their next click and lands on the login page; there is no waiting for the access token to expire. The plugin deletes every Strapi session record of the browser, so older access tokens of rotated records stop working too. Signing yourself out of the current browser shows a warning. **Manage in Settings** links to Strapi's Settings › Users to deactivate an account.
15
+ * Admin routes `GET /magic-sessionmanager/admin-sessions/admins`, `GET /magic-sessionmanager/admin-sessions/admins/:adminId/sessions`, `POST /magic-sessionmanager/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` and `POST /magic-sessionmanager/admin-sessions/admins/:adminId/sign-out-everywhere` (contracts in the README).
16
+ * RBAC actions `plugin::magic-sessionmanager.admin-sessions.read` ("Read admin panel sessions") and `plugin::magic-sessionmanager.admin-sessions.revoke` ("Sign out admins"), granted to Super Admin only by default.
17
+
18
+ ### Security
19
+
20
+ * Sign-outs need a signed-in administrator (admin API tokens get 403), are limited to 10 per minute per admin, and write one info log line with admin ids and counts only (`[magic-sessionmanager] Admin sign-out: actor=… target=… scope=one|all ended=…`), plus the Strapi event `magic-sessionmanager.admin-sessions.signed-out`.
21
+ * An admin without the Super Admin role cannot sign out a Super Admin (403 `super-admin-protected`), so the last active Super Admin can never be signed out by someone else.
22
+ * A session id that is not a live session of the given admin answers 404, like an unknown id. Responses never contain tokens, device ids or password fields. The plugin stores nothing about admins; Strapi records no IP address for admin sessions.
23
+
24
+ ### Changed
25
+
26
+ * Admin session rows (`origin = 'admin'`) stay out of every app-user number; regression tests now cover the dashboard statistics, the untracked-session count and the widget totals with admin sessions present.
27
+
28
+ ### Tests
29
+
30
+ * Real-HTTP suite `tests/isolated-admin-sessions-http.test.js` on SQLite and PostgreSQL: admins sign in through `POST /admin/login`; listing, sign-out of one browser and everywhere, self sign-out, Super Admin guard, RBAC denials, rate limit, rejected next request and refresh. New CI job runs it, plus the existing HTTP access suite in both JWT modes, against the Strapi 5.62 devDependencies (`@strapi/plugin-users-permissions` is now a devDependency).
31
+
1
32
  ## [4.13.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.13.0...v4.13.1) (2026-11-17)
2
33
 
3
34
 
package/README.md CHANGED
@@ -6,14 +6,16 @@
6
6
 
7
7
  **See who is signed in to your Strapi 5 app, end any session in one click, and stop password guessing before it reaches your users.**
8
8
 
9
- Magic Session Manager records every sign-in through Users & Permissions as a session. Admins see who is online, end single sessions or all sessions of a user, block accounts and review sign-in history. Your app gets logout routes, a "my devices" list for users, failed-login lockout and optional country rules. It works with Strapi's native refresh-token sessions and with several server processes on one database.
9
+ Magic Session Manager records every sign-in through Users & Permissions as a session. Admins see who is online, end single sessions or all sessions of a user, block accounts and review sign-in history. Your app gets logout routes, a "my devices" list for users, failed-login lockout and optional country rules. It works with Strapi's native refresh-token sessions and with several server processes on one database. A separate **Admin panel** view shows who is signed in to the Strapi admin panel itself and signs an admin out of one browser or everywhere.
10
10
 
11
11
  Free and open source under the MIT license. Every feature works without an account, key or activation, and the plugin sends nothing to its author.
12
12
 
13
13
  [![npm version](https://img.shields.io/npm/v/strapi-plugin-magic-sessionmanager.svg)](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager)
14
14
  [![npm downloads](https://img.shields.io/npm/dm/strapi-plugin-magic-sessionmanager.svg)](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager)
15
- [![Tests](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml/badge.svg)](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml)
15
+ [![CI build status](https://img.shields.io/github/actions/workflow/status/Schero94/Magic-Sessionmanager/test.yml?branch=main&label=CI&logo=github)](https://github.com/Schero94/Magic-Sessionmanager/actions/workflows/test.yml?query=branch%3Amain)
16
16
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Schero94/Magic-Sessionmanager/blob/main/LICENSE)
17
+ [![Strapi 5.0+](https://img.shields.io/badge/Strapi-5.0%2B-4945FF.svg)](https://github.com/Schero94/Magic-Sessionmanager#compatibility)
18
+ [![Documentation site](https://img.shields.io/badge/docs-project%20site-6d4aff.svg)](https://schero94.github.io/Magic-Sessionmanager/)
17
19
 
18
20
  Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.github.io/Magic-Sessionmanager/) · [npm](https://www.npmjs.com/package/strapi-plugin-magic-sessionmanager) · [Changelog](https://github.com/Schero94/Magic-Sessionmanager/blob/main/CHANGELOG.md) · [Report a bug](https://github.com/Schero94/Magic-Sessionmanager/issues/new/choose) · [Discussions](https://github.com/Schero94/Magic-Sessionmanager/discussions)
19
21
 
@@ -64,6 +66,7 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
64
66
  | Location | IP location from a local MaxMind GeoLite2 database (no third party in the sign-in path) or from ipapi.co, or turned off. |
65
67
  | Alerts | Security emails to the user through Strapi's Email plugin and sign-in notifications to Discord or Slack. |
66
68
  | Admin integration | A Sessions panel next to each user in the Content Manager and an Online users widget on the Strapi homepage. |
69
+ | 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. |
67
70
  | Native Strapi sessions | Works with `jwtManagement: 'refresh'` (Strapi's own sessions and refresh tokens) and with `'legacy-support'`. |
68
71
  | Several processes | Lockout, rate limits, jobs and settings stay consistent across pm2 workers and Railway replicas that share one database. |
69
72
  | Privacy | Stored tokens are encrypted (AES-256-GCM) and never returned. Retention deletes old history automatically. No telemetry. |
@@ -97,7 +100,7 @@ Yarn and pnpm work the same way (`yarn add strapi-plugin-magic-sessionmanager`,
97
100
 
98
101
  ## Screenshots
99
102
 
100
- All screenshots use synthetic data: users `*.example.test`, IP addresses from the documentation range `203.0.113.0/24`, Strapi 5.61. The [full gallery](https://schero94.github.io/Magic-Sessionmanager/#screenshots) on the project site also shows dark mode, every settings tab, the untracked sign-in dialogs and more mobile views.
103
+ All screenshots use synthetic data: users `*.example.test`, IP addresses from the documentation range `203.0.113.0/24`, Strapi 5.61. The [full gallery](https://schero94.github.io/Magic-Sessionmanager/#screenshots) on the project site also shows Analytics, dark mode, every settings tab, the untracked sign-in dialogs and more mobile views.
101
104
 
102
105
  ### Session details
103
106
 
@@ -115,14 +118,16 @@ All screenshots use synthetic data: users `*.example.test`, IP addresses from th
115
118
 
116
119
  ![Configuration page, Sessions tab, with Session lifetime and Token check cards](https://schero94.github.io/Magic-Sessionmanager/img/settings1.webp)
117
120
 
118
- ### Analytics
119
-
120
- ![Analytics page with four KPIs, Devices and Browsers bar cards and the average session length](https://schero94.github.io/Magic-Sessionmanager/img/analytics.webp)
121
-
122
121
  ### Untracked Strapi sign-ins (refresh mode)
123
122
 
124
123
  ![Neutral notice: 37 older Strapi sign-ins are not tracked, with Why? and End these sessions](https://schero94.github.io/Magic-Sessionmanager/img/untracked-notice-neutral.webp)
125
124
 
125
+ ### Admin panel sessions
126
+
127
+ Strapi 5.62, synthetic admins `*.example.test`. The [gallery](https://schero94.github.io/Magic-Sessionmanager/#screenshots) also shows the sessions dialog, the sign-out confirmation, what the signed-out admin sees, dark mode and the phone layout.
128
+
129
+ ![Admin panel sessions: view switch App users / Admin panel, cards Signed-in admins, Not signed in and All admins, an explanation of how signing out works, search, a sign-in status filter and a table of admins with roles, status and last activity](https://schero94.github.io/Magic-Sessionmanager/img/admin-panel.webp)
130
+
126
131
  ### Mobile (390 px)
127
132
 
128
133
  <img src="https://schero94.github.io/Magic-Sessionmanager/img/mobile-dashboard.webp" width="300" alt="Sessions dashboard at 390 px: the table becomes a card list with Details, End session and More buttons">
@@ -164,14 +169,15 @@ All screenshots use synthetic data: users `*.example.test`, IP addresses from th
164
169
 
165
170
  ## Screens
166
171
 
167
- | Where | Name | Answers |
168
- | ------------------------------- | ------------------------------------------- | --------------------------------------------------------- |
169
- | Main menu | **Session Manager** (page title "Sessions") | Which sessions exist, and which need action? |
170
- | Dialog on the dashboard | **Session details** | What is this session, and why is it in this state? |
171
- | Content Manager, User edit view | **Sessions** panel | What access does this user have, and how do I cut it off? |
172
- | Strapi homepage | **Online users** widget | Who is online right now? |
173
- | Settings › Session Manager | **Configuration** | How should sessions and sign-ins behave? |
174
- | Settings › Session Manager | **Analytics** | How are sessions used over time and by device? |
172
+ | Where | Name | Answers |
173
+ | ------------------------------- | ------------------------------------------- | -------------------------------------------------------------------- |
174
+ | Main menu | **Session Manager** (page title "Sessions") | Which sessions exist, and which need action? |
175
+ | Dialog on the dashboard | **Session details** | What is this session, and why is it in this state? |
176
+ | Content Manager, User edit view | **Sessions** panel | What access does this user have, and how do I cut it off? |
177
+ | Strapi homepage | **Online users** widget | Who is online right now? |
178
+ | Session Manager › Admin panel | **Admin panel sessions** | Who is signed in to this admin panel, and how do I sign someone out? |
179
+ | Settings › Session Manager | **Configuration** | How should sessions and sign-ins behave? |
180
+ | Settings › Session Manager | **Analytics** | How are sessions used over time and by device? |
175
181
 
176
182
  ### Sessions dashboard
177
183
 
@@ -185,6 +191,19 @@ All screenshots use synthetic data: users `*.example.test`, IP addresses from th
185
191
  - In `refresh` mode, a notice above the cards counts **untracked Strapi sign-ins**: refresh tokens Strapi still accepts that have no session details from this plugin. They are not in the list and are not active or online sessions; each user's sessions panel lists them. The notice is neutral when all of them were created before this plugin started tracking, and a warning ("Possible tracking gap") when any was created afterwards. **Why?** opens a count-only summary; **End these sessions** ends them after a confirmation. See [Untracked Strapi sessions](#untracked-strapi-sessions).
186
192
  - Below the large breakpoint the IP address and Signed in columns are hidden; below the medium breakpoint the table becomes a card list.
187
193
 
194
+ ### Admin panel sessions
195
+
196
+ Open **Session Manager** and switch to **Admin panel** (the switch below the title; shown only to roles with "Read admin panel sessions"). The view lists Strapi admin accounts, not your app's users, and none of its numbers appear on the App users dashboard, the widget or Analytics.
197
+
198
+ - **Cards:** **Signed-in admins** (with the number of signed-in browsers), **Not signed in** (including deactivated and invited accounts) and **All admins** (with the number of active accounts). Each card filters the list.
199
+ - **How signing out works:** signing out takes effect on the admin's next click, because Strapi checks the admin session on every admin request. The admin can sign in again with their password; to stop that, deactivate the account in Settings › Users (**Manage admins** in the header). The card also shows the idle timeouts your host runs with (`admin.auth.sessions`).
200
+ - **Search and filter:** name or email; **All admins**, **Signed in**, **Not signed in**. Search, filter and paging run on the server and live in the URL.
201
+ - **Table** (cards below 768 px): Admin (with a **You** badge), Roles, Status (**Signed in** · "{n} sessions", **Not signed in**, **Deactivated**, **Invited**), Last active, and the actions **View sessions** and **Sign out everywhere**.
202
+ - **Sessions of an admin:** one entry per signed-in browser with Strapi's device label (for example "Chrome on macOS"), **This browser**, **Remember me**, Signed in, Last active and **Ends at the latest**. **Sign out** ends that browser, **Sign out everywhere** ends all of them, **Manage in Settings** opens the admin in Settings › Users.
203
+ - **Confirmation:** every sign-out asks first. Signing yourself out of the browser you are using shows a warning; you are then taken to the login page.
204
+ - **Protection:** an admin without the Super Admin role cannot sign out a Super Admin, so the last active Super Admin can never be signed out by someone else. The view explains this instead of showing a disabled button.
205
+ - Strapi stores no IP address and no full user agent for admin sessions, so the view shows none. "Last active" is the last time the browser renewed its access token (Strapi's own signal), not every click.
206
+
188
207
  ### Session details
189
208
 
190
209
  - A state sentence that explains why the session is in its state, for example "Ended {time} · Ended manually."
@@ -229,16 +248,17 @@ Two links: **Configuration** and **Analytics**.
229
248
 
230
249
  ## Compatibility
231
250
 
232
- | Item | Supported |
233
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
234
- | Strapi | 5 (`@strapi/strapi` peer range `^5.0.0`). Acceptance host: Strapi 5.62.0. |
235
- | Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) |
236
- | Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` |
237
- | Homepage widget | Strapi 5.13 and later (older versions have no widgets API; the rest works) |
238
- | Required peers | `@strapi/strapi` `^5.0.0`, `@strapi/plugin-users-permissions` `^5.0.0`, `react` / `react-dom` `^18.0.0`, `react-router-dom` `^6.0.0`, `styled-components` `^6.0.0`. A new Strapi 5 app already has all of them. |
239
- | Optional peers | `@strapi/design-system` `^2.0.0`, `@strapi/icons` `^2.0.0`, `react-intl` `^6.0.0`. Strapi's admin brings them; they are marked optional so npm, Yarn and pnpm do not warn. |
240
- | Package managers | npm, Yarn 1 and pnpm. Installing into a fresh Strapi 5.61 app prints no warning about this plugin. |
241
- | Databases | PostgreSQL, MySQL, SQLite (several processes need PostgreSQL or MySQL, see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster)). |
251
+ | Item | Supported |
252
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
+ | Strapi | 5 (`@strapi/strapi` peer range `^5.0.0`). Acceptance host: Strapi 5.62.0. |
254
+ | Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) |
255
+ | Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` |
256
+ | Homepage widget | Strapi 5.13 and later (older versions have no widgets API; the rest works) |
257
+ | Admin panel sessions | Strapi 5 with Strapi's session manager (`strapi.sessionManager`, admin origin); tested with 5.62.0. Without it the view says it is not available and the sign-out routes return 503. |
258
+ | Required peers | `@strapi/strapi` `^5.0.0`, `@strapi/plugin-users-permissions` `^5.0.0`, `react` / `react-dom` `^18.0.0`, `react-router-dom` `^6.0.0`, `styled-components` `^6.0.0`. A new Strapi 5 app already has all of them. |
259
+ | Optional peers | `@strapi/design-system` `^2.0.0`, `@strapi/icons` `^2.0.0`, `react-intl` `^6.0.0`. Strapi's admin brings them; they are marked optional so npm, Yarn and pnpm do not warn. |
260
+ | Package managers | npm, Yarn 1 and pnpm. Installing into a fresh Strapi 5.61 app prints no warning about this plugin. |
261
+ | Databases | PostgreSQL, MySQL, SQLite (several processes need PostgreSQL or MySQL, see [Running several instances](#running-several-instances-railway-replicas-pm2-cluster)). |
242
262
 
243
263
  ---
244
264
 
@@ -608,30 +628,41 @@ module.exports = factories.createCoreRouter('api::order.order', {
608
628
 
609
629
  ## Admin API and permissions
610
630
 
611
- Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authenticated Strapi admin **and** the permission `plugin::magic-sessionmanager.access` ("Access the Session Manager plugin"). The same permission controls the menu link, the settings links, the widget and the user panel. Admin responses never contain tokens or the internal `sessionId`.
612
-
613
- | Method | Path | Admin UI action |
614
- | -------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
615
- | GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
616
- | GET | `/sessions/active` | Active sessions only; same paging parameters |
617
- | GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
618
- | GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
619
- | POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
620
- | GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
621
- | GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
622
- | GET | `/user/:userId/sessions` | Sessions panel |
623
- | POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
624
- | DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
625
- | POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
626
- | POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
627
- | POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
628
- | GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
629
- | GET | `/geolocation/:ipAddress` | **Look up location** |
630
- | GET | `/geoip/status` | GeoIP database status |
631
- | PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
632
- | POST | `/geoip/update` | Update database / Force download |
633
- | GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input) |
634
- | POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
631
+ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authenticated Strapi admin **and** the permission `plugin::magic-sessionmanager.access` ("Access the Session Manager plugin"). The same permission controls the menu link, the settings links, the widget and the user panel. Admin responses never contain tokens or the internal `sessionId` of a Users & Permissions session.
632
+
633
+ 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):
634
+
635
+ | Permission | Name in the role editor | Allows |
636
+ | ---------------------------------------------------- | ------------------------- | ---------------------------------------------------------- |
637
+ | `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
638
+ | `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
639
+
640
+ | Method | Path | Admin UI action |
641
+ | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
642
+ | GET | `/sessions` | Sessions dashboard: `?page=&pageSize=` (1-100), `status`, `reason`, `search`, `sort`; see below |
643
+ | GET | `/sessions/active` | Active sessions only; same paging parameters |
644
+ | GET | `/sessions/stats` | Dashboard cards and widget: counts only, cached 5 seconds per process |
645
+ | GET | `/sessions/native-only/summary` | **Why?** on the untracked-session notice: counts only, no query parameters (400 otherwise) |
646
+ | POST | `/sessions/native-only/end` | **End these sessions**: empty body; signed-in administrators only (admin API tokens get 403); 5 per minute |
647
+ | GET | `/sessions/analytics` | Analytics page: counts and grouped counts over every session, cached 30 seconds |
648
+ | GET | `/sessions/export` | Export batches of up to 1,000 rows, newest first; follow `meta.nextCursor` |
649
+ | GET | `/user/:userId/sessions` | Sessions panel |
650
+ | POST | `/sessions/:sessionId/terminate` | **End session** (reason `manual`; in refresh mode the Strapi session is revoked first; the record stays) |
651
+ | DELETE | `/sessions/:sessionId` | **Delete record** (record removed, token stays revoked; an open session also ends) |
652
+ | POST | `/sessions/clean-inactive` | **Delete ended sessions** (all users; open and idle sessions are not affected; does not run the idle check) |
653
+ | POST | `/user/:userId/terminate-all` | **End all sessions** (reason `manual`) |
654
+ | POST | `/user/:userId/toggle-block` | **Block user** / **Unblock user** |
655
+ | GET | `/users/stats` | Widget totals (`totalUsers`, `blockedUsers`) |
656
+ | GET | `/geolocation/:ipAddress` | **Look up location** |
657
+ | GET | `/geoip/status` | GeoIP database status |
658
+ | PUT | `/geoip/credentials` | Save or remove (`{ "clear": true }`) MaxMind credentials |
659
+ | POST | `/geoip/update` | Update database / Force download |
660
+ | GET, PUT | `/settings` | Configuration (PUT validates every field and returns `error.details.errors` on invalid input) |
661
+ | POST | `/sessions/:sessionId/simulate-timeout` | Development only; removed when `NODE_ENV` is `production` or `staging` |
662
+ | GET | `/admin-sessions/admins` | Admin panel view: `?page=&pageSize=` (1-100), `search` (up to 100 characters, name or email), `filter` (`all`, `signed-in`, `not-signed-in`); needs `admin-sessions.read` |
663
+ | GET | `/admin-sessions/admins/:adminId/sessions` | **View sessions**: one entry per signed-in browser; needs `admin-sessions.read` |
664
+ | POST | `/admin-sessions/admins/:adminId/sessions/:sessionId/sign-out` | **Sign out** one browser; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
665
+ | POST | `/admin-sessions/admins/:adminId/sign-out-everywhere` | **Sign out everywhere**; needs `admin-sessions.revoke`; signed-in administrators only; 10 per minute |
635
666
 
636
667
  **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.
637
668
 
@@ -641,6 +672,10 @@ The list, statistics, analytics, export, untracked-session summary and `/users/s
641
672
 
642
673
  **Block / unblock** (`toggle-block`): send `{ "blocked": true }` or `{ "blocked": false }`. This sets the state, is safe to retry and is what the admin UI sends. A request without a body still toggles, but is deprecated, because a retry after a lost response can reverse the intended state. A non-boolean `blocked` returns 400. The response contains `blocked` and `mode` (`explicit` or `toggle`). Blocking ends all open sessions with the reason `blocked`; if that fails, the response is 500 and the request can be retried.
643
674
 
675
+ **Admin panel sessions.** `GET /admin-sessions/admins` returns `{ data: [{ id, name, email, roles: [{ name, superAdmin }], account, self, sessionCount, lastActiveAt, canSignOut, protectedReason }], meta: { supported, pagination, stats: { signedInAdmins, activeSessions, activeAccounts, totalAdmins }, policy, truncated } }`. `account` is `active`, `deactivated` or `invited`. `GET …/sessions` returns `{ data: [{ id, device, signedInAt, lastActiveAt, endsAt, rememberMe, current }], meta: { admin, policy } }`; `id` is the Strapi session id of the browser's newest session record (32 hexadecimal characters). No token, refresh token, device id or password field is ever returned. Both sign-out routes return `{ data: { ended, signedOutSelf } }`: `signedOutSelf` is `true` when the browser that sent the request was signed out. Answers: 404 for an unknown admin, and for a session id that is not a live session of that admin (no probing of other admins' sessions); 403 with `error.details.reason` `super-admin-protected` when an admin without the Super Admin role tries to sign out a Super Admin, or `browser-session-required` for admin API tokens; 429 after 10 sign-outs per minute per admin; 503 when the Strapi version has no session manager (`meta.supported: false` on the GET routes). Each sign-out writes one log line, `[magic-sessionmanager] Admin sign-out: actor=<admin id> target=<admin id> scope=one|all ended=<n>`, at info level (no email, session id or token), and emits the Strapi event `magic-sessionmanager.admin-sessions.signed-out` with the same fields.
676
+
677
+ **How a sign-out works (Strapi 5.62).** The plugin deletes Strapi's own session records of that browser (`strapi.sessionManager('admin').invalidateRefreshToken(adminId, deviceId)`, the same call Strapi's logout makes) or of every browser (`invalidateRefreshToken(adminId)`). Strapi's admin authentication checks the session record on every admin request (`isSessionActive`), so the admin's next request returns 401 and the admin panel cannot renew its token: it shows the login page. There is no waiting period for the 30-minute access token (`accessTokenLifespan`). The plugin deletes every record of the browser, not only the newest one: an older access token belongs to an older, rotated record, and deleting just the newest record (`revokeSessionById`) would leave that token working until it expires. The integration suite proves both. Admin API tokens (Settings › Admin tokens) are separate from sessions and are not affected.
678
+
644
679
  Errors use Strapi's `{ data: null, error }` envelope: 400 for invalid input, 404 for unknown IDs, 500 for server-side failures, 502 for a failed MaxMind download, 409 for a settings save based on an outdated `revision`.
645
680
 
646
681
  ---
@@ -830,7 +865,7 @@ The plugin sits in the request path of every authenticated Content API call, so
830
865
  - **What leaves your server.** Only what you turn on: IP lookups at ipapi.co (provider `auto` without a local database, or `ipapi`), Discord or Slack webhooks (Team notifications), emails through your own Email provider (Security emails) and the MaxMind database download when you click **Update database** or run the updater. There is no telemetry, no install ping and no license check.
831
866
  - **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.
832
867
  - **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.
833
- - **Admin sessions** of Strapi administrators are out of scope.
868
+ - **Admin panel sessions.** The Admin panel view reads Strapi's own `admin::session` records (origin `admin`) and stores nothing of its own: no IP address, user agent or sign-in history. 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.
834
869
 
835
870
  ---
836
871
 
@@ -839,7 +874,8 @@ The plugin sits in the request path of every authenticated Content API call, so
839
874
  | Problem | Fix |
840
875
  | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
841
876
  | No Session Manager menu item | Check `config/plugins.ts`, run `npm run build`, restart, hard-refresh the browser. For non-Super-Admin roles, grant "Access the Session Manager plugin". |
842
- | No sessions appear | Only end-user sign-ins through Users & Permissions are recorded, not Strapi admin sign-ins. Check the Strapi log. |
877
+ | No **Admin panel** switch on the Session Manager page | Your role needs "Read admin panel sessions" (Settings › Roles › Plugins › Session Manager). Super Admin has it by default. |
878
+ | No sessions appear | Only end-user sign-ins through Users & Permissions are recorded on this dashboard; Strapi admin sign-ins are under **Admin panel**. Check the Strapi log. |
843
879
  | Startup fails with `SESSION_ENCRYPTION_KEY is required in production` | Set the variable and restart. |
844
880
  | 401 on every request after a sign-in | Check the `X-Session-Terminated-Reason` header. With Strict token check, tokens without a session record are rejected. |
845
881
  | 429 on sign-in | Temporary IP lockout. Wait 15 minutes or raise `maxFailedLogins`. Behind a proxy, turn on Trust proxy headers so the lockout targets the real client. With `Retry-After: 1`: more sign-ins from one address were running at once than `maxFailedLogins`; retry after a second. |
@@ -854,7 +890,10 @@ The plugin stores sessions in the `magic_sessions` table and revocations in its
854
890
  ## FAQ
855
891
 
856
892
  **Does it manage Strapi admin accounts?**
857
- No. It manages end users of Users & Permissions (`plugin::users-permissions.user`). Strapi administrator sessions are out of scope.
893
+ It shows who is signed in to the Strapi admin panel and signs admins out (**Admin panel** view). It does not create, edit or deactivate admin accounts; that stays in Strapi's Settings › Users. Everything else in the plugin is about end users of Users & Permissions (`plugin::users-permissions.user`).
894
+
895
+ **When does signing out an admin take effect?**
896
+ On the admin's next request, usually their next click: Strapi 5.62 checks the session record on every admin request. They can sign in again with their password unless you deactivate the account in Settings › Users.
858
897
 
859
898
  **Do I need a license key, account or activation?**
860
899
  No. Everything is free under MIT, and the plugin does not contact any license or telemetry server. The only key you may add is your own MaxMind key for the GeoLite2 database.
@@ -917,7 +956,14 @@ npm run verify
917
956
  npm run verify:runtime
918
957
  ```
919
958
 
920
- HTTP integration tests need Strapi host dependencies: set `SESSION_HTTP_STRAPI_NODE_MODULES` to the `node_modules` of a Strapi 5 host; without it they skip with a message.
959
+ HTTP integration tests need Strapi host dependencies: set `SESSION_HTTP_STRAPI_NODE_MODULES` to the `node_modules` of a Strapi 5 host; without it they skip with a message. This repository's own `node_modules` works (its devDependencies include Strapi 5.62 and Users & Permissions), which is what CI uses:
960
+
961
+ ```bash
962
+ SESSION_HTTP_REQUIRED=1 SESSION_HTTP_STRAPI_NODE_MODULES=$PWD/node_modules node --test tests/isolated-admin-sessions-http.test.js
963
+ # PostgreSQL: add SESSION_HTTP_DB=postgres MSM_TEST_PG_URL=postgres://user:pass@127.0.0.1:5432/db
964
+ ```
965
+
966
+ The admin panel suite signs synthetic admins in through `POST /admin/login` and checks listing, signing out one browser and everywhere, self sign-out, the Super Admin guard, RBAC denials, the rate limit, that the next request and the refresh are rejected, and that admin sessions never reach the app-user numbers.
921
967
 
922
968
  Quick manual check: sign in to your app as an end user (`POST /api/auth/local`), open Session Manager and find the session as **Active**, click **End session** and confirm, then call any Content API route with the same token: it returns 401 and the row shows **Ended · Ended manually**.
923
969
 
@@ -9,7 +9,7 @@ const styled = require("styled-components");
9
9
  const designSystem = require("@strapi/design-system");
10
10
  const icons = require("@strapi/icons");
11
11
  const symbols = require("@strapi/icons/symbols");
12
- const index = require("./index-DyE1rLW0.js");
12
+ const index = require("./index-BBZNey0n.js");
13
13
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
14
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -7,7 +7,7 @@ import styled from "styled-components";
7
7
  import { Typography, Flex, LinkButton, Button, EmptyStateLayout, VisuallyHidden } from "@strapi/design-system";
8
8
  import { ArrowClockwise, ChartBubble, User, Clock, Calendar } from "@strapi/icons";
9
9
  import { EmptyDocuments } from "@strapi/icons/symbols";
10
- import { J as normalizeDeviceType, u as useSessionFormatters, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, v as PageShell, w as StatGrid, x as StatCard, F as EqualGrid, b as getTranslation, K as getDeviceTypeMessage } from "./index-mCVi1j7e.mjs";
10
+ import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, w as PageShell, x as StatGrid, y as StatCard, G as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-BcQdNWzu.mjs";
11
11
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
12
12
  const ANALYTICS_UNKNOWN_KEY = "unknown";
13
13
  const VERSION_TOKEN = /^v?\d[\w.]*$/i;