You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Gopal Ramasammy-Cook <go...@psyber.wits.ac.za> on 2001/12/05 11:24:26 UTC
Getting a USER_ID from Turbine User
Hi
Why is it not possible to retrieve a USER_ID from the Turbine User table? I tried the getPerm method, it returns null. I made sure I had a user to work with since I could retrieve a login name etc. Is there something special about the USER_ID?
TIA,
Karim
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Getting a USER_ID from Turbine User
Posted by "Skondras P." <pa...@acn.gr>.
Frans Thamura wrote:
> Hi,
>
> Would you send me the full run version of the script?
>
> Frans
> ----- Original Message -----
> From: "Skondras P." <pa...@acn.gr>
> To: "Turbine Users List" <tu...@jakarta.apache.org>
> Sent: Wednesday, December 05, 2001 5:39 AM
> Subject: Re: Getting a USER_ID from Turbine User
>
> > Gopal Ramasammy-Cook wrote:
> >
> > > Hi
> > >
> > > Why is it not possible to retrieve a USER_ID from the Turbine User
> table? I tried the getPerm method, it returns null. I made sure I had a user
> to work with since I could retrieve a login name etc. Is there something
> special about the USER_ID?
> > >
> > > TIA,
> > > Karim
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> > Try this
> > long userID = Long.parseLong((((BaseObject)data.getUser()).
> > getPrimaryKey().getValue().toString()));
> >
> >
> >
The full run script is the following
public void doPerform( RunData data, Context ctx )
throws Exception
{
String username = data.getParameters().getString ( "username", "" );
String password = data.getParameters().getString ( "password", "" );
User user = null;
try
{
// Authenticate the user and get the object.
user = TurbineSecurity.getAuthenticatedUser( username.toUpperCase(),
password );
//check whether he is allowed to enter from this ip
// Store the user object.
data.setUser(user);
// Mark the user as being logged in.
user.setHasLoggedIn(new Boolean(true));
// Set the last_login date in the database.
user.updateLastLogin();
// This only happens if the user is valid; otherwise, we
// will get a valueBound in the User object when we don't
// want to because the username is not set yet. Save the
// User object into the session.
data.save();
// A CSR user belong to one or more group in differents realm
// we load all this parameter in the session
long userID = Long.parseLong((((BaseObject)data.getUser()).
getPrimaryKey().getValue().toString()));
}
catch ( TurbineSecurityException e )
{
data.getTemplateInfo().setScreenTemplate(TurbineResources.getString("template.login"));
data.setMessage(Localization.getString(data, "AUTH_LOGIN_ERROR"));
}
}
This script logsin a user using the turbine db and
stores the user in the data object in the session
from there you can get the User object and get the user id as i mentioned before
>
> >
> >
>
> ----------------------------------------------------------------------------
> ----
>
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Getting a USER_ID from Turbine User
Posted by Frans Thamura <ft...@yahoo.com>.
Hi,
Would you send me the full run version of the script?
Frans
----- Original Message -----
From: "Skondras P." <pa...@acn.gr>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Wednesday, December 05, 2001 5:39 AM
Subject: Re: Getting a USER_ID from Turbine User
> Gopal Ramasammy-Cook wrote:
>
> > Hi
> >
> > Why is it not possible to retrieve a USER_ID from the Turbine User
table? I tried the getPerm method, it returns null. I made sure I had a user
to work with since I could retrieve a login name etc. Is there something
special about the USER_ID?
> >
> > TIA,
> > Karim
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
> Try this
> long userID = Long.parseLong((((BaseObject)data.getUser()).
> getPrimaryKey().getValue().toString()));
>
>
>
>
>
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Getting a USER_ID from Turbine User
Posted by "Skondras P." <pa...@acn.gr>.
Gopal Ramasammy-Cook wrote:
> Hi
>
> Why is it not possible to retrieve a USER_ID from the Turbine User table? I tried the getPerm method, it returns null. I made sure I had a user to work with since I could retrieve a login name etc. Is there something special about the USER_ID?
>
> TIA,
> Karim
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
Try this
long userID = Long.parseLong((((BaseObject)data.getUser()).
getPrimaryKey().getValue().toString()));