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
877ec3f9
Commit
877ec3f9
authored
May 20, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some minor improvements to embargo
parent
db161543
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
13 deletions
+19
-13
cms/envs/common.py
+5
-2
common/djangoapps/embargo/middleware.py
+3
-3
common/djangoapps/embargo/models.py
+1
-1
common/djangoapps/embargo/tests/test_forms.py
+4
-4
common/djangoapps/embargo/tests/test_models.py
+1
-1
lms/envs/common.py
+5
-2
No files found.
cms/envs/common.py
View file @
877ec3f9
...
...
@@ -85,10 +85,10 @@ FEATURES = {
# Hide any Personally Identifiable Information from application logs
'SQUELCH_PII_IN_LOGS'
:
False
,
# Toggles
embargo functionality
# Toggles
the embargo functionality, which enable embargoing for particular courses
'EMBARGO'
:
False
,
# Toggle
embargo site functionality
# Toggle
s the embargo site functionality, which enable embargoing for the whole site
'SITE_EMBARGOED'
:
False
,
# Turn on/off Microsites feature
...
...
@@ -305,6 +305,9 @@ LOCALE_PATHS = (REPO_ROOT + '/conf/locale',) # edx-platform/conf/locale/
# Messages
MESSAGE_STORAGE
=
'django.contrib.messages.storage.session.SessionStorage'
##### EMBARGO #####
EMBARGO_SITE_REDIRECT_URL
=
None
############################### Pipeline #######################################
STATICFILES_STORAGE
=
'pipeline.storage.PipelineCachedStorage'
...
...
common/djangoapps/embargo/middleware.py
View file @
877ec3f9
...
...
@@ -18,13 +18,13 @@ Usage:
# Enable the middleware in your settings
# To enable Embargo
ing by courses, add
:
# To enable Embargo
for particular courses, set
:
FEATURES['EMBARGO'] = True # blocked ip will be redirected to /embargo
# To enable
Embargoing site
:
# To enable
the Embargo feature for the whole site, set
:
FEATURES['SITE_EMBARGOED'] = True
# With SITE_EMBARGOED, you can define an external to redirect with:
# With SITE_EMBARGOED, you can define an external
url
to redirect with:
EMBARGO_SITE_REDIRECT_URL = 'https://www.edx.org/'
# if EMBARGO_SITE_REDIRECT_URL is missing, a HttpResponseForbidden is returned.
...
...
common/djangoapps/embargo/models.py
View file @
877ec3f9
...
...
@@ -92,7 +92,7 @@ class IPFilter(ConfigurationModel):
def
__iter__
(
self
):
for
network
in
self
.
networks
:
yield
network
yield
network
def
__contains__
(
self
,
ip
):
try
:
...
...
common/djangoapps/embargo/tests/test_forms.py
View file @
877ec3f9
...
...
@@ -171,16 +171,16 @@ class IPFilterFormTest(TestCase):
# Network tests
# ips not in whitelist network
for
addr
in
'1.1.0.2, 1.0.1.0'
.
split
(
','
)
:
for
addr
in
[
'1.1.0.2'
,
'1.0.1.0'
]
:
self
.
assertNotIn
(
addr
.
strip
(),
whitelist
)
# ips in whitelist network
for
addr
in
'1.1.0.1, 1.0.0.100'
.
split
(
','
)
:
for
addr
in
[
'1.1.0.1'
,
'1.0.0.100'
]
:
self
.
assertIn
(
addr
.
strip
(),
whitelist
)
# ips not in blacklist network
for
addr
in
'2.0.0.0, 1.1.0.0'
.
split
(
','
)
:
for
addr
in
[
'2.0.0.0'
,
'1.1.0.0'
]
:
self
.
assertNotIn
(
addr
.
strip
(),
blacklist
)
# ips in blacklist network
for
addr
in
'1.0.100.0, 1.0.0.10'
.
split
(
','
)
:
for
addr
in
[
'1.0.100.0'
,
'1.0.0.10'
]
:
self
.
assertIn
(
addr
.
strip
(),
blacklist
)
# Test clearing by adding an empty list is OK too
...
...
common/djangoapps/embargo/tests/test_models.py
View file @
877ec3f9
...
...
@@ -79,7 +79,7 @@ class EmbargoModelsTest(TestCase):
cblacklist
=
IPFilter
.
current
()
.
blacklist_ips
self
.
assertTrue
(
blacklist
in
cblacklist
)
# network tests
def
test_ip_network_blocking
(
self
):
whitelist
=
'1.0.0.0/24'
blacklist
=
'1.1.0.0/16'
...
...
lms/envs/common.py
View file @
877ec3f9
...
...
@@ -225,10 +225,10 @@ FEATURES = {
# Hide any Personally Identifiable Information from application logs
'SQUELCH_PII_IN_LOGS'
:
False
,
# Toggle
embargo functionality
# Toggle
s the embargo functionality, which enable embargoing for particular courses
'EMBARGO'
:
False
,
# Toggle
embargo site functionality
# Toggle
s the embargo site functionality, which enable embargoing for the whole site
'SITE_EMBARGOED'
:
False
,
# Whether the Wiki subsystem should be accessible via the direct /wiki/ paths. Setting this to True means
...
...
@@ -680,6 +680,9 @@ ZENDESK_URL = None
ZENDESK_USER
=
None
ZENDESK_API_KEY
=
None
##### EMBARGO #####
EMBARGO_SITE_REDIRECT_URL
=
None
##### shoppingcart Payment #####
PAYMENT_SUPPORT_EMAIL
=
'payment@example.com'
##### Using cybersource by default #####
...
...
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