Repository navigation
feat(admin): edit a user, not only its password - #621
Merged
Merged
Conversation
FR-7.1.3 promised password, host, lock and expiry were all editable. Only the password ever was, so an account that had locked itself needed an admin to leave the app and write ALTER USER by hand (#436). Lock and unlock, password expiry — now, every n days, never, or back to the server default — connection limit, and host, which renames the user. Every control defaults to "leave unchanged", and nothing is emitted for a control nobody touched. That is not tidiness. MariaDB does not expose account_locked or password_expired at all, which is why the panel already shows lock state as "unknown" there (#440), so a form pre-filled with the current values would be pre-filled with guesses — and a wrong guess here unlocks an account somebody locked on purpose. Lock is two explicit choices rather than a checkbox for the same reason: a checkbox has to start somewhere, and there is no honest place to start it. A blank connection limit means unchanged rather than zero, because zero means unlimited to MySQL and reading blank as zero would silently remove a limit someone set. Verified against MySQL 8.0.46 and MariaDB 11 rather than assumed, since the last admin feature shipped broken on MariaDB by assuming (#561). All four forms work identically on both — and both reject the combined statement identically: ALTER USER u ACCOUNT LOCK WITH MAX_USER_CONNECTIONS 5 ERROR 1064 ALTER USER u WITH MAX_USER_CONNECTIONS 5 ACCOUNT LOCK ok The resource clause has to come first. Rather than depend on getting that order right, each change is its own statement — which also lets a failure name the change that failed, and ALTER USER commits as it runs, so "Applied 1 of 2" is a state that has to be reportable. Closes #436 Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #436.
FR-7.1.3 promised password, host, lock and expiry were all editable. Only the password ever was, so an account that had locked itself needed an admin to leave the app and write
ALTER USERby hand.Now: lock/unlock, password expiry (now, every n days, never, server default), connection limit, and host — which renames the user.
Every control defaults to "leave unchanged", and that's load-bearing
MariaDB doesn't expose
account_lockedorpassword_expiredat all — which is why the panel already shows lock state as "unknown" there (#440). A form pre-filled with current values would be pre-filled with guesses, and a wrong guess here unlocks an account somebody locked on purpose.Lock is two explicit choices rather than a checkbox for the same reason: a checkbox has to start somewhere, and there's no honest place to start it.
A blank connection limit means unchanged, not zero — zero means unlimited to MySQL, so reading blank as zero would silently remove a limit someone set.
Verified, not assumed
The last admin feature shipped broken on MariaDB by assuming (#561), so I checked all four forms against MySQL 8.0.46 and MariaDB 11. All work identically on both — and both reject the combined statement identically:
The resource clause has to come first. Rather than depend on getting that order right, each change is its own statement — which also lets a failure name the change that failed.
ALTER USERcommits as it runs, so "Applied 1 of 2" is a real state that has to be reportable, and it is.I ran the builder's actual output against both servers, not just the unit tests.
Verification
14 builder tests, 12 dialog tests. Unit 2153, browser 297, 0 lint errors.