Reputation: 407
I have a Portlet where the Administrator who added the Portlet to the page have to configure it (do some database configurations so the Portlet works) .This is being done in the Preferences(Edit mode) which only the administrator can see. It works good so far, after the administrator is done with the preferences , all users can see the Portlet. I only had one problem : the personal Values of an user where overwritten by other users and so on .. So i found out on Liferay forums how to make a Portlet save its preferences user specific . It works to but If I configure the Portlet as an Administrator then only I can see the working Portlet the other users see only the not configured Portlet. Is there a way to configure the Portlet as Administrator in the Edit Mode so the Portlet works for all users and keep the user specific Portlet preferences feature of Liferay ?
Upvotes: 1
Views: 2519
Reputation: 9295
I think you can do that with liferay's custom "config mode" (the little wrench icon in the title bar of the portlet). Edit-mode can then be used to store user-specific preferences.
Upvotes: 0
Reputation: 15076
You have to understand scope of the preferences.
Either you make them portal wide, which means basically that same instance of PortletPreferences is used for all users,
or you make them user specific and each user has its own instance.
As a result you can't have portion of the preferences set by admin - portal wide and other portion user specific for storing users' data.
You have several choices depending whether you want to change them as an administrator later:
if not then define default values of the preferences in portlet.xml.
if yes then you have to make them portal wide and store users' data somewhere else (e.g. database).
The second solution is better if you need to store larger amount of data because preferences are serialized into XML and stored in one column as a text. E.g. on oracle database you are limited to 4000 characters.
Upvotes: 3