Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4cc76286
Commit
4cc76286
authored
Feb 06, 2017
by
Clinton Blackburn
Committed by
Clinton Blackburn
Mar 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgraded to Python Social Auth 0.2.21 to resolve migration issue
parent
5cd3a863
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
8 additions
and
68 deletions
+8
-68
cms/startup.py
+1
-5
common/djangoapps/third_party_auth/saml.py
+0
-5
common/djangoapps/third_party_auth/tests/specs/base.py
+3
-1
common/djangoapps/third_party_auth/tests/utils.py
+2
-3
lms/envs/common.py
+0
-5
lms/startup.py
+1
-5
openedx/core/djangoapps/monkey_patch/third_party_auth.py
+0
-38
requirements/edx/base.txt
+1
-6
No files found.
cms/startup.py
View file @
4cc76286
...
...
@@ -10,10 +10,7 @@ settings.INSTALLED_APPS # pylint: disable=pointless-statement
from
openedx.core.lib.django_startup
import
autostartup
import
django
from
openedx.core.djangoapps.monkey_patch
import
(
third_party_auth
,
django_db_models_options
)
from
openedx.core.djangoapps.monkey_patch
import
django_db_models_options
from
openedx.core.lib.xblock_utils
import
xblock_local_resource_url
import
xmodule.x_module
...
...
@@ -28,7 +25,6 @@ def run():
"""
Executed during django startup
"""
third_party_auth
.
patch
()
django_db_models_options
.
patch
()
# Comprehensive theming needs to be set up before django startup,
...
...
common/djangoapps/third_party_auth/saml.py
View file @
4cc76286
...
...
@@ -44,11 +44,6 @@ class SAMLAuthBackend(SAMLAuth): # pylint: disable=abstract-method
log
.
error
(
'SAML authentication is not enabled'
)
raise
Http404
# TODO: remove this check once the fix is merged upstream:
# https://github.com/omab/python-social-auth/pull/821
if
'idp'
not
in
self
.
strategy
.
request_data
():
raise
AuthMissingParameter
(
self
,
'idp'
)
return
super
(
SAMLAuthBackend
,
self
)
.
auth_url
()
def
_check_entitlements
(
self
,
idp
,
attributes
):
...
...
common/djangoapps/third_party_auth/tests/specs/base.py
View file @
4cc76286
...
...
@@ -413,8 +413,10 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
def
assert_redirect_to_dashboard_looks_correct
(
self
,
response
):
"""Asserts a response would redirect to /dashboard."""
self
.
assertEqual
(
302
,
response
.
status_code
)
# NOTE: Ideally we should use assertRedirects(), however it errors out due to the hostname, testserver,
# not being properly set. This may be an issue with the call made by PSA, but we are not certain.
# pylint: disable=protected-access
self
.
assert
Equal
(
auth_settings
.
_SOCIAL_AUTH_LOGIN_REDIRECT_URL
,
response
.
get
(
'Location'
))
self
.
assert
True
(
response
.
get
(
'Location'
)
.
endswith
(
django_settings
.
SOCIAL_AUTH_LOGIN_REDIRECT_URL
))
def
assert_redirect_to_login_looks_correct
(
self
,
response
):
"""Asserts a response would redirect to /login."""
...
...
common/djangoapps/third_party_auth/tests/utils.py
View file @
4cc76286
...
...
@@ -2,11 +2,10 @@
import
json
import
httpretty
from
provider.constants
import
PUBLIC
from
provider.oauth2.models
import
Client
from
social.apps.django_app.default.models
import
UserSocialAuth
from
social.backends.facebook
import
FacebookOAuth2
from
student.tests.factories
import
UserFactory
from
.testutil
import
ThirdPartyAuthTestMixin
...
...
@@ -81,7 +80,7 @@ class ThirdPartyOAuthTestMixin(ThirdPartyAuthTestMixin):
class
ThirdPartyOAuthTestMixinFacebook
(
object
):
"""Tests oauth with the Facebook backend"""
BACKEND
=
"facebook"
USER_URL
=
"https://graph.facebook.com/v2.3/me"
USER_URL
=
FacebookOAuth2
.
USER_DATA_URL
# In facebook responses, the "id" field is used as the user's identifier
UID_FIELD
=
"id"
...
...
lms/envs/common.py
View file @
4cc76286
...
...
@@ -2175,11 +2175,6 @@ INSTALLED_APPS = (
'database_fixups'
,
)
# Migrations which are not in the standard module "migrations"
MIGRATION_MODULES
=
{
'social.apps.django_app.default'
:
'social.apps.django_app.default.south_migrations'
}
######################### CSRF #########################################
# Forwards-compatibility with Django 1.7
...
...
lms/startup.py
View file @
4cc76286
...
...
@@ -12,10 +12,7 @@ settings.INSTALLED_APPS # pylint: disable=pointless-statement
from
openedx.core.lib.django_startup
import
autostartup
import
logging
import
analytics
from
openedx.core.djangoapps.monkey_patch
import
(
third_party_auth
,
django_db_models_options
)
from
openedx.core.djangoapps.monkey_patch
import
django_db_models_options
import
xmodule.x_module
import
lms_xblock.runtime
...
...
@@ -33,7 +30,6 @@ def run():
"""
Executed during django startup
"""
third_party_auth
.
patch
()
django_db_models_options
.
patch
()
# To override the settings before executing the autostartup() for python-social-auth
...
...
openedx/core/djangoapps/monkey_patch/third_party_auth.py
deleted
100644 → 0
View file @
5cd3a863
"""
Monkey patch implementation for a python_social_auth Django ORM method that is not Django 1.8-compatible.
Remove once the module fully supports Django 1.8!
"""
from
django.db
import
transaction
from
social.storage.django_orm
import
DjangoUserMixin
from
social.apps.django_app.default.models
import
(
UserSocialAuth
,
Nonce
,
Association
,
Code
)
def
patch
():
"""
Monkey-patch the DjangoUserMixin class.
"""
def
create_social_auth_wrapper
(
wrapped_func
):
# pylint: disable=missing-docstring
wrapped_func
=
wrapped_func
.
__func__
def
_create_social_auth
(
*
args
,
**
kwargs
):
# The entire reason for this monkey-patch is to wrap the create_social_auth call
# in an atomic transaction. The call can sometime raise an IntegrityError, which is
# caught and dealt with by python_social_auth - but not inside of an atomic transaction.
# In Django 1.8, unless the exception is raised in an atomic transaction, the transaction
# becomes unusable after the IntegrityError exception is raised.
with
transaction
.
atomic
():
return
wrapped_func
(
*
args
,
**
kwargs
)
return
classmethod
(
_create_social_auth
)
DjangoUserMixin
.
create_social_auth
=
create_social_auth_wrapper
(
DjangoUserMixin
.
create_social_auth
)
# Monkey-patch some social auth models' Meta class to squelch Django19 warnings.
# pylint: disable=protected-access
UserSocialAuth
.
_meta
.
app_label
=
"default"
Nonce
.
_meta
.
app_label
=
"default"
Association
.
_meta
.
app_label
=
"default"
Code
.
_meta
.
app_label
=
"default"
requirements/edx/base.txt
View file @
4cc76286
...
...
@@ -90,12 +90,7 @@ python-memcached==1.48
django-memcached-hashring==0.1.2
python-openid==2.2.5
python-dateutil==2.1
# This module gets monkey-patched in third_party_auth.py to fix a Django 1.8 incompatibility.
# When this dependency gets upgraded, the monkey patch should be removed, if possible.
# We can also remove the fix to auth_url in third_party_auth/saml.py when that fix is included upstream.
python-social-auth==0.2.12
python-social-auth==0.2.21
pytz==2016.7
pysrt==0.4.7
PyYAML==3.10
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment