From 73f4d3219de3cd93a3864a8b75e1886e7fd80b4e Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Tue, 25 Oct 2022 11:23:10 -0300 Subject: [PATCH] Filtering databases that the user has privilege --- bin/autoupdate | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/autoupdate b/bin/autoupdate index a311194..9f22dce 100755 --- a/bin/autoupdate +++ b/bin/autoupdate @@ -1,7 +1,7 @@ #!/usr/bin/env bash export PGPASSWORD=$PG_PASSWORD -DATABASES=(`psql -h $PG_HOST -U $PG_USER -d postgres -c "SELECT datname FROM pg_database WHERE datistemplate = false and datname <> 'postgres';" -t -w`) +DATABASES=(`psql -h $PG_HOST -U $PG_USER -d postgres -c "SELECT datname FROM pg_database WHERE has_database_privilege('$PG_USER', datname, 'CREATE') and datistemplate = false and datname <> 'postgres';" -t -w`) echo "Inicializando atualizacao de bases" @@ -11,4 +11,4 @@ do click-odoo-update -c odoo.conf -d $base --watcher-max-seconds 60 done -echo "Finalizado" \ No newline at end of file +echo "Finalizado"