You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Pham Tuan Minh <ph...@yahoo.com> on 2006/01/16 12:52:44 UTC

How to update user infomation ?

Hi,
When a user registers with portal, he provides some information such as phone number, email address,...
I'd like to update these information.

There were some code lines which I wrote
__________
import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.UserManager;
import java.util.prefs.Preferences;
//.....

public void doView(javax.portlet.RenderRequest request,
                     javax.portlet.RenderResponse response) throws javax.
      portlet.PortletException,
      java.io.IOException {
//.......
UserManager userManager = (UserManager) getPortletContext().getAttribute(
        CommonPortletServices.CPS_USER_MANAGER_COMPONENT);
 User user = userManager.getUser("minhpt");

Map userInfo = new HashMap();
userInfo.put("user.email", "Pham_Tuan_Minh@yahoo.com");

user.setPreferences( (Preferences) userInfo);
//......
}
_______________

When I run the portlet, userManager = null.
What is the wrong ?
How to update user infomation ? Which functions must I use ? 

Please, help me. Thanks.


		
---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

Re: How to update user infomation ?

Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od David Sean Taylor z 2006-01-16 20:35 brzmiala:

> In your portlet application war, add a jetspeed-portlet.xml.
Indeed, my problems with UserManager (and other services) access came 
from jetspeed-portlet.xml file. However, it *was* in WEB-INF of my 
webapp, but during the deployment it was not "caught" by Jetspeed (it 
didn't contain any "extra" bytes, I've checked it with some hexadecimal 
editor). A few redeployments and Tomcat restarts helped. It seems to me 
that Jetspeed metadata from jetspeed-portlet.xml is cached somehow. Is 
it right, or it is updated at every deployment?

-- 
pozdrawiam,
     Jacek Wislicki

jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: How to update user infomation ?

Posted by David Sean Taylor <da...@bluesunrise.com>.
Pham Tuan Minh wrote:
> 
> When I run the portlet, userManager = null.
> What is the wrong ?
> How to update user infomation ? Which functions must I use ? 
> 
In your portlet application war, add a jetspeed-portlet.xml.
Here is an example from the j2-admin portlet application:

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app id="j2-admin" version="1.0"
     xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
     xmlns:js="http://portals.apache.org/jetspeed"
     xmlns:dc="http://www.purl.org/dc">

....
	<js:services>
         <js:service name='ApplicationServerManager'/>
         <js:service name='DeploymentManager'/>
		<js:service name='EntityAccessor'/>
         <js:service name='GroupManager'/>
         <js:service name='PageManager'/>
         <js:service name='PermissionManager'/>
         <js:service name='PortalAdministration'/>
         <js:service name='PortletFactory'/>
         <js:service name='PortalAdministration'/>
         <js:service name='PortletRegistryComponent'/>
         <js:service name='PortalStatistics'/>
         <js:service name="Profiler" />
         <js:service name='RoleManager'/>
	    <js:service name='SearchComponent'/>
         <js:service name="SSO" />
         <js:service name='UserManager'/>
	</js:services>

</portlet-app>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: How to update user infomation ?

Posted by Jacek Wiślicki <ja...@gmail.com>.
Wiadomosc od Pham Tuan Minh z 2006-01-16 12:52 brzmiala:

> When I run the portlet, userManager = null.
> What is the wrong ?
I've also noticed this when I try to get a UserManager instance outside 
the jetspeed context (Jetspeed 2 FINAL).

> How to update user infomation ? Which functions must I use ? 
As for the preferences, you should rather use "getPreferences()" and 
"setPreferences(Preferences)" methods in User class. But I'm not sure if 
JS2-339 issue has already been solved.

-- 
pozdrawiam,
     Jacek Wislicki

jacek.wislicki@gmail.com
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org