Your Ad Here

Wednesday, January 18, 2012

Re: Any way to not create default Django permissions?

Awesome - thanks for the description.

On Jan 18, 9:45 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, Jan 18, 2012 at 1:50 PM, Stodge <sto...@gmail.com> wrote:
> > I have a particular use case where the default permissions don't work
> > for me. I know I can create a custom auth backend, but if I do that,
> > is there a clean, legal way to not create the default model
> > permissions? Thanks
>
> If you have the django.contrib.auth app installed, it installs a
> signal handler to be called post syncdb to create the permissions. The
> handler is defined and the signal is connected in
> django.contrib.auth.management (in the __init__.py).
>
> If you want to disable this behaviour, you should be able to do so by
> disconnecting the signal:
>
> https://docs.djangoproject.com/en/1.3/topics/signals/#disconnecting-s...
>
> This signal has the uid 'django.contrib.auth.management.create_permissions'.
>
> Your signal de-registering code must run after the signal is
> registered, and before syncdb runs. Adding it to the management
> commands __init__.py of an app that appears after django.contrib.auth
> in settings.INSTALLED_APPS should suffice.
>
> Obviously, if you do this no permissions will ever be created by
> calling syncdb - default, custom or otherwise. You will have to
> manually create the permissions you want for the models you want them
> for.
>
> Without the default permissions, lots of things, like the admin, won't
> work. They would still work for superusers, as superusers have every
> permission, even ones that don't exist.
>
> Cheers
>
> Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 comments:

Post a Comment