fixed error, which allowed admins to delete the anonymous grou
This commit is contained in:
parent
12554c71e6
commit
e168445497
@ -17,7 +17,7 @@
|
|||||||
<tr class="{% cycle '' 'odd' %}">
|
<tr class="{% cycle '' 'odd' %}">
|
||||||
<td><a href="{% model_url group 'view' %}">{{ group.name }}</a></td>
|
<td><a href="{% model_url group 'view' %}">{{ group.name }}</a></td>
|
||||||
<td><a href="{% url user_group_edit group.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit group' %}"></a>
|
<td><a href="{% url user_group_edit group.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit group' %}"></a>
|
||||||
{% if group.name != 'Anonymous' %}
|
{% if group.name|lower != 'anonymous' %}
|
||||||
<a href="{% url user_group_delete group.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete group' %}"></a>
|
<a href="{% url user_group_delete group.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete group' %}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
@ -209,7 +209,7 @@ class UserDeleteView(DeleteView):
|
|||||||
if self.get_object() == self.request.user:
|
if self.get_object() == self.request.user:
|
||||||
messages.error(request, _("You can not delete yourself."))
|
messages.error(request, _("You can not delete yourself."))
|
||||||
else:
|
else:
|
||||||
super(DeleteView, self).pre_redirect(request, *args, **kwargs)
|
super(UserDeleteView, self).pre_redirect(request, *args, **kwargs)
|
||||||
|
|
||||||
class SetUserStatusView(RedirectView, SingleObjectMixin):
|
class SetUserStatusView(RedirectView, SingleObjectMixin):
|
||||||
"""
|
"""
|
||||||
@ -442,6 +442,12 @@ class GroupDeleteView(DeleteView):
|
|||||||
model = Group
|
model = Group
|
||||||
url = 'user_group_overview'
|
url = 'user_group_overview'
|
||||||
|
|
||||||
|
def pre_redirect(self, request, *args, **kwargs):
|
||||||
|
if self.get_object().name.lower() == 'anonymous':
|
||||||
|
messages.error(request, _("You can not delete this Group."))
|
||||||
|
else:
|
||||||
|
super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Config(FormView):
|
class Config(FormView):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user