At 12:19 PM 3/27/01 +0200, Bertrand Croq wrote:
>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?
>

Yes, there is.  Get rid of the "id_user" DTML method and add the following
to a SkinScript method inside your UserSource:

WITH QUERY SQL_id_user(username=self.id) COMPUTE id_user

You should then be able to do "AUTHENTICATED_USER.id_user" to retrieve the
attribute.  


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to