mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-29 01:11:46 -07:00
mysql_user and mysql_role: fix granting privileges when only the GRANT OPTION needs to be added
This commit is contained in:
parent
de70cf775b
commit
29885d1243
1 changed files with 3 additions and 0 deletions
|
@ -331,6 +331,9 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
|
||||||
# and revoke existing privileges that were not requested.
|
# and revoke existing privileges that were not requested.
|
||||||
grant_privs = list(set(new_priv[db_table]) - set(curr_priv[db_table]))
|
grant_privs = list(set(new_priv[db_table]) - set(curr_priv[db_table]))
|
||||||
revoke_privs = list(set(curr_priv[db_table]) - set(new_priv[db_table]))
|
revoke_privs = list(set(curr_priv[db_table]) - set(new_priv[db_table]))
|
||||||
|
if grant_privs == ['GRANT']:
|
||||||
|
# add the existing privileges because 'WITH GRANT OPTION' cannot stand alone
|
||||||
|
grant_privs.extend(curr_priv[db_table])
|
||||||
|
|
||||||
if len(grant_privs) + len(revoke_privs) > 0:
|
if len(grant_privs) + len(revoke_privs) > 0:
|
||||||
msg = "Privileges updated"
|
msg = "Privileges updated"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue