[egenix-users] Re: [egenix-support] Per-user connection (was: Over Connection pool)

M.-A. Lemburg mal at egenix.com
Mon Feb 7 18:41:54 CET 2005


Palomino Campos Juber wrote:
> We are developing a integrated system with Zope, and we need that all system users could make a connection to the database with their own "user" and "password", in design we use a object connection "Z Oracle Database Connection" but it works just with one user (hard code), We don't know how to make a dynamic one in which i could send parameters "user" and "password". 
> This is important to implement the security system by database roles.

If you only want authentication checking against the database,
I'd suggest you implement this using an External Method which
then tries to connect to the database using the given uid and passwd:

import mx.ODBC.Windows as ODBC

def database_authentication_check(uid, passwd):
     try:
         db = ODBC.Connect('datasourcename', uid, passwd)
     except ODBC.Error:
         return 0
     else:
         db.close()
         return 1

Creating an mxODBC Zope DA connection object per user (temporary or
stored in the ZODB as connect-on-demand) would be another possibility.

OTOH, manipulating the attributes of a single existing connection
object is a bad idea since every change would result in a new
revision of the connection object.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 07 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list