fix users with multiple schemas with ALL PRIVILEGES only showing first

This commit is contained in:
Laurent Indermuehle 2023-09-21 22:24:55 +02:00
parent 40f47f6828
commit 0bcfdb72ab
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09
2 changed files with 18 additions and 12 deletions

View file

@ -552,17 +552,15 @@ def privileges_get(module, cursor, user, host, maria_role=False):
if "WITH GRANT OPTION" in res.group(7):
privileges.append('GRANT')
# Prevent to output 'ALL', 'ALL' because mysql 8 display all privileges
# with two lines as you can see in variable mysql8_all_privileges.
if (
'ALL' in privileges
and (['ALL'] in output.values() or ['ALL', 'GRANT'] in output.values())
):
continue
output.setdefault(db, []).extend(privileges)
return output
# Prevent to output 'ALL', 'ALL' because mysql 8 display all privileges
# with two lines as you can see in variable mysql8_all_privileges.
output_deduplicates = {}
for k, v in output.items():
output_deduplicates[k] = list(set(v))
return output_deduplicates
def normalize_col_grants(privileges):