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
e5c55a89
Commit
e5c55a89
authored
Nov 14, 2017
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENT-729
parent
ded34227
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletions
+47
-1
common/djangoapps/third_party_auth/settings.py
+5
-0
openedx/features/enterprise_support/api.py
+17
-0
openedx/features/enterprise_support/tests/test_api.py
+24
-0
requirements/edx/base.txt
+1
-1
No files found.
common/djangoapps/third_party_auth/settings.py
View file @
e5c55a89
...
...
@@ -10,6 +10,8 @@ If true, it:
b) calls apply_settings(), passing in the Django settings
"""
from
openedx.features.enterprise_support.api
import
insert_enterprise_pipeline_elements
_FIELDS_STORED_IN_SESSION
=
[
'auth_entry'
,
'next'
]
_MIDDLEWARE_CLASSES
=
[
'third_party_auth.middleware.ExceptionMiddleware'
]
_SOCIAL_AUTH_LOGIN_REDIRECT_URL
=
'/dashboard'
...
...
@@ -59,6 +61,9 @@ def apply_settings(django_settings):
'third_party_auth.pipeline.login_analytics'
,
]
# Add enterprise pipeline elements if the enterprise app is installed
insert_enterprise_pipeline_elements
(
django_settings
.
SOCIAL_AUTH_PIPELINE
)
# Required so that we can use unmodified PSA OAuth2 backends:
django_settings
.
SOCIAL_AUTH_STRATEGY
=
'third_party_auth.strategy.ConfigurationModelStrategy'
...
...
openedx/features/enterprise_support/api.py
View file @
e5c55a89
...
...
@@ -547,3 +547,20 @@ def get_dashboard_consent_notification(request, user, course_enrollments):
}
)
return
''
def
insert_enterprise_pipeline_elements
(
pipeline
):
"""
If the enterprise app is enabled, insert additional elements into the
pipeline related to enterprise.
"""
if
not
enterprise_enabled
():
return
additional_elements
=
(
'enterprise.tpa_pipeline.handle_enterprise_logistration'
,
)
insert_point
=
pipeline
.
index
(
'social_core.pipeline.social_auth.load_extra_data'
)
for
index
,
element
in
enumerate
(
additional_elements
):
pipeline
.
insert
(
insert_point
+
index
,
element
)
openedx/features/enterprise_support/tests/test_api.py
View file @
e5c55a89
...
...
@@ -25,6 +25,8 @@ from openedx.features.enterprise_support.api import (
enterprise_customer_for_request
,
get_dashboard_consent_notification
,
get_enterprise_consent_url
,
insert_enterprise_pipeline_elements
,
enterprise_enabled
,
)
from
openedx.features.enterprise_support.tests.mixins.enterprise
import
EnterpriseServiceMockMixin
from
openedx.features.enterprise_support.utils
import
get_cache_key
...
...
@@ -428,3 +430,25 @@ class TestEnterpriseApi(EnterpriseServiceMockMixin, CacheIsolationTestCase):
self
.
assertIn
(
substr
,
notification_string
)
else
:
self
.
assertEqual
(
notification_string
,
''
)
@override_settings
(
FEATURES
=
dict
(
ENABLE_ENTERPRISE_INTEGRATION
=
False
))
def
test_utils_with_enterprise_disabled
(
self
):
"""
Test that disabling the enterprise integration flag causes
the utilities to return the expected default values.
"""
self
.
assertFalse
(
enterprise_enabled
())
self
.
assertEqual
(
insert_enterprise_pipeline_elements
(
None
),
None
)
def
test_utils_with_enterprise_enabled
(
self
):
"""
Test that enabling enterprise integration (which is currently on by default) causes the
the utilities to return the expected values.
"""
self
.
assertTrue
(
enterprise_enabled
())
pipeline
=
[
'abc'
,
'social_core.pipeline.social_auth.load_extra_data'
,
'def'
]
insert_enterprise_pipeline_elements
(
pipeline
)
self
.
assertEqual
(
pipeline
,
[
'abc'
,
'enterprise.tpa_pipeline.handle_enterprise_logistration'
,
'social_core.pipeline.social_auth.load_extra_data'
,
'def'
])
requirements/edx/base.txt
View file @
e5c55a89
...
...
@@ -47,7 +47,7 @@ edx-lint==0.4.3
astroid==1.3.8
edx-django-oauth2-provider==1.2.5
edx-django-sites-extensions==2.3.0
edx-enterprise==0.53.1
3
edx-enterprise==0.53.1
4
edx-oauth2-provider==1.2.2
edx-opaque-keys==0.4.0
edx-organizations==0.4.7
...
...
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