Browse Source

Přebývající dump práv

pull/80/head
Jonas Havelka 2 weeks ago
parent
commit
42d57e7b42
  1. 20
      various/management/commands/save_org_permissions.py

20
various/management/commands/save_org_permissions.py

@ -1,20 +0,0 @@
from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session
from django.contrib.auth.models import Group, Permission
import json
class Command(BaseCommand):
"""
Dump permissions for group 'org' such that them can be used on an other machine.
"""
def handle(self, *args, **options):
orgroup = Group.objects.get(name='org')
permissions = []
for p in orgroup.permissions.all():
permissions.append({
'codename': p.codename,
'ct_app_label': p.content_type.app_label,
'ct_model': p.content_type.model})
print(json.dumps(permissions))
Loading…
Cancel
Save