Merge pull request #2586 from FinnStutzenstein/Issue2543

Just protect default group (fixes #2543)
This commit is contained in:
Emanuel Schütze 2016-11-04 15:51:40 +01:00 committed by GitHub
commit 8c07884746
1 changed files with 2 additions and 3 deletions

View File

@ -148,11 +148,10 @@ class GroupViewSet(ModelViewSet):
def destroy(self, request, *args, **kwargs):
"""
Protects builtin groups 'Anonymous' (pk=1) and 'Registered' (pk=2)
from being deleted.
Protects builtin groups 'Default' (pk=1) from being deleted.
"""
instance = self.get_object()
if instance.pk in (1, 2):
if instance.pk == 1:
self.permission_denied(request)
self.perform_destroy(instance)
return Response(status=status.HTTP_204_NO_CONTENT)