django-extauth / extauth / management / commands / updateperms.py

'''
Copyright 2009 H. Lee Moffitt Cancer Center and Research Institute, Inc. 
All rights reserved.

@author: Michael Hall <mhall119@gmail.com>
'''
from django.core.management.base import NoArgsCommand, CommandError
from extauth.management import create_model_permissions, create_page_permissions
from django.contrib.auth.management import create_permissions
from django.db.models import get_app, get_apps
from django.conf import settings
from django.db import transaction

class Command(NoArgsCommand):
    
    def handle_noargs(self, **options):
        verbosity = int(options.pop('verbosity', 1))
        
        for app in get_apps():
            if verbosity >= 1:
                print "Updating Permissions for %s" % app.__name__
                            
            if verbosity >= 1:
                print "Creating standard permissions"
            create_permissions(app, [], verbosity, **options)
            
            if verbosity >= 1:
                print "Creating ExtAuth model permissions"
            create_model_permissions(app, [], verbosity, **options)
            
            if verbosity >= 1:
                print "Creating ExtAuth page permissions"
            create_page_permissions(app, [], verbosity, **options)

            
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.