5

In Django authentication permissions, how to remove all permissions granted to a group?

Antonio José
  • 473
  • 2
  • 5
  • 14

1 Answers1

9

There are separate ways to do this.

  • via admin

    • edit your group and simply remove all permissions enter image description here
  • via database

    DELETE FROM auth_group_permissions WHERE group_id=<id>;
    
  • via shell

    $ python manage.py shell
    
    >>> from django.contrib.auth.models import Group
    >>> group = Group.objects.get(id=<id>)
    >>> group.permissions.clear()
    

Edit: .clear() makes more sense than .all().delete(), thx Ivan ;)

wfehr
  • 2,185
  • 10
  • 21