Man.  I thought I had something by trying 
data.getACL().hasRole("turbine_root"), but I still get a 
NullPointerException - because getACL is returning null.  However, 
data.getUser().getUserName() does return the correct user name.  Am I 
not doing something properly to get the ACL back from the User object 
properly?

String userid = data.getParameters().getString("userid");
if (userid == null) {
   data.setMessage("User ID not supplied");
   setTemplate(data, "Login.vm");
   return;
}
String password = data.getParameters().getString("password");
if (password == null) {
   data.setMessage("Password not supplied");
   setTemplate(data, "Login.vm");
   return;
}
User user = null;
try {
   user = TurbineSecurity.getAuthenticatedUser(userid, password);
   user.updateLastLogin();
   user.setHasLoggedIn(new Boolean(true));
   data.setUser(user);
   data.save();
} catch (Exception e) {
   data.setMessage(e.getMessage());
   setTemplate(data, "Login.vm");
}

Then, on the template that I was going to before calling this action, I 
do this:

try {
   context.put("isroot", new
     Boolean(data.getACL().hasRole("turbine_root")));
} catch (Exception e) {
   context.put("isroot", new String("Exception!"));
   data.setMessage(e.toString());
}

And I end up getting a NullPointerException every time - because 
data.getACL() is returning null.  Is there something else I have to do 
to the User object when they authenticate?

Will Stranathan



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to