unbridled-41 opened a new pull request, #4882:
URL: https://github.com/apache/rocketmq-dashboard/pull/4882
## Problem / Evidence
The ACL rule tab derived both the "管理员 / Admin" badge (`isAdmin`) and the
principal dropdown of the Add/Edit Rule modal from `users` — the
server-paginated, keyword-filterable state of the **Users tab** (default 20
rows, max 100). With more than one page of ACL users:
1. A rule whose principal is an admin loses its badge whenever that user's
row is not on the currently loaded users page (or when a user-tab keyword
filter narrows it).
2. The principal `Select` (showSearch over `users`-derived options, no free
input) offers no way to **create or edit a rule for any user outside the loaded
page** — a functional blocker on instances with many users.
Reproduced by two regression tests: the Users tab mocked to a page of 30
users that contains neither the rule's admin principal nor `remote-admin`;
pre-fix the badge was missing and the dropdown could not offer the
directory-only user.
## Root cause / Fix
The rule tab reused the Users tab's paged state as if it were the full user
directory. The page now loads the unbounded directory via the existing
`listAclUsers` service (`GET /acl/users`, already exposed by the backend and
service layer) into a separate `userDirectory` state; `isAdmin` and the
principal dropdown read from it. The Users tab keeps its paginated state, and
the directory load failure degrades to an empty directory without blocking the
page.
## Priority / scoring
PRIORITY 70 = impact 25 (cannot create a rule for a user beyond the loaded
page; wrong admin badges) + blast radius 12 (rule tab of every multi-page ACL
instance) + reproducibility 18 (deterministic with >20 users) + maintenance
value 15. FIX_CONFIDENCE 85.
## Tests
- `npx vitest run src/pages/instance/__tests__/AclPage.test.tsx`
- pre-fix (component fix stashed): new tests fail — admin badge absent,
directory-only principal not offered
- post-fix: `Tests 25 passed (25)`
- `npx tsc --noEmit` clean; `npx eslint src/pages/instance/acl.tsx
src/pages/instance/__tests__/AclPage.test.tsx` clean
## Risk
Low. One extra read-only request per instance switch/refresh (`GET
/acl/users` already exists and is used elsewhere); no API change. The dropdown
list equals the full directory; users on huge directories see the same
showSearch-filtered list as before, now complete.
--
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]