Thomas,

Eric's answer is the way to go if you actually need a reference to an instance of IPerson. When I read your question, I wasn't positive whether you did or not.

If you only need to know "the user who is actually running the current portlet" by username, you have more options.

First, there's the PortletRequest.getRemoteUser() method, which is meant to provide you with "the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated" (javadoc). FYI, I think I remember that this method was at one time not supported by uPortal but has been supported in more recent releases.

Second, you can define a Person Attribute (in uPortal) that contains the username, configure your portlet.xml (in your portlet app) to declare that you're interested in this attribute, then access it using the PortletRequest.getAttribute(PortletRequest.USER_INFO) API.

drew wills

Eric Dalquist wrote:
Yes you can, but only for portlets that are running in the uPortal webapp. Part of the API used for this ended up having to change since the RC3 release so I'll include instructions for both.

In the RC3 release and earlier:
-Use the PortletContainerUtils static service to get the portal's HttpServletRequest from the PortletRequest -Inject the IPersonManager (personManager bean name) into your class and use it to get the IPerson for the portal's HttpServletRequest

In 3.0 code from today on:
-Inject the IPortalRequestUtils (portalRequestUtils bean name) into your class and use it to get the portal's HttpServletRequest from the PortletRequest -Inject the IPersonManager (personManager bean name) into your class and use it to get the IPerson for the portal's HttpServletRequest


The change that happened today was refactoring PortletContainerUtils from a static service to a managed bean. The methods are exactly the same. Here is the related changeset:
http://developer.ja-sig.org/source/changelog/jasigsvn/uPortal/trunk?cs=43524

-Eric

Thomas S. Pangborn wrote:
Is there a way to capture or determine what the current IPerson is for a given portlet? i.e. Can I determine the user who is actually running the current portlet?

Thomas
--


Join your friends and colleagues at JA-SIG 2008 - "Higher Education Solutions: The Community Source Way!" April 27th - 30th, 2008 in St. Paul, Minnesota USA


Featuring CAS, DSpace, Fedora, Fluid, Internet2, Kuali, Sakai, uPortal, and more! Information/Registration at: http://www.ja-sig.org/conferences/08spring/index.html


Subscribe to the conference blog, The Community Source Way http://jasig2008.blogspot.com <http://jasig2008.blogspot.com/>, for news and updates about the event.


Join the Conference networking site at http://ja-sigspring08.crowdvine.com/


You are currently subscribed to [email protected] as: [EMAIL 
PROTECTED]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/uportal-dev

--
Andrew Wills
UNICON, Inc.
Office:  (480) 558-2476
http://code.google.com/p/cernunnos/

--
Join your friends and colleagues at JA-SIG 2008 - "Higher Education Solutions: The 
Community Source Way!"
April 27th - 30th, 2008 in St. Paul, Minnesota USA

Featuring CAS, DSpace, Fedora, Fluid, Internet2, Kuali, Sakai, uPortal, and 
more!
Information/Registration at: 
http://www.ja-sig.org/conferences/08spring/index.html

Subscribe to the conference blog, The Community Source Way
http://jasig2008.blogspot.com, for news and updates about the  event.

Join the Conference networking site at http://ja-sigspring08.crowdvine.com/

You are currently subscribed to [email protected] as: [EMAIL 
PROTECTED]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/uportal-dev

Reply via email to