# HG changeset patch # User Søren Løvborg # Date 1437911930 -7200 # Node ID b92c2e4324b0eeeb1c98e5064abb06e214140714 # Parent 837fc99ca1408a31159cd9c07667910c6f79866f auth: remove redundant AuthUser constructor arguments AuthUser looks up the user based on the first of `user_id`, `api_key` and `username` that is not None *and* does not refer to the default (anonymous) user. In practice, the arguments always refer to the same user, so there's no point in specifying more than one of them. diff -r 837fc99ca140 -r b92c2e4324b0 kallithea/controllers/api/__init__.py --- a/kallithea/controllers/api/__init__.py Sun Jul 26 13:58:50 2015 +0200 +++ b/kallithea/controllers/api/__init__.py Sun Jul 26 13:58:50 2015 +0200 @@ -158,7 +158,7 @@ return jsonrpc_error(retid=self._req_id, message='Invalid API key') - auth_u = AuthUser(u.user_id, self._req_api_key) + auth_u = AuthUser(u.user_id) if not AuthUser.check_ip_allowed(auth_u, ip_addr): return jsonrpc_error(retid=self._req_id, message='request from IP:%s not allowed' % (ip_addr,)) diff -r 837fc99ca140 -r b92c2e4324b0 kallithea/lib/auth.py --- a/kallithea/lib/auth.py Sun Jul 26 13:58:50 2015 +0200 +++ b/kallithea/lib/auth.py Sun Jul 26 13:58:50 2015 +0200 @@ -643,7 +643,6 @@ au = AuthUser( user_id=cookie.get('user_id'), - username=cookie.get('username'), is_external_auth=cookie.get('is_external_auth', False), ) if not au.is_authenticated and au.user_id is not None: diff -r 837fc99ca140 -r b92c2e4324b0 kallithea/model/db.py --- a/kallithea/model/db.py Sun Jul 26 13:58:50 2015 +0200 +++ b/kallithea/model/db.py Sun Jul 26 13:58:50 2015 +0200 @@ -511,8 +511,7 @@ Returns instance of AuthUser for this user """ from kallithea.lib.auth import AuthUser - return AuthUser(user_id=self.user_id, api_key=self.api_key, - username=self.username) + return AuthUser(user_id=self.user_id) @hybrid_property def user_data(self):