Repository navigation
feat: see and sign out Strapi admin panel sessions - #22
Merged
Merged
Conversation
Research of Strapi 5.62.0 admin session storage and revocation, IA, API contract, guards, click paths and test plan for the 4.14.0 feature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds four admin routes under /magic-sessionmanager/admin-sessions that read
Strapi's own admin::session rows (origin admin) and sign admins out with
strapi.sessionManager('admin').invalidateRefreshToken, per browser or
everywhere. New RBAC actions admin-sessions.read and admin-sessions.revoke
(Super Admin only by default). Sign-out needs a browser session (no admin
API tokens), is limited to 10 per minute, writes an audit log line with
admin ids and counts only, and a delegated role cannot sign out a Super
Admin. Admin rows stay out of every app-user number.
Strapi 5.62 checks isSessionActive on every admin request, so a sign-out
takes effect on the next request. Deleting per device also ends access
tokens bound to rotated rows, which revokeSessionById alone leaves valid.
Real-HTTP suite on SQLite and PostgreSQL with admins signed in through
POST /admin/login; new CI job; @strapi/plugin-users-permissions 5.62.0 as a
devDependency so the suites boot without a separate host app.
Docs read: docs.strapi.io/cms/configurations/admin-panel (Session
management), Context7 /strapi/documentation; installed @strapi/core 5.62.0
services/session-manager.js, @strapi/admin 5.62.0 strategies/admin.js,
controllers/authentication.js, controllers/authenticated-session.js.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New "Admin panel" view next to the app-user dashboard (plugins/magic-sessionmanager/admin-panel), switched with a two-link navigation that only admins with admin-sessions.read see. Stat cards (signed in, not signed in, all admins) filter the list; search, filter and pagination run on the server and live in the URL. Table from the DS medium breakpoint, cards below. A sessions dialog lists every signed-in browser (Strapi's device label, signed in, last active, latest end, "This browser", "Remember me") with Sign out, Sign out everywhere and a link to Strapi's Settings > Users. Every sign-out is confirmed with ConfirmDialog, states that it takes effect on the admin's next click and warns before a self sign-out. Super Admins protected from delegated roles are explained, not shown as disabled buttons. Five locales. Docs read: installed @strapi/admin 5.62.0 useRBAC.d.ts and PageHelpers (Page.Protect matches any permission), router addMenuLink (mounts plugins/<id>/*), @strapi/design-system 2.3.1 Box/Typography types, @strapi/icons 2.3.1 (SignOut, Eye). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DS primary badge measured 2.43:1 in the dark theme; "You" and "This browser" now use the primary surface with neutral800 text. The sign-out confirmation body is a node, so it carries its own Dialog.Description (Radix warned that the AlertDialog had no description). Docs read: installed @strapi/design-system 2.3.1 Dialog (Body wraps only string children in Description), @strapi/admin 5.62.0 ConfirmDialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README, Pages and CHANGELOG [Unreleased]: the Admin panel view, the four routes and their response and error contracts, the two RBAC actions, how a sign-out takes effect in Strapi 5.62 (next request, no access-token wait), the Super Admin guard, privacy, troubleshooting, FAQ and how to run the real-HTTP suite. New README screenshots use absolute URLs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows the 4.13.1 README rules (absolute Pages image URLs, at most eight screenshots): the Admin panel view replaces the Analytics shot in the README; the sessions dialog, confirmation, signed-out view, dark mode and phone layout are in the Pages gallery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Synthetic screenshots from the isolated Strapi 5.62.0 host (packed tarball, egress blocked) and the gate with test, browser matrix, click-path, keyboard, locale and console evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 18, 2026
# [4.14.0](v4.13.1...v4.14.0) (2026-11-18) ### Features * see and sign out Strapi admin panel sessions ([#22](#22)) ([a088b03](a088b03)) Release type: minor (`feat`), no breaking change. Existing routes, responses, numbers, widgets, settings and Content API features are unchanged. No migration needed. ### Added * **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. * **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. * 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). * 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. ### Security * 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`. * 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. * 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. ### Changed * 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. ### Tests * 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New Admin panel view next to the app-user dashboard (
/admin/plugins/magic-sessionmanager/admin-panel): who can use the Strapi admin panel, who is signed in (per browser: device label, signed in, last active, latest end, "This browser", "Remember me"), and Sign out / Sign out everywhere, each confirmed. Minor release (4.14.0), no breaking change; existing routes, numbers, widget and settings are unchanged.Design note:
docs/plans/2026-11-17-admin-panel-sessions-design.md. Gate with evidence:gates/admin-sessions.md.How a sign-out takes effect (Strapi 5.62.0)
@strapi/adminstrategies/admin.jscallssessionManager('admin').isSessionActive(sessionId)on every admin request. Deleting the session rows makes the admin's next request 401 and the panel's renewal (POST /admin/access-token) 401, so they land on the login page. No wait for the 30-minute access token.isSessionActiveignoresstatus, sorevokeSessionById(deletes only the active row) leaves an access token of a rotated row valid until it expires. The plugin deletes every row of the browser viainvalidateRefreshToken(userId, deviceId)(what Strapi's own logout does). Both behaviours are proven in the HTTP suite.Server
GET /admin-sessions/admins,GET /admin-sessions/admins/:adminId/sessions,POST /admin-sessions/admins/:adminId/sessions/:sessionId/sign-out,POST /admin-sessions/admins/:adminId/sign-out-everywhere.admin-sessions.read,admin-sessions.revoke(Super Admin only by default), plus the existingaccess.magic-sessionmanager.admin-sessions.signed-out.Tests
npm test849/849; lint, format, both type checks, build, verify, verify:runtime clean.tests/isolated-admin-sessions-http.test.js(admins sign in viaPOST /admin/login): SQLite 14/14, PostgreSQL 16 14/14. Existing HTTP access suite on 5.62.0: legacy 37/37, refresh 39/39.@strapi/plugin-users-permissions5.62.0 added as devDependency).Browser acceptance
Isolated Strapi 5.62.0 host (packed tarball, SQLite, random secrets, egress blocked). 100 matrix stops (5 screens x 10 widths x light/dark) with
measure.jsall empty; 24/24 click-path/RBAC/state checks; a second browser shows what a signed-out admin sees; keyboard walk; de/fr/es/pt at 1440 and 320; 0 plugin console messages (apart from the deliberate warning for a mocked 500). Details in the gate.Docs read: docs.strapi.io/cms/configurations/admin-panel (Session management), Context7
/strapi/documentation, installed@strapi/core5.62.0services/session-manager.js,@strapi/admin5.62.0 strategies/controllers/routes/ConfirmDialog/useRBAC/PageHelpers,@strapi/design-system2.3.1 Dialog/Box/Badge.Not run: MySQL.
🤖 Generated with Claude Code