diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py index 979fbcb39..c38265dce 100644 --- a/web/pgadmin/browser/server_groups/servers/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/__init__.py @@ -80,7 +80,9 @@ class ServerModule(sg.ServerGroupPluginModule): self.NODE_TYPE, connected=connected, server_type=manager.server_type if connected else "pg", - version=manager.version + version=manager.version, + db=manager.db, + user=manager.user_info if connected else None ) @property @@ -199,7 +201,9 @@ class ServerNode(PGChildNodeView): self.node_type, connected=connected, server_type=manager.server_type if connected else 'pg', - version=manager.version + version=manager.version, + db=manager.db, + user=manager.user_info if connected else None ) ) return make_json_response(result=res) @@ -237,7 +241,9 @@ class ServerNode(PGChildNodeView): self.node_type, connected=connected, server_type=manager.server_type if connected else 'pg', - version=manager.version + version=manager.version, + db=manager.db, + user=manager.user_info if connected else None ) ) @@ -663,7 +669,8 @@ class ServerNode(PGChildNodeView): 'connected': True, 'type': manager.server_type, 'version': manager.version, - 'db': manager.db + 'db': manager.db, + 'user': manager.user_info } ) diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py index fb33969e8..5f5d3f73e 100644 --- a/web/pgadmin/utils/driver/psycopg2/__init__.py +++ b/web/pgadmin/utils/driver/psycopg2/__init__.py @@ -201,7 +201,21 @@ WHERE db.datname = current_database()""") if status: mgr.db_info = dict() f_row = res['rows'][0] - mgr.db_info[f_row['did']] = f_row + mgr.db_info[f_row['did']] = f_row.copy() + + status, res = self.execute_dict(""" +SELECT + oid as id, rolname as name, rolsuper as is_superuser, + rolcreaterole as can_create_role, rolcreatedb as can_create_db +FROM + pg_catalog.pg_roles +WHERE + rolname = current_user""") + + if status: + mgr.user_info = dict() + f_row = res['rows'][0] + mgr.user_info = f_row.copy() if 'password' in kwargs: mgr.password = kwargs['password']