Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
604 B
21 lines
604 B
|
|
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))
|
|
|
|
|