Hi everyone,

Top-level question: I want to have a database connection per
authenticated user, because each has their own username and password
at the database level. Django by default seems geared up either for 1
or a small, set number of databases (and therefore connections). What
is the best way to do this?

More details:

I'm actually using LDAP as my back-end, and the app is for viewing and
changing data in an LDAP directory. My security model says that the
directory does all the access control, and the Django app accesses it
only with the permissions of the current user. So I need to bind to
the directory as the current user, and then use that connection for
all operations.

I have discovered django-ldapdb <http://opensource.bolloretelecom.eu/
projects/django-ldapdb/>, which reflects LDAP data as Django models
(very cool) by writing a database backend to interface with the
directory. But its way of doing things assumes you are logged into the
directory with a "super-user" style account, defined in the config,
all the time.

I've also discovered django-auth-ldap <http://packages.python.org/
django-auth-ldap/> which allows me to authenticate against the
directory and will give me a connection object (stored as
request.user.ldap_user.connection) which is correctly logged in - but
I can't see how to take that connection object and use it for all
subsequent interactions with the directory. Can I do this at the db
router level? How can my db router see the User object so it can
return the right answer?

Thanks for any pointers anyone can provide! :-)

Gerv

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

Reply via email to