This repository has been archived on 2021-06-29. You can view files and clone it, but cannot push or open issues or pull requests.
2014-03-18 17:23:12 +00:00
|
|
|
from django.http import HttpResponseRedirect
|
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
|
|
|
|
class BetaMiddleware(object):
|
|
|
|
"""
|
|
|
|
Allow access only to people on the Beta group.
|
|
|
|
"""
|
|
|
|
def process_request(self, request):
|
|
|
|
beta_group_id = settings.BETA_ACCESS_GROUP_ID
|
2014-04-03 11:36:45 +00:00
|
|
|
if request.user and not request.user.is_superuser:
|
|
|
|
if not request.user.groups.filter(pk=beta_group_id):
|
|
|
|
if request.path not in settings.BETA_ACCESS_ALLOW_URLS:
|
|
|
|
return HttpResponseRedirect('/landing/')
|