Glenn,
I am copying this reply to the developer list to give others an 
opportunity to comment.

Glenn Golden wrote:

> Paul -
> 
> You changed JetspeedProfilerService as follows:
> 
>         User user = locator.getUser();
>         if (null != user)
>         {
>  >>         if ((user.getUserName() != null) && (user.hasLoggedIn()))
>                 uri.addPathInfo(Profiler.PARAM_USER, user.getUserName());
>         }
> 
> The intent of the code I put in is to properly identify a page when user A
> is viewing user B's page.
> 
> User A would be logged in, and use a URL such as:
> 
> /portal/user/B
> 
> In this case, the "user" above is the user from the URL, the page's user,
> "B", not the requesting user ("A").  If user in the locator, that means the
> request was for a "user" page (as opposed to a "group" or "role" page).
> 
> The code you added changes the behavior, in that it tests that user B has
> loggedin.  There is no requirement that user B is logged in when user A
> visits user B's page.
> 
> We could change this to:
> 
> String userId = locator.getUserName();
> if (userId != null)
> {
>     uri.addPathInfo(Profiler.PARAM_USER, userId)
> }
> else ...
> 
> This removes the requirement that the page user ("B", as opposed to the
> requesting user,"A") be logged in, and combines the user = null and userId =
> null test together.  It also lets the else happen if the userId is null.
> 
> Do you see how this is supposed to work?


I under stand you request.  A better example involves an "administrator" 
editing a users PSML.  For that reason I will remove the "logged in 
requirement"

> 
> Can you restore this to proper functionality?


I contend a user should use their own PSML, a group PSML, or a Role 
PSML.  Not another user PSML.  In your example, user B's PSML should be 
move to a group PSML.

> 
> Also, I'm concerned about what case produced this URL:
> 
> 
>>http://localhost/jetspeed/portal/user/null/page/news.psml,
>>
> 
> I've never seen that happen in live tests.  If this was a unit test, can you
> point me to where this test code is?


This is not tested by a unit test.  It is a cactus test because the 
context is required by the test.  See 
org.apache.jetspeed.test.BasicSanityTest.testPageUrl()

That test does is performed as the anonymous user, i.e. not logged-in.

> 
> Thanks for the info on unit testing; as you probably figured out, I havn't
> learned about this area of Jetspeed yet.


Use the existing tests as you are leaning how to write new ones.

> 

> - Glenn
> 
> --------------------------------------------
> Glenn R. Golden, Systems Research Programmer 
> University of Michigan School of Information
> [EMAIL PROTECTED]               734-615-1419
> --------------------------------------------
> 
> 

Paul Spencer


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to