tju-yxq opened a new pull request, #5316:
URL: https://github.com/apache/rocketmq-dashboard/pull/5316
### Which Issue(s) This PR Fixes
- Fixes #5315
### Brief Description
Adds `DELETE /api/studio-users/sessions/{sessionId}` backed by
`AuthService.revokeSessionById`:
- One UPDATE over the row (`id` + `revoked_at IS NULL`) setting
`revoked_at`, mirroring the active-session predicate the bulk paths use.
- Revoking an already-revoked or expired session is a **no-op** rather than
an error, so a stale drawer never turns a repeated confirmation into a failure
toast.
- An unknown id answers 404 "Session not found", consistent with the
module's other lookups.
The drawer's session table gains an action column: a per-row destructive
confirmation (naming the session id and stating the user's other sessions stay
active) that revokes exactly that session, reloads the drawer with the
survivors, and refreshes the user table's active-session counts. It shares the
per-user in-flight guard with revoke-all, so the two actions can never overlap
on the same account. Revoke-all and every other endpoint are unchanged.
### How Did You Test This Change?
Focused suites on the branch (Windows, Java 21, Node 20; based on
`rocketmq-studio` at `6a68042f`):
```
cd server && mvn '-Dtest=AuthServiceDatabaseTest,StudioUserControllerTest'
test
[INFO] Tests run: 34, Failures: 0, Errors: 0, Skipped: 0 -- in
...AuthServiceDatabaseTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 -- in
...StudioUserControllerTest
[INFO] BUILD SUCCESS
```
Five new tests: revoking by id updates only that row with the id-scoped
predicate; an already-revoked row is a no-op; an expired row is a no-op; an
unknown id answers 404 "Session not found"; and the DELETE route maps to the
service call.
```
cd web && npm test -- UserManagement.test.tsx --run
Test Files 1 passed (1)
Tests 13 passed (13)
```
One new test covers the full drawer flow: two sessions each render a revoke
action, confirming the first revokes exactly session 19, the drawer reloads
with only the survivor, and the revoked row disappears. The existing revoke-all
tests confirm the bulk path is untouched.
```
cd web && npm run lint
✖ 10 problems (0 errors, 10 warnings) # all pre-existing warnings in files
this PR does not touch
```
```
cd web && npx tsc -b --force
(no output — exit 0)
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header (no new source files)
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]