Hi,

What's the state of the art for using non-model Users with the admin
app? The documentation still says it's best to translate your remote
authentication into django.contrib.auth.models User instances when you
want to support the admin app [1], but I wonder if anyone has
experience to share from ignoring this advice.

[1] 
http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend

Our application currently uses an alternate authentication backend
with the contrib.auth middleware to populate request.user from the
viewer's session. Our backend returns our custom user objects from
get_user(), which works fine for our custom apps that expect our weird
user object, but less well with the admin and other contrib apps that
expect contrib.auth's User instances. We'd like to be able to use
flatpages (and thus the admin), so I'm trying to figure out how to
reconcile the user systems.

To work within the existing constraints, seems like we could move our
user object to (say) request.remoteuser, and fake/translate it into a
request.user that is a contrib.auth.models User instance. We'd like to
avoid storing User records for all our users, though, so we'd want to
only save them on demand, or only for users with admin privileges.
That sounds doable, but of course we'd prefer to not have to save any
users at all, by using our existing user objects.

It seems odd that the admin doesn't support all the features of the
auth backend system. I tried prototyping an admin that used generic
relationships to the User instances, with contenttypes, but as our
remote users aren't Django models at all, that didn't work. Instead of
generic foreign keys, seems like we'd need to use custom model fields
to make really-foreign keys that don't even reference models, but
rather call into the auth backend system.

I realize I'm talking about essentially extending the auth backend
interface to include fake models, so really I just wonder if anyone
has experience to share about trying to get the admin to work with
custom user types. Does anyone?

Thanks!


Mark Paschal
markp...@markpasc.org

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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