Skip to content

Commit

Permalink
Run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Feb 14, 2025
1 parent 3d4149a commit 1fe1ebf
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions backend/src/xfd_django/xfd_api/helpers/infra_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,32 @@ def create_matomo_scan_user():
cursor.execute(
"CREATE USER %s@'%%' IDENTIFIED BY %s;", [scan_user, scan_password]
)
print("User '{}' created successfully in Matomo database.".format(scan_user))
print(
"User '{}' created successfully in Matomo database.".format(
scan_user
)
)
else:
print("User '{}' already exists in Matomo database. Skipping creation.".format(scan_user))
print(
"User '{}' already exists in Matomo database. Skipping creation.".format(
scan_user
)
)

cursor.execute("GRANT USAGE ON *.* TO %s@'%%';", [scan_user])
cursor.execute("GRANT SELECT ON matomo.* TO %s@'%%';", [scan_user])

# Additional permissions to allow access to system tables
cursor.execute("GRANT SHOW DATABASES ON *.* TO %s@'%%';", [scan_user])
cursor.execute("GRANT PROCESS ON *.* TO %s@'%%';", [scan_user])
cursor.execute("GRANT PROCESS ON *.* TO %s@'%%';", [scan_user])

cursor.execute("FLUSH PRIVILEGES;")

print("User '{}' configured successfully in Matomo database.".format(scan_user))
print(
"User '{}' configured successfully in Matomo database.".format(
scan_user
)
)

conn.commit()
conn.close()
Expand Down

0 comments on commit 1fe1ebf

Please sign in to comment.