fix: case when grant options is set with no other user permissions in… (#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 <aaklychkov@mail.ru>

---------

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
george2asenov 2025-10-16 10:26:35 +03:00 committed by GitHub
commit 1cb9f369d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- mysql_user, mysql_role - fix not existent grant when revoking perms on user/role which do not have any other perms than grant option (https://github.com/ansible-collections/community.mysql/issues/664).

View file

@ -885,7 +885,7 @@ def privileges_revoke(cursor, user, host, db_table, priv, grant_option, maria_ro
cursor.execute(query, (user, host))
priv_string = ",".join([p for p in priv if p not in ('GRANT', )])
if priv_string != "":
if priv_string != "" and not (grant_option and priv_string == "USAGE"):
query = ["REVOKE %s ON %s" % (priv_string, db_table)]
if not maria_role: