turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Lustig" <m...@marclustig.com>
Subject AW: how to update TurbineUser instance
Date Mon, 03 Feb 2003 14:26:11 GMT
What I did now is just overwriting save() in TurbineUserAdapter

old version:
    public void save()
        throws Exception
    {
        if (TurbineSecurity.accountExists(this))
        {
            TurbineSecurity.saveUser(this);
        }
        else
        {
            TurbineSecurity.addUser(this, getPassword());
        }
    }

new version:
    public void save()
        throws Exception
    {
      TurbineSecurity.saveUser(this);
    }

> -----Ursprungliche Nachricht-----
> Von: Marc Lustig [mailto:mail@marclustig.com]
> Gesendet: Montag, 3. Februar 2003 09:34
> An: Turbine Users List
> Betreff: AW: how to update TurbineUser instance
>
>
> Thanks Quinton, but DBUserManager does not have a save() method.
> Did you refer to the proposal code included in Fulcrum?
>
>
> > -----Ursprungliche Nachricht-----
> > Von: Quinton McCombs [mailto:qmccombs@nequalsone.com]
> > Gesendet: Montag, 3. Februar 2003 05:10
> > An: 'Turbine Users List'
> > Betreff: RE: how to update TurbineUser instance
> >
> >
> > Here one thing that _might_ work as a hacked solution for you.  I have
> > not tried this but it seems like it should work....
> >
> > TurbineUser.save() users the security service to save itself.  In the
> > logic of the save there is a call to
> > TurbineSecurity.accountExists(username) (or something like that).  If
> > the account exists(by comparin username), it performs an update.
> > Otherwise it does an insert.
> >
> > Here is the workaround:
> > Override the save method in your extended user class.  In the body of
> > this method put the code from DBUsermanager.save().  You will need to
> > replace the if(TurbineSecurity.accountExists(user) with user.isNew().
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Johnny Quazar [mailto:quazar@bitblaster.com]
> > > Sent: Saturday, February 01, 2003 12:09 PM
> > > To: Turbine Users List
> > > Subject: Re: how to update TurbineUser instance
> > >
> > >
> > > Hey Marc,x
> > >
> > > Try this once?
> > >
> > > client.setUserName(x);
> > > client.setModified(true);
> > > client.setNew(false);
> > > client.save();
> > >
> > > Seems to work here (but I'm not changing userName). Oops I see
> > > Quinton's response now and he sounds like this might be understood.
> > > Guess I'll click send anyway since this is drafted.
> > >
> > >
> > > At 11:28 PM +0100 1/31/03, Marc Lustig wrote:
> > > >I've got a form that should allow the user to change his
> > > username. Now
> > > >I'm running into trouble trying to update the corresponding user
> > > >instance.
> > > >
> > > >(Note, I have extended TurbineUser:
> > > >public abstract class BaseAudiotexUser extends
> > > >de.geoconnect.audiotex.om.TurbineUserAdapter
> > > >public class TurbineUserAdapter extends TurbineUser
> > > >This implementation works pretty good so far and I don't think it is
> > > >related to that problem here.)
> > > >
> > > >This code
> > > >
> > > >AudiotexUser client = ..
> > > >client.setUserName(x);
> > > >client.save();
> > > >
> > > >results in that exception:
> > > >
> > > >Caused by: org.apache.turbine.util.security.DataBackendException:
> > > >Failed to create account 'dd': Invalid argument value:
> > > Duplicate entry
> > > >'1040' for key 1
> > > >
> > > >Apparently torque is trying to make an insert instead of an update.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Mime
View raw message