Merge pull request #2586 from FinnStutzenstein/Issue2543
Just protect default group (fixes #2543)
This commit is contained in:
commit
8c07884746
@ -148,11 +148,10 @@ class GroupViewSet(ModelViewSet):
|
|||||||
|
|
||||||
def destroy(self, request, *args, **kwargs):
|
def destroy(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Protects builtin groups 'Anonymous' (pk=1) and 'Registered' (pk=2)
|
Protects builtin groups 'Default' (pk=1) from being deleted.
|
||||||
from being deleted.
|
|
||||||
"""
|
"""
|
||||||
instance = self.get_object()
|
instance = self.get_object()
|
||||||
if instance.pk in (1, 2):
|
if instance.pk == 1:
|
||||||
self.permission_denied(request)
|
self.permission_denied(request)
|
||||||
self.perform_destroy(instance)
|
self.perform_destroy(instance)
|
||||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
|
Loading…
Reference in New Issue
Block a user