From bd22fb255ea83f9b1998c592f310f762174f2294 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 21 Mar 2017 13:06:55 -0400 Subject: [PATCH] Rename get_federated_user to get_and_link_federated_user_info Better to be explicit wherever possible --- data/users/__init__.py | 4 ++-- data/users/database.py | 2 +- data/users/federated.py | 10 +++++----- data/users/teamsync.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/data/users/__init__.py b/data/users/__init__.py index d53413b74..f8e47ba16 100644 --- a/data/users/__init__.py +++ b/data/users/__init__.py @@ -175,11 +175,11 @@ class UserAuthentication(object): """ return self.state.link_user(username_or_email) - def get_federated_user(self, user_info): + def get_and_link_federated_user_info(self, user_info): """ Returns a tuple containing the database user record linked to the given UserInformation pair and any error that occurred when trying to link the user. """ - return self.state.get_federated_user(user_info) + return self.state.get_and_link_federated_user_info(user_info) def confirm_existing_user(self, username, password): """ Verifies that the given password matches to the given DB username. Unlike diff --git a/data/users/database.py b/data/users/database.py index 07e327688..862065723 100644 --- a/data/users/database.py +++ b/data/users/database.py @@ -24,7 +24,7 @@ class DatabaseUsers(object): """ Never used since all users being added are already, by definition, in the database. """ return (None, 'Unsupported for this authentication system') - def get_federated_user(self, user_info): + def get_and_link_federated_user_info(self, user_info): """ Never used since all users being added are already, by definition, in the database. """ return (None, 'Unsupported for this authentication system') diff --git a/data/users/federated.py b/data/users/federated.py index fbb982367..cdf6a28ce 100644 --- a/data/users/federated.py +++ b/data/users/federated.py @@ -42,10 +42,10 @@ class FederatedUsers(object): if user_info is None: return (None, err_msg) - return self.get_federated_user(user_info) + return self.get_and_link_federated_user_info(user_info) - def get_federated_user(self, user_info): - return self._get_federated_user(user_info.username, user_info.email) + def get_and_link_federated_user_info(self, user_info): + return self._get_and_link_federated_user_info(user_info.username, user_info.email) def verify_and_link_user(self, username_or_email, password): """ Verifies the given credentials and, if valid, creates/links a database user to the @@ -55,7 +55,7 @@ class FederatedUsers(object): if credentials is None: return (None, err_msg) - return self._get_federated_user(credentials.username, credentials.email) + return self._get_and_link_federated_user_info(credentials.username, credentials.email) def confirm_existing_user(self, username, password): """ Confirms that the given *database* username and service password are valid for the linked @@ -93,7 +93,7 @@ class FederatedUsers(object): """ return (None, 'Not supported') - def _get_federated_user(self, username, email): + def _get_and_link_federated_user_info(self, username, email): db_user = model.user.verify_federated_login(self._federated_service, username) if not db_user: # We must create the user in our db diff --git a/data/users/teamsync.py b/data/users/teamsync.py index 65fc31b35..44dc52032 100644 --- a/data/users/teamsync.py +++ b/data/users/teamsync.py @@ -82,7 +82,7 @@ def sync_team(authentication, stale_team_sync): continue # Retrieve the Quay user associated with the member info. - (quay_user, err) = authentication.get_federated_user(member_info) + (quay_user, err) = authentication.get_and_link_federated_user_info(member_info) if err is not None: logger.error('Could not link external user %s to an internal user: %s', member_info.username, err,