some minor improvements to embargo
This commit is contained in:
@@ -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
|
||||
# Toggles 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'
|
||||
|
||||
@@ -18,13 +18,13 @@ Usage:
|
||||
|
||||
# Enable the middleware in your settings
|
||||
|
||||
# To enable Embargoing 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.
|
||||
|
||||
@@ -92,7 +92,7 @@ class IPFilter(ConfigurationModel):
|
||||
|
||||
def __iter__(self):
|
||||
for network in self.networks:
|
||||
yield network
|
||||
yield network
|
||||
|
||||
def __contains__(self, ip):
|
||||
try:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -225,10 +225,10 @@ FEATURES = {
|
||||
# Hide any Personally Identifiable Information from application logs
|
||||
'SQUELCH_PII_IN_LOGS': False,
|
||||
|
||||
# Toggle embargo functionality
|
||||
# Toggles the embargo functionality, which enable embargoing for particular courses
|
||||
'EMBARGO': False,
|
||||
|
||||
# Toggle embargo site functionality
|
||||
# Toggles 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 #####
|
||||
|
||||
Reference in New Issue
Block a user