mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 01:16:19 +00:00
Add a management command to create objects for newly defined permissions
This script does not remove permissions that already exist. (imported from commit 15d18266a05a84b9cac6cc7d2104668b41b48f35)
This commit is contained in:
12
zephyr/management/commands/update_permissions.py
Normal file
12
zephyr/management/commands/update_permissions.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import get_app, get_models
|
||||
from django.contrib.auth.management import create_permissions
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Sync newly created object permissions to the database"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
# From http://stackoverflow.com/a/11914435/90777
|
||||
create_permissions(get_app("zephyr"), get_models(), 2)
|
||||
Reference in New Issue
Block a user