mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-08 15:13:10 -06:00
Adding the current user information in the server information (when
connected).
This commit is contained in:
parent
c90c673900
commit
932ed358e8
@ -80,7 +80,9 @@ class ServerModule(sg.ServerGroupPluginModule):
|
|||||||
self.NODE_TYPE,
|
self.NODE_TYPE,
|
||||||
connected=connected,
|
connected=connected,
|
||||||
server_type=manager.server_type if connected else "pg",
|
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
|
@property
|
||||||
@ -199,7 +201,9 @@ class ServerNode(PGChildNodeView):
|
|||||||
self.node_type,
|
self.node_type,
|
||||||
connected=connected,
|
connected=connected,
|
||||||
server_type=manager.server_type if connected else 'pg',
|
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)
|
return make_json_response(result=res)
|
||||||
@ -237,7 +241,9 @@ class ServerNode(PGChildNodeView):
|
|||||||
self.node_type,
|
self.node_type,
|
||||||
connected=connected,
|
connected=connected,
|
||||||
server_type=manager.server_type if connected else 'pg',
|
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,
|
'connected': True,
|
||||||
'type': manager.server_type,
|
'type': manager.server_type,
|
||||||
'version': manager.version,
|
'version': manager.version,
|
||||||
'db': manager.db
|
'db': manager.db,
|
||||||
|
'user': manager.user_info
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -201,7 +201,21 @@ WHERE db.datname = current_database()""")
|
|||||||
if status:
|
if status:
|
||||||
mgr.db_info = dict()
|
mgr.db_info = dict()
|
||||||
f_row = res['rows'][0]
|
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:
|
if 'password' in kwargs:
|
||||||
mgr.password = kwargs['password']
|
mgr.password = kwargs['password']
|
||||||
|
Loading…
Reference in New Issue
Block a user