mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-27 08:21:46 -07:00
Only revoke grant option if it exists and absence is requested
This commit is contained in:
parent
9728ad5d26
commit
1321b8c7d4
1 changed files with 3 additions and 4 deletions
|
@ -363,13 +363,12 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
|
||||||
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]))
|
||||||
|
|
||||||
# ... but do not revoke GRANT option when it's already allowed
|
# ... but only revoke grant option if it exists and absence is requested
|
||||||
# and already in privs.
|
|
||||||
#
|
#
|
||||||
# For more details
|
# For more details
|
||||||
# https://github.com/ansible-collections/community.mysql/issues/77#issuecomment-1209693807
|
# https://github.com/ansible-collections/community.mysql/issues/77#issuecomment-1209693807
|
||||||
if 'GRANT' in new_priv[db_table] and 'GRANT' in curr_priv[db_table]:
|
if 'GRANT' in grant_privs:
|
||||||
grant_privs.append('GRANT')
|
grant_option = 'GRANT' in revoke_privs and 'GRANT' not in grant_privs
|
||||||
|
|
||||||
if grant_privs == ['GRANT']:
|
if grant_privs == ['GRANT']:
|
||||||
# USAGE grants no privileges, it is only needed because 'WITH GRANT OPTION' cannot stand alone
|
# USAGE grants no privileges, it is only needed because 'WITH GRANT OPTION' cannot stand alone
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue