Skip to content

feat(admin): edit a user, not only its password - #621

Merged
EVWorth merged 1 commit into
mainfrom
feat/admin-edit-user
Sep 10, 2026
Merged

EVWorth merged 1 commit into
mainfrom
feat/admin-edit-user

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 10, 2026

Copy link
Copy Markdown
Owner

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 USER by 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_locked or password_expired at 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:

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. ALTER USER commits 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.

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]>
@EVWorth
EVWorth merged commit cdf4a52 into main Sep 10, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/admin-edit-user branch September 10, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] [doc-drift] FR-7.1.3 Edit user — only password; host/lock/expiration/limits not editable

1 participant