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
29c769bc
Commit
29c769bc
authored
Feb 13, 2015
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6987 from edx/will/country-access-feature-flag-fixup
Skip country access check if feature flag is disabled
parents
2c8698c0
125f6957
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
common/djangoapps/embargo/api.py
+4
-0
common/djangoapps/embargo/tests/test_api.py
+1
-0
No files found.
common/djangoapps/embargo/api.py
View file @
29c769bc
...
@@ -51,6 +51,10 @@ def check_course_access(course_key, user=None, ip_address=None, url=None):
...
@@ -51,6 +51,10 @@ def check_course_access(course_key, user=None, ip_address=None, url=None):
Boolean: True if the user has access to the course; False otherwise
Boolean: True if the user has access to the course; False otherwise
"""
"""
# No-op if the country access feature is not enabled
if
not
settings
.
FEATURES
.
get
(
'ENABLE_COUNTRY_ACCESS'
):
return
True
# First, check whether there are any restrictions on the course.
# First, check whether there are any restrictions on the course.
# If not, then we do not need to do any further checks
# If not, then we do not need to do any further checks
course_is_restricted
=
RestrictedCourse
.
is_restricted_course
(
course_key
)
course_is_restricted
=
RestrictedCourse
.
is_restricted_course
(
course_key
)
...
...
common/djangoapps/embargo/tests/test_api.py
View file @
29c769bc
...
@@ -36,6 +36,7 @@ MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, incl
...
@@ -36,6 +36,7 @@ MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, incl
@ddt.ddt
@ddt.ddt
@override_settings
(
MODULESTORE
=
MODULESTORE_CONFIG
)
@override_settings
(
MODULESTORE
=
MODULESTORE_CONFIG
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@mock.patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_COUNTRY_ACCESS'
:
True
})
class
EmbargoCheckAccessApiTests
(
ModuleStoreTestCase
):
class
EmbargoCheckAccessApiTests
(
ModuleStoreTestCase
):
"""Test the embargo API calls to determine whether a user has access. """
"""Test the embargo API calls to determine whether a user has access. """
...
...
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