btlqql opened a new pull request, #7139:
URL: https://github.com/apache/rocketmq-dashboard/pull/7139

   ## What is the purpose of the change
   
   `admin` is optional in the documented plain-access write contract, but the 
write path could not tell
   "not provided" from "explicitly false": `UpsertPlainAccessConfigDTO` and 
`PlainAccessConfigVO` both
   carried a primitive `boolean admin`, and 
`MybatisPlusAclRepository.createAndUpdatePlainAccessConfig`
   always wrote it. Saving an existing admin account without naming the flag — 
rotating its secret,
   editing its whitelist or its permission entries — silently demoted it, 
answered `admin: false`, and
   dropped it out of the ACL risk view's admin count. This follows the sibling 
user update: the flag is
   nullable on the write model, an omitted flag keeps the stored value for an 
existing account, a new
   account defaults to false, an explicit value always wins, and the write 
response carries the effective
   value.
   
   ## Brief changelog
   
   - 
`server/src/main/java/org/apache/rocketmq/studio/instance/acl/UpsertPlainAccessConfigDTO.java`:
 `admin` is a `Boolean` — null means "not part of this write".
   - 
`server/src/main/java/org/apache/rocketmq/studio/instance/acl/PlainAccessConfigVO.java`:
 `admin` is a `Boolean` so the tri-state reaches the write path; read-back 
views and the write response still carry the effective value.
   - 
`server/src/main/java/org/apache/rocketmq/studio/instance/acl/MybatisPlusAclRepository.java`:
 `createAndUpdatePlainAccessConfig` resolves the effective flag from the row it 
already loads (request value when supplied, otherwise the stored flag for an 
existing account, otherwise false) and echoes that value in the response.
   - 
`server/src/main/java/org/apache/rocketmq/studio/instance/acl/AclService.java`: 
the audit detail keeps its exact wording with the nullable field 
(`Boolean.TRUE.equals(saved.getAdmin())`).
   - 
`server/src/test/java/org/apache/rocketmq/studio/instance/acl/MybatisPlusAclRepositoryTest.java`:
 three regressions — an omitted flag keeps the stored `true`, an explicit 
`false` still clears it, a new account without the flag stores `false` — plus 
the existing assertion adapted to the nullable field.
   
   ## Verifying this change
   
   - red: `cd server; mvn -o -B -ntp test 
-Dtest='MybatisPlusAclRepositoryTest'` → 
`MybatisPlusAclRepositoryTest.updateWithoutTheAdminFlagShouldKeepTheStoredAdminFlag:480
 Expecting value to be true but was false` (`Tests run: 29, Failures: 1, 
Errors: 0`) — log `plain-acl-admin-red.log`
   - green: `cd server; mvn -o -B -ntp test 
-Dtest='MybatisPlusAclRepositoryTest,AclServiceTest,AclControllerTest'` → 
`Tests run: 147, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS` — log 
`plain-acl-admin-green.log`
   - regressions run: `AclServiceTest` (91 tests) and `AclControllerTest` (27 
tests) in full alongside the repository suite (29 tests).
   
   Not verified: the full `mvn test` suite, CI, the web test suite, and a live 
broker (no cluster participates).
   
   ## Checklist
   
   - [x] one issue, one PR: Fixes #5980
   - [x] regression test added
   - [x] targeted suites re-run


-- 
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]

Reply via email to