1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 16:44:17 +02:00

Hide databases the user can't connect to

pg_database lists all databases including the ones the user can't connect to.
There is little point in showing them when we know connecting will fail.
This commit is contained in:
Felix Geyer
2015-06-07 21:52:43 +02:00
committed by Jakub Vrána
parent cd8ff96a09
commit b8bea7fc56

View File

@@ -199,7 +199,7 @@ if (isset($_GET["pgsql"])) {
} }
function get_databases() { function get_databases() {
return get_vals("SELECT datname FROM pg_database ORDER BY datname"); return get_vals("SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname");
} }
function limit($query, $where, $limit, $offset = 0, $separator = " ") { function limit($query, $where, $limit, $offset = 0, $separator = " ") {