MozReview: Migrate rbbz/auth.py to mozreview/bugzilla/auth.py (Bug 1262548). r?smacleod draft
authorDavid Walsh <dwalsh@mozilla.com>
Wed, 13 Apr 2016 15:07:27 -0500
changeset 7831 97529592e09c756504b5b61500fd07a480103fb8
parent 7830 e0226d3df15b68e4881e467563a5e0e3f6ab16aa
child 7832 9e9e41ca65c3cc3cf5537d5ef81ecf9e355d9d81
push id764
push userbmo:dwalsh@mozilla.com
push dateThu, 21 Apr 2016 15:40:42 +0000
reviewerssmacleod
bugs1262548
MozReview: Migrate rbbz/auth.py to mozreview/bugzilla/auth.py (Bug 1262548). r?smacleod MozReview-Commit-ID: 2zh39QQ40Ux
pylib/mozreview/mozreview/bugzilla/auth.py
pylib/mozreview/mozreview/resources/bugzilla_login.py
pylib/mozreview/mozreview/views.py
pylib/rbbz/rbbz/auth.py
pylib/rbbz/rbbz/extension.py
pylib/rbbz/rbbz/resources.py
rename from pylib/rbbz/rbbz/auth.py
rename to pylib/mozreview/mozreview/bugzilla/auth.py
--- a/pylib/mozreview/mozreview/resources/bugzilla_login.py
+++ b/pylib/mozreview/mozreview/resources/bugzilla_login.py
@@ -73,17 +73,17 @@ def auth_api_key(request, username, api_
         extra = {
             'web_login_needed': True,
             'login_url': login_url,
         }
         return WebAPIResponseError(request, LOGIN_FAILED,
                                    extra_params=extra)
 
     # Django housekeeping.
-    user.backend = 'rbbz.auth.BugzillaBackend'
+    user.backend = 'mozreview.bugzilla.auth.BugzillaBackend'
     return user
 
 
 class BugzillaAPIKeyLoginResource(WebAPIResource):
     """Resource for authenticating web API requests from Bugzilla API keys.
 
     Takes a Bugzilla username and API key and attempts to authenticate.
     """
--- a/pylib/mozreview/mozreview/views.py
+++ b/pylib/mozreview/mozreview/views.py
@@ -161,12 +161,12 @@ def get_bmo_auth_callback(request):
     assert user.email == bmo_username
 
     if not user.is_active:
         logger.warning('Validated API key but user %s is inactive.' %
                        bmo_username)
         return show_error_page(request)
 
     set_bugzilla_api_key(user, bmo_api_key)
-    user.backend = 'rbbz.auth.BugzillaBackend'
+    user.backend = 'mozreview.bugzilla.auth.BugzillaBackend'
     logger.info('BMO Auth callback succeeded for user: %s' % bmo_username)
     login(request, user)
     return HttpResponseRedirect(redirect)
--- a/pylib/rbbz/rbbz/extension.py
+++ b/pylib/rbbz/rbbz/extension.py
@@ -29,17 +29,17 @@ from mozreview.extra_data import (
 )
 from mozreview.middleware import CorsHeaderMiddleware
 from mozreview.models import (
     get_bugzilla_api_key,
 )
 from mozreview.rb_utils import (
     get_obj_url,
 )
-from rbbz.auth import BugzillaBackend
+from mozreview.bugzilla.auth import BugzillaBackend
 from rbbz.resources import bugzilla_cookie_login_resource
 
 
 logger = logging.getLogger(__name__)
 
 
 class BugzillaExtension(Extension):
     middleware = [CorsHeaderMiddleware]
--- a/pylib/rbbz/rbbz/resources.py
+++ b/pylib/rbbz/rbbz/resources.py
@@ -49,17 +49,17 @@ class BugzillaCookieLoginResource(WebAPI
 
         bugzilla_backend = auth_backend_cls()
         user = bugzilla_backend.authenticate(login_id, login_cookie,
                                              cookie=True)
 
         if user is None:
             return LOGIN_FAILED
 
-        user.backend = 'rbbz.auth.BugzillaBackend'
+        user.backend = 'mozreview.bugzilla.auth.BugzillaBackend'
 
         # Authentication succeeded, persist the returned user for
         # the session.
         login(request, user)
 
         # It might make sense to return more data about the result of a
         # successful login but for now we'll just return the email address
         # of the user.