MozReview: Migrate rbbz/auth.py to mozreview/bugzilla/auth.py (
Bug 1262548). r?smacleod
MozReview-Commit-ID: 2zh39QQ40Ux
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.