Skip to content

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Oct 16, 2025

This is a backport of PR #744 as merged into main (1cb9f36).

SUMMARY

fixes the edge case where we need to change permissions on a user which do not have any permissions on the database but have the grant option
Fixes #664

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

community.mysql_user

ADDITIONAL INFORMATION

the issue comes from the fact that when parsing the current permissions the USAGE (i.e. no permissions) is added to the privileges array then when we try to edit and the database the user has only USAGE and PRIVILEGES OPTION
like:

GRANT USAGE ON `database`.* TO `user`@`localhost` WITH GRANT OPTION;

the revoke function first remove the PRIVILEGES OPTION with:

REVOKE GRANT OPTION ON `database`.* FROM 'user'@'localhost';

which remove the USAGE GRANT as well because it does not have any other purpose than holding the grant option
but then we try to remove also the USAGE GRANT with:

REVOKE USAGE ON `database`.* FROM 'user'@'localhost' 

which is already removed and mariadb throws an error:

There is no such grant defined for user 'user' on host 'localhost'

#744)

* fix: case when grant options is set with no other user permissions in mariadb

* Create changelog fragment

* fix: wrong file name ext

* Update changelogs/fragments/fix_user_perms_revoke_grant_option.yml

Co-authored-by: Andrew Klychkov <[email protected]>

---------

Co-authored-by: Andrew Klychkov <[email protected]>
(cherry picked from commit 1cb9f36)
@Andersson007
Copy link
Collaborator

@laurent-indermuehle as this was backported by the bot, let's merge such PRs w/o approving by another person

@Andersson007 Andersson007 merged commit 4942fd5 into stable-3 Oct 16, 2025
99 checks passed
@Andersson007 Andersson007 deleted the patchback/backports/stable-3/1cb9f369d0f8a89bd81b6b99ce07e95beeb7459c/pr-744 branch October 16, 2025 08:01
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.

2 participants