mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-18 03:51:46 -07:00
Fix revoke only grant (#503)
* fix
* test
* changelog
(cherry picked from commit b34c23d07d
)
This commit is contained in:
parent
ff94dcdf0f
commit
f2efed4b84
4 changed files with 73 additions and 9 deletions
|
@ -680,17 +680,19 @@ def privileges_revoke(cursor, user, host, db_table, priv, grant_option, maria_ro
|
|||
query = ' '.join(query)
|
||||
cursor.execute(query, (user, host))
|
||||
priv_string = ",".join([p for p in priv if p not in ('GRANT', )])
|
||||
query = ["REVOKE %s ON %s" % (priv_string, db_table)]
|
||||
|
||||
if not maria_role:
|
||||
query.append("FROM %s@%s")
|
||||
params = (user, host)
|
||||
else:
|
||||
query.append("FROM %s")
|
||||
params = (user,)
|
||||
if priv_string != "":
|
||||
query = ["REVOKE %s ON %s" % (priv_string, db_table)]
|
||||
|
||||
query = ' '.join(query)
|
||||
cursor.execute(query, params)
|
||||
if not maria_role:
|
||||
query.append("FROM %s@%s")
|
||||
params = (user, host)
|
||||
else:
|
||||
query.append("FROM %s")
|
||||
params = (user,)
|
||||
|
||||
query = ' '.join(query)
|
||||
cursor.execute(query, params)
|
||||
cursor.execute("FLUSH PRIVILEGES")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue