You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Dave <sn...@gmail.com> on 2008/08/25 15:06:36 UTC

Adding access to "real" username in UserWrapper

Roller allows you to have both a 'username' and a 'screenname'. Your
username must be unique and can never change. Your sceenname doesn't
have to be unique and can change. That's all good (perhaps I would
have called the unique one 'userid' and the changing one 'username' if
I had to do it all again, but no matter).

In Roller page templates, when you access the $user.username property,
you actually get the sceenname back, which is the right thing for most
cases because that's what we want to display. That's all good too, but
there are cases where you need access to the unique username
identifier.

Any objection to adding a way to access username in the UserWrapper object?

And, what should the method be called? Should it be:
   UserWrapper.getUserId()

Or:
   UserWrapper.getUserNameRaw()

Or something else. I like the first option.

- Dave

Re: Adding access to "real" username in UserWrapper

Posted by Dave <sn...@gmail.com>.
On Mon, Aug 25, 2008 at 12:21 PM, Allen Gilliland
<Al...@sun.com> wrote:
> What's the use case that requires you to need the username?

What I'd like to is to serve a profile page for each user and I was
hoping for a nice clean URL. Whether I did this via page templates or
a new action/JSP, I still need a unique identifier for the URL.


> The reason we blocked access to that field is for security reasons.  The
> account username/password fields should be known only to their user and only
> be used for authentication.  For everything else we should be using other
> fields IMO.

Yes, I see your point. Especially since some sites use email address
for user name.


> If you need something that uniquely identifies the user then we should use
> either the userId (user.getId()), which is used by the data store, or add
> some kind of other public version of the userId which is meant for sharing.

I'm not a big fan of exposing database IDs or adding yet another identifier.
We already have these:

   username: unique and unchanging ID for user
   screenname: non-unique and changeable name for user

Adding another might be too confusing.

- Dave

Re: Adding access to "real" username in UserWrapper

Posted by Allen Gilliland <Al...@Sun.COM>.
What's the use case that requires you to need the username?

The reason we blocked access to that field is for security reasons.  The 
account username/password fields should be known only to their user and 
only be used for authentication.  For everything else we should be using 
other fields IMO.

If you need something that uniquely identifies the user then we should 
use either the userId (user.getId()), which is used by the data store, 
or add some kind of other public version of the userId which is meant 
for sharing.

-- Allen


Dave wrote:
> Roller allows you to have both a 'username' and a 'screenname'. Your
> username must be unique and can never change. Your sceenname doesn't
> have to be unique and can change. That's all good (perhaps I would
> have called the unique one 'userid' and the changing one 'username' if
> I had to do it all again, but no matter).
> 
> In Roller page templates, when you access the $user.username property,
> you actually get the sceenname back, which is the right thing for most
> cases because that's what we want to display. That's all good too, but
> there are cases where you need access to the unique username
> identifier.
> 
> Any objection to adding a way to access username in the UserWrapper object?
> 
> And, what should the method be called? Should it be:
>    UserWrapper.getUserId()
> 
> Or:
>    UserWrapper.getUserNameRaw()
> 
> Or something else. I like the first option.
> 
> - Dave

Re: Adding access to "real" username in UserWrapper

Posted by Grzegorz Bugaj <gr...@yahoo.com>.
I think that calling it 'getUserNameRaw' is more appropriate since some people might get confused if we call it'getUserId()' whitch would give impression that this method returns primary key.

Regards
Greg Bugaj

--- On Mon, 8/25/08, Dave <sn...@gmail.com> wrote:
From: Dave <sn...@gmail.com>
Subject: Adding access to "real" username in UserWrapper
To: dev@roller.apache.org
Date: Monday, August 25, 2008, 8:06 AM

Roller allows you to have both a 'username' and a 'screenname'.
Your
username must be unique and can never change. Your sceenname doesn't
have to be unique and can change. That's all good (perhaps I would
have called the unique one 'userid' and the changing one
'username' if
I had to do it all again, but no matter).

In Roller page templates, when you access the $user.username property,
you actually get the sceenname back, which is the right thing for most
cases because that's what we want to display. That's all good too, but
there are cases where you need access to the unique username
identifier.

Any objection to adding a way to access username in the UserWrapper object?

And, what should the method be called? Should it be:
   UserWrapper.getUserId()

Or:
   UserWrapper.getUserNameRaw()

Or something else. I like the first option.

- Dave