Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: pgAdmin imports servers to the wrong accounts in the server version with webserver auth enabled #6818

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions web/pgadmin/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,19 +801,25 @@ def clear_database_servers(load_user=current_user, from_setup=False):


def _does_user_exist(user, from_setup):
"""
This function will check user is exist or not. If exist then return
"""
if isinstance(user, User):
user = user.email

new_user = User.query.filter_by(email=user).first()

if new_user is None:
print(USER_NOT_FOUND % user)
if from_setup:
sys.exit(1)

"""
This function will check user is exist or not. If exist then return
"""
if isinstance(user, User):
if user.username:
auth_source = user.auth_source
user = user.username
new_user = User.query.filter_by(username=user, auth_source=auth_source).first()
else:
user = ""
new_user = None
else:
new_user = User.query.filter_by(email=user).first()

if new_user is None:
print(USER_NOT_FOUND % user)
if from_setup:
sys.exit(1)

return new_user


Expand Down
Loading