Repository navigation
feat(admin): manage roles - #624
Merged
Merged
Conversation
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]>
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 #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:
CREATE ROLE/DROP ROLEGRANT role TO user/REVOKEmysql.user.is_rolemysql.role_edgesmysql.roles_mappingSET DEFAULT ROLE 'r' TO 'u'@'h'SET DEFAULT ROLE r FOR u@'h'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 USERin #561.Listing roles on MySQL is a heuristic, and the code says so
MariaDB flags them. MySQL doesn't:
CREATE ROLEmakes 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.useralongside 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.