From f22134dabd6332f3faf851f2ddd96159c5bd7a85 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Thu, 14 Nov 2019 18:14:53 +0530 Subject: [PATCH] Ensure that the superuser should be able to create database and role, as the superuser overrides all the access restrictions. Fixes #4792 Fixes #4878 --- docs/en_US/release_notes_4_16.rst | 2 ++ web/pgadmin/utils/driver/psycopg2/connection.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/en_US/release_notes_4_16.rst b/docs/en_US/release_notes_4_16.rst index 8458b2d01..9277b4082 100644 --- a/docs/en_US/release_notes_4_16.rst +++ b/docs/en_US/release_notes_4_16.rst @@ -17,4 +17,6 @@ Housekeeping Bug fixes ********* +| `Issue #4792 `_ - Ensure that the superuser should be able to create database, as the superuserĀ overrides all the access restrictions. +| `Issue #4878 `_ - Ensure that the superuser should be able to create role, as the superuserĀ overrides all the access restrictions. | `Issue #4934 `_ - Fix the help button link on the User Management dialog. diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py index 9e6aaa5d6..2a0ca821e 100644 --- a/web/pgadmin/utils/driver/psycopg2/connection.py +++ b/web/pgadmin/utils/driver/psycopg2/connection.py @@ -492,7 +492,8 @@ WHERE db.datname = current_database()""") status = _execute(cur, """ SELECT oid as id, rolname as name, rolsuper as is_superuser, - rolcreaterole as can_create_role, rolcreatedb as can_create_db + CASE WHEN rolsuper THEN true ELSE rolcreaterole END as can_create_role, + CASE WHEN rolsuper THEN true ELSE rolcreatedb END as can_create_db FROM pg_catalog.pg_roles WHERE