Commit 585e44b7 by Őry Máté

acl: set up warning on group/user not found

parent 7978a871
...@@ -4,10 +4,12 @@ import logging ...@@ -4,10 +4,12 @@ import logging
import re import re
from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from django.contrib.messages import warning
from django.core import signing from django.core import signing
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.shortcuts import redirect from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView, DetailView, View from django.views.generic import TemplateView, DetailView, View
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from django.http import HttpResponse from django.http import HttpResponse
...@@ -102,8 +104,10 @@ class AclUpdateView(View, SingleObjectMixin): ...@@ -102,8 +104,10 @@ class AclUpdateView(View, SingleObjectMixin):
entity = User.objects.get(username=name) entity = User.objects.get(username=name)
except User.DoesNotExist: except User.DoesNotExist:
entity = Group.objects.get(name=name) entity = Group.objects.get(name=name)
instance.set_level(entity, value) except Group.DoesNotExist:
return redirect(instance) warning(request, _('User or group "%s" not found.') % name)
return
logger.info("Set %s's new acl level for %s to %s by %s.", logger.info("Set %s's new acl level for %s to %s by %s.",
unicode(entity), unicode(instance), unicode(entity), unicode(instance),
value, unicode(request.user)) value, unicode(request.user))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment