You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Ilan Azbel <ia...@mdio.net> on 2004/05/11 18:01:59 UTC
changing username while being logged in
Hello,
Is it possible for users to change their own username while being logged in?
If so, how?
I do the following with little success (truncated version):
TurbineSecurity.removeUser(u);
org.apache.turbine.om.security.TurbineUser NewUser = new
org.apache.turbine.om.security.TurbineUser();
NewUser.setEmail("my@email.address");
NewUser.setFirstName("ilan");
NewUser.setLastName("azbel");
NewUser.setUserName("newusername");
TurbineSecurity.addUser(NewUser, pp.getString("Password"));
TurbineSecurity.grant(NewUser, TurbineSecurity.getGlobalGroup(),
TurbineSecurity.getRole("turbine_root"));
data.setUser(TurbineSecurity.getAuthenticatedUser(NewUser.getUserName(),
"pwd");
Ilan
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: changing username while being logged in
Posted by Ilan Azbel <ia...@mdio.net>.
Although not ideal, I have found a quick hack to get around this problem.
All I do is create an sql connection to the database and execute an "UPDATE"
statement to change the username.
Then I execute the following commands (u is the current user from RunData):
u.setUserName("New UserName");
TurbineSecurity.saveUser(u);
Thanks for all the help.
Ilan
> -----Original Message-----
> From: Ilan Azbel [mailto:iazbel@mdio.net]
> Sent: 12 May 2004 10:43
> To: Turbine Users List
> Subject: RE: changing username while being logged in
>
>
> Would it not be simpler to just add a new user, then assume this
> new user's
> identity?
>
> What code would I use to get one user to assume another user's identity?
>
> Ilan
>
>
>
> > -----Original Message-----
> > From: Jeffery Painter [mailto:painter@kiasoft.com]
> > Sent: 11 May 2004 08:34
> > To: Turbine Users List
> > Subject: Re: changing username while being logged in
> >
> >
> >
> > You may want to do some history searching on the mail list archives for
> > related issues with changing the username while logged in.
> >
> > TurbineSecurity I believe tries to do an update on the user
> once the user
> > logs out and if the user name has changed, it will think that
> it needs to
> > create a new user account (since it will default to finding an unmatched
> > username on your user object)
> >
> > most of the security service is related to the username as the primary
> > key, so you will need to be careful for putting together a solution that
> > does not create multiple users and instead just updates the username as
> > you wish.
> >
> > be sure to check if the username they wish to change to isn't being used
> > already, or it could cause even more problems.
> >
> > related thread from the past:
> >
> > http://marc.theaimsgroup.com/?l=turbine-user&m=104405212018687&w=2
> >
> > just looking at your code, it looks like you are attempting to
> remove the
> > user before updating the user.. I don't think this is what you
> want to do
> >
> > Jeff Painter
> >
> >
> > On Tue, 11 May 2004, Ilan Azbel wrote:
> >
> > > Hello,
> > >
> > > Is it possible for users to change their own username while
> > being logged in?
> > > If so, how?
> > >
> > > I do the following with little success (truncated version):
> > >
> > > TurbineSecurity.removeUser(u);
> > > org.apache.turbine.om.security.TurbineUser NewUser = new
> > > org.apache.turbine.om.security.TurbineUser();
> > > NewUser.setEmail("my@email.address");
> > > NewUser.setFirstName("ilan");
> > > NewUser.setLastName("azbel");
> > > NewUser.setUserName("newusername");
> > > TurbineSecurity.addUser(NewUser, pp.getString("Password"));
> > > TurbineSecurity.grant(NewUser, TurbineSecurity.getGlobalGroup(),
> > >
> > TurbineSecurity.getRole("turbine_root"));
> > >
> data.setUser(TurbineSecurity.getAuthenticatedUser(NewUser.getUserName(),
> > > "pwd");
> > >
> > > Ilan
> >
> > ---------------------------------------------------------------------
> > 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
RE: changing username while being logged in
Posted by Ilan Azbel <ia...@mdio.net>.
Would it not be simpler to just add a new user, then assume this new user's
identity?
What code would I use to get one user to assume another user's identity?
Ilan
> -----Original Message-----
> From: Jeffery Painter [mailto:painter@kiasoft.com]
> Sent: 11 May 2004 08:34
> To: Turbine Users List
> Subject: Re: changing username while being logged in
>
>
>
> You may want to do some history searching on the mail list archives for
> related issues with changing the username while logged in.
>
> TurbineSecurity I believe tries to do an update on the user once the user
> logs out and if the user name has changed, it will think that it needs to
> create a new user account (since it will default to finding an unmatched
> username on your user object)
>
> most of the security service is related to the username as the primary
> key, so you will need to be careful for putting together a solution that
> does not create multiple users and instead just updates the username as
> you wish.
>
> be sure to check if the username they wish to change to isn't being used
> already, or it could cause even more problems.
>
> related thread from the past:
>
> http://marc.theaimsgroup.com/?l=turbine-user&m=104405212018687&w=2
>
> just looking at your code, it looks like you are attempting to remove the
> user before updating the user.. I don't think this is what you want to do
>
> Jeff Painter
>
>
> On Tue, 11 May 2004, Ilan Azbel wrote:
>
> > Hello,
> >
> > Is it possible for users to change their own username while
> being logged in?
> > If so, how?
> >
> > I do the following with little success (truncated version):
> >
> > TurbineSecurity.removeUser(u);
> > org.apache.turbine.om.security.TurbineUser NewUser = new
> > org.apache.turbine.om.security.TurbineUser();
> > NewUser.setEmail("my@email.address");
> > NewUser.setFirstName("ilan");
> > NewUser.setLastName("azbel");
> > NewUser.setUserName("newusername");
> > TurbineSecurity.addUser(NewUser, pp.getString("Password"));
> > TurbineSecurity.grant(NewUser, TurbineSecurity.getGlobalGroup(),
> >
> TurbineSecurity.getRole("turbine_root"));
> > data.setUser(TurbineSecurity.getAuthenticatedUser(NewUser.getUserName(),
> > "pwd");
> >
> > Ilan
>
> ---------------------------------------------------------------------
> 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
Re: changing username while being logged in
Posted by Jeffery Painter <pa...@kiasoft.com>.
You may want to do some history searching on the mail list archives for
related issues with changing the username while logged in.
TurbineSecurity I believe tries to do an update on the user once the user
logs out and if the user name has changed, it will think that it needs to
create a new user account (since it will default to finding an unmatched
username on your user object)
most of the security service is related to the username as the primary
key, so you will need to be careful for putting together a solution that
does not create multiple users and instead just updates the username as
you wish.
be sure to check if the username they wish to change to isn't being used
already, or it could cause even more problems.
related thread from the past:
http://marc.theaimsgroup.com/?l=turbine-user&m=104405212018687&w=2
just looking at your code, it looks like you are attempting to remove the
user before updating the user.. I don't think this is what you want to do
Jeff Painter
On Tue, 11 May 2004, Ilan Azbel wrote:
> Hello,
>
> Is it possible for users to change their own username while being logged in?
> If so, how?
>
> I do the following with little success (truncated version):
>
> TurbineSecurity.removeUser(u);
> org.apache.turbine.om.security.TurbineUser NewUser = new
> org.apache.turbine.om.security.TurbineUser();
> NewUser.setEmail("my@email.address");
> NewUser.setFirstName("ilan");
> NewUser.setLastName("azbel");
> NewUser.setUserName("newusername");
> TurbineSecurity.addUser(NewUser, pp.getString("Password"));
> TurbineSecurity.grant(NewUser, TurbineSecurity.getGlobalGroup(),
> TurbineSecurity.getRole("turbine_root"));
> data.setUser(TurbineSecurity.getAuthenticatedUser(NewUser.getUserName(),
> "pwd");
>
> Ilan
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org