Commit d00b1efc by Őry Máté

dashboard: deny adding entity to acl if already there

parent 40e3d8d4
...@@ -1174,10 +1174,20 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin): ...@@ -1174,10 +1174,20 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
return return
try: try:
entity = search_user(name) entity = search_user(name)
if self.instance.object_level_set.filter(users__in=[entity]):
messages.warning(
self.request, _('User "%s" has already '
'access to this object.') % name)
return
except User.DoesNotExist: except User.DoesNotExist:
entity = None entity = None
try: try:
entity = Group.objects.get(name=name) entity = Group.objects.get(name=name)
if self.instance.object_level_set.filter(groups__in=[entity]):
messages.warning(
self.request, _('Group "%s" has already '
'access to this object.') % name)
return
except Group.DoesNotExist: except Group.DoesNotExist:
messages.warning( messages.warning(
self.request, _('User or group "%s" not found.') % name) self.request, _('User or group "%s" not found.') % name)
......
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