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-signals

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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to