You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
468 B

8 years ago
8 years ago
8 years ago
8 years ago
  1. from hc.accounts.models import Profile
  2. class TeamAccessMiddleware(object):
  3. def __init__(self, get_response):
  4. self.get_response = get_response
  5. def __call__(self, request):
  6. if not request.user.is_authenticated:
  7. return self.get_response(request)
  8. profile = Profile.objects.for_user(request.user)
  9. request.profile = profile
  10. request.project = profile.current_project
  11. return self.get_response(request)