Ensure that the correct user should be selected in the new connection dialog. Fixes #7264

This commit is contained in:
Akshay Joshi 2022-03-31 15:51:46 +05:30
parent b2b14051c3
commit 143ae19b8d
2 changed files with 5 additions and 2 deletions

View File

@ -33,6 +33,7 @@ Bug fixes
| `Issue #7239 <https://redmine.postgresql.org/issues/7239>`_ - Fixed an issue where the newly added table is not visible under the Tables node on refresh.
| `Issue #7261 <https://redmine.postgresql.org/issues/7261>`_ - Correct typo in the documentation.
| `Issue #7263 <https://redmine.postgresql.org/issues/7263>`_ - Fixed schema diff issue where function's difference DDL was showing incorrectly when arguments had default values with commas.
| `Issue #7264 <https://redmine.postgresql.org/issues/7264>`_ - Ensure that the correct user should be selected in the new connection dialog.
| `Issue #7265 <https://redmine.postgresql.org/issues/7265>`_ - Fixed schema diff issue in which the option 'null' doesn't appear in the DDL statement for the foreign table.
| `Issue #7267 <https://redmine.postgresql.org/issues/7267>`_ - Fixed an issue where unexpected error messages are displayed when users change the language via preferences.
| `Issue #7269 <https://redmine.postgresql.org/issues/7269>`_ - Ensure that pgAdmin4 should work with latest jinja2 version.

View File

@ -1688,9 +1688,11 @@ def get_new_connection_user(sgid, sid=None):
status, users = conn.execute_2darray(
render_template(sql_path + _NODES_SQL)
)
_user = manager.user
user_list = [
{'value': user['rolname'], 'label': user['rolname']} for
user in users['rows'] if user['rolcanlogin']]
{'value': user['rolname'], 'label': user['rolname'],
'selected': True if user['rolname'] == _user else False}
for user in users['rows'] if user['rolcanlogin']]
else:
status = False