From: Greg Price Date: Thu, 29 Oct 2009 05:36:34 +0000 (-0400) Subject: Replace weird username logic with the old logic. X-Git-Tag: 0.1.0^2~35 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/2cf224f4aad01040c97079273b4624acb0bd3874 Replace weird username logic with the old logic. remote_user_login() was just like the old getUser(), but different in puzzling ways. svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2700 --- diff --git a/code/view.py b/code/view.py index 1ecc827..a6fa610 100644 --- a/code/view.py +++ b/code/view.py @@ -102,7 +102,7 @@ cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, def require_login(): """If the user isn't logged in, raise 403 with an error.""" - if cherrypy.request.login is False: + if not cherrypy.request.login: raise cherrypy.HTTPError(403, "You are not authorized to access that resource") @@ -121,14 +121,13 @@ def remote_user_login(): environ = cherrypy.request.wsgi_environ user = environ.get('REMOTE_USER') if user is None: + cherrypy.request.login = None return - else: - cherrypy.request.login = None # clear what cherrypy put there if environ.get('AUTH_TYPE') == 'Negotiate': # Convert the krb5 principal into a krb4 username if not user.endswith('@%s' % config.kerberos.realm): - cherrypy.request.login = False # failed to login + cherrypy.request.login = None else: cherrypy.request.login = user.split('@')[0].replace('/', '.') else: