[Zope-dev] LoginManager question

Bertrand Croq bcroq@virtual-net.fr
Tue, 27 Mar 2001 12:19:41 +0200


Hi,
  I am currently using LoginManager to authenticate users from a MySQL 
database. I followed the tutorials and it works quite well; but there are 
other data associated with users in the database that I would like to use in 
Zope. I have found a solution but I think it is quite complicated:

- first, I added SQL_id_user (ZSQL-method) in the acl_users:

select id_user
from user
where <dtml-sqltest username column=user_name type=string>

- then, I added id_user (DTML-method) in the acl_users:

<dtml-in expr="SQL_id_user(username=username)">
  <dtml-return id_user> 
</dtml-in>

- now, when I want to get the id_user value associated with the current user, 
I need to do:

<dtml-with REQUEST>
 <dtml-var
  expr = "AUTHENTICATED_USER.id_user(
   AUTHENTICATED_USER,
   username=AUTHENTICATED_USER
  )"
 >
</dtml-with>

Isn't there an easier way to get the id_user value?

-- 
Bertrand Croq - VIRTUAL NET (http://www.virtual-net.fr)
80, avenue des Buttes de Coesmes - 35700 RENNES
tel: +33 2 23 21 06 30 - fax: +33 2 99 38 16 85