Laliwala IT Services

Laliwala IT Services
Website Development

Monday, February 21, 2011

PortletPreferences Not User Specific, portlet preferences, store portlet, liferay data, user logs, diffrent portlet, different users, different pages

Jay Johnson : PortletPreferences Not User Specific





Hello All,





I'm using the PortletPreferences to store some user specific attributes. Once a user is authenticated, the following block of code gets executed:













The preference is getting saved but unfortunately the same value is always returned for "userattribute", even though a different user is authenticated. Looking at the portletpreferences table, I do see the row containing the preference but the ownerid is always set to "0".








I am using Liferay 5.2.3.








Any help would be appreciated.








Thanks,

J}



Sandeep Nair : Just write an SOP(System.out.println()) before saving the preference. This is just to confirm whether you are actually saving the value or not.













Regards,

Sandeep



Jay Johnson : Thanks, I did add some logging statements and I can confirm that the values are being saved, just not per user. I can also view the row in the PortletPreferences table, but for some reason the ownerid for that row is always set to "0".






Mazhar Anwar : Hi Jay,





I don't think it is possible to store diffrent portlet preferences for different users. Same portlet may have different preferences on different pages.





Can you clarify more on your requirement?





Regards,

Mazhar



Jay Johnson : Basically, I would like to use the PortletPreferences to store portlet data that is private for each user. As an example, if a user has selected an item from a list in the portlet, I would like to persist the selection as a preference and then auto-select that item the next time the user logs in.








So does Liferay not allow for private preference attributes?



Mazhar Anwar : I am not sure, May be somebody from Liferay can answer this question.emoticon






Shagul Khajamohideen : The preferences are stored per portlet (instance). Based on where the portlet instance is located and who can edit the portlet, you can control the preferences.





What you are looking for is, just have some communities or pages and all logged in users can edit the portlet and the preference stored are just for that user.








You could get a personalized behavior that you are looking for by providing users with a "My Community" that they can add portlets to and edit/manage them.





It is possible that different vendors interpret the specifications differently.





-Shagul






Tarkan Corak : I think Jay`s right. Portlet preferences should be user specific. That's the reason why there is a"Configuration" page (for global portlet configuration) and (optionally) a "Preferences" page (for user settings). The link above describes how IBM WebSphere Portal (and also Liferay Portal?) takes the JSR spec.





Tarkan



relax sun : Hello,


see the Rutvij's Odyssey blog








http://rutvijshah.wordpress.com/tag/portletpreferences/
-----------------------------------------------------












-----------------------------------------








liferay hide portlet

No comments:

Post a Comment