Try this

        #set ( $user = $data.getUser() )
        $user.getPrimaryKeyAsInt()

        ...or...

        $user.UserId

one of those should work.

Jeffery Painter


On Wed, 18 Feb 2004, Tim Tennant wrote:

> 
> I'm currently using the standard trubine user/role/access tables/objects in
> my application. I need to get the current userid to use as a foreign key in
> other tables/objects, I have tried using:
>       $data.user.id
>       $data.getUser().getId()
> According to the javadoc for interface user (& TurbineUser) getId() is
> inherited from org.apache.turbine.om.security.SecurityEntity, but it this
> method doesn't seem to be defined.
> 
> Also on $data.user.name (also inherited from
> org.apache.turbine.om.security.SecurityEntity), returns a null or zero
> length string, and you have to use $data.user.userName, event though the
> javadoc say that the getUserName() method has been deprecated and superseded
> by the getName() method.
> 
> My work around has been to define a method that selects the user record back
> using the username/loginname as the select criteria and then place this new
> user object in the context. However this is not ideal, as it's extra work
> and database/network activity.
> 
> Is there a better way, or more standard way to obtain the current logged on
> user's user_id?
> 
> Regards,
> 
> TimT
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to