Skip to content

feat(admin): manage roles - #624

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

EVWorth merged 1 commit into
mainfrom
feat/admin-roles

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Closes #435.

FR-7.1.6 asked for role management and there was none — no CREATE ROLE, no parsing, no UI. A Roles tab now creates and drops roles, grants and revokes them, and sets or clears a user's default role.

Roles are where the two servers agree least

Every point checked against MySQL 8.0.46 and MariaDB 11, not taken from a manual:

MySQL 8 MariaDB 11
CREATE ROLE / DROP ROLE ok ok
GRANT role TO user / REVOKE ok ok
mysql.user.is_role absent present
mysql.role_edges present absent
mysql.roles_mapping absent present
SET DEFAULT ROLE 'r' TO 'u'@'h' ok ERROR 1064
SET DEFAULT ROLE r FOR u@'h' ERROR 1064 ok

The two default-role spellings are exactly inverted, and each server rejects the other's. That's the sort of thing that ships broken on one server when only the other is to hand — which is what happened with CREATE USER in #561.

Listing roles on MySQL is a heuristic, and the code says so

MariaDB flags them. MySQL doesn't: CREATE ROLE makes an ordinary account that's locked, expired and passwordless, and that combination is the only way to recognise one. A human account left in all three states would be listed as a role. Rare, and better than not listing roles at all, but it's a convention rather than a fact.

One thing worth catching

The grant list excludes roles. They live in mysql.user alongside users, so an unfiltered list would offer granting a role to a role.

Verified, not just unit-tested

Every generated statement was run against both servers before this was called done.

Verification

12 builder tests, 11 tab tests. Unit 2222, browser 297, 0 lint errors.

FR-7.1.6 asked for role management and there was none — no CREATE ROLE, no
parsing, no UI (#435). A Roles tab now creates and drops roles, grants and
revokes them, and sets or clears a user's default role.

Roles are where the two servers agree least, and every point of it was
checked against MySQL 8.0.46 and MariaDB 11 rather than taken from a manual:

                                       MySQL 8      MariaDB 11
  CREATE ROLE / DROP ROLE              ok           ok
  GRANT role TO user / REVOKE          ok           ok
  mysql.user.is_role                   absent       present
  mysql.role_edges                     present      absent
  mysql.roles_mapping                  absent       present
  SET DEFAULT ROLE 'r' TO 'u'@'h'      ok           ERROR 1064
  SET DEFAULT ROLE r FOR u@'h'         ERROR 1064   ok

The two default-role spellings are exactly inverted, and each server rejects
the other's. That is the sort of thing that ships broken on one server when
only the other is to hand, which is what happened with CREATE USER in #561.

Listing roles on MySQL is a heuristic, and the code says so. MariaDB flags
them; MySQL does not, and CREATE ROLE simply makes an account that is locked,
expired and passwordless. A human account left in all three states would be
listed as a role. That is rare, and better than not listing roles at all, but
it is a convention rather than a fact.

The grant list excludes roles. They live in mysql.user alongside users, so an
unfiltered list would offer granting a role to a role.

Every generated statement was run against both servers before this was
called done, not only unit-tested.

Closes #435

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth merged commit dfd4bda into main Sep 10, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/admin-roles branch September 10, 2026 13:16
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] [bug] FR-7.1.6 Role management — no CREATE ROLE, no role parsing, no UI

1 participant