Add database and database users sync (#537)

* Add database and database users sync

* get mysl users

* add mariadb and postgres

* fix phpstan
This commit is contained in:
Saeed Vaziry
2025-03-12 22:59:25 +01:00
committed by GitHub
parent 493cbb0849
commit 0f06d81aac
17 changed files with 383 additions and 65 deletions

View File

@ -0,0 +1,12 @@
if ! sudo -u postgres psql -c "SELECT r.rolname AS username,
'' as host,
STRING_AGG(d.datname, ',') AS databases
FROM pg_roles r
JOIN
pg_database d ON has_database_privilege(r.rolname, d.datname, 'CONNECT')
WHERE r.rolcanlogin
GROUP BY r.rolname
ORDER BY r.rolname;";
then
echo 'VITO_SSH_ERROR' && exit 1
fi