simplification of security check: all unauthorized exceptions are dealt with by context processors
--- a/src/cm/security.py Fri Jun 11 11:04:23 2010 +0200
+++ b/src/cm/security.py Thu Jul 15 16:54:29 2010 +0200
@@ -198,8 +198,7 @@
def _dec(view_func):
def _check_global_perm(request, *args, **kwargs):
if must_be_logged_in and not is_authenticated(request):
- login_url = reverse('login')
- return HttpResponseRedirect('%s?%s=%s' % (login_url, redirect_field_name, urlquote(request.get_full_path())))
+ raise UnauthorizedException('Should be logged in')
if has_perm(request, perm_name, text=None):
return view_func(request, *args, **kwargs)
@@ -222,8 +221,7 @@
return view_func(request, *args, **kwargs)
if must_be_logged_in and not is_authenticated(request):
- login_url = reverse('login')
- return HttpResponseRedirect('%s?%s=%s' % (login_url, redirect_field_name, urlquote(request.get_full_path())))
+ raise UnauthorizedException('Should be logged in')
if 'key' in kwargs:
text = get_object_or_404(Text, key=kwargs['key'])