summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/doc/source/intranet-setup.rst7
-rw-r--r--askbot/middleware/forum_mode.py4
2 files changed, 11 insertions, 0 deletions
diff --git a/askbot/doc/source/intranet-setup.rst b/askbot/doc/source/intranet-setup.rst
index 224ffb89..2711b376 100644
--- a/askbot/doc/source/intranet-setup.rst
+++ b/askbot/doc/source/intranet-setup.rst
@@ -12,3 +12,10 @@ Please change the following settings in your ``settings.py`` file::
In addition, in the "live settings":
* disable gravatar in "settings->User settings"
+
+If you would like to password/protect your site
+(achievable via "access control settings" -> "allow only registered users..."),
+and at the same time be able to have some dedicated service
+to read your site without authentication, add
+IP addresses of that service to a tuple ``ASKBOT_INTERNAL_IPS``
+in your ``settings.py`` file.
diff --git a/askbot/middleware/forum_mode.py b/askbot/middleware/forum_mode.py
index 7f1e29b1..d593a6f2 100644
--- a/askbot/middleware/forum_mode.py
+++ b/askbot/middleware/forum_mode.py
@@ -45,6 +45,10 @@ class ForumModeMiddleware(object):
and request.user.is_anonymous()):
resolver_match = ResolverMatch(resolve(request.path))
+ internal_ips = getattr(settings, 'ASKBOT_INTERNAL_IPS', None)
+ if internal_ips and request.META['REMOTE_ADDR'] in internal_ips:
+ return None
+
if is_view_allowed(resolver_match.func):
return