How to configure a portlet so that each user their can store his own portlet preferences values?

Viewpoint
Teradata Employee

How to configure a portlet so that each user their can store his own portlet preferences values?

Hello,

We need each VP user to be able to store his very own portlet preferences values
in a custom developed VP portlet .
Like each user needs to configure his own personal database-login in the preferences.

The problem right now is that as soon as user 'A' changes the values of the his own preferences to his own
personal settings, his settings are somehow distributed to all other vp users too.

So next time when user 'B' looks at his preferences settings he will see the personal
preferences settings of user 'A' , instead of his own user 'B' preferences settings.

The problem appeared on a PDK V13.03 test system. The option 'share Portlet' is not activated.

I since I was assuming that it is a standard VP feature
that each user can store his own portlet preferences settings
I did not code any special code that would take care of that.

Maybe it's some kind of configuration issue that we are not aware of.

Can anybody help?

On what level (User, Role, Portlet) can portlet preferences values generally be stored anyway?

Thanks
Marcus
4 REPLIES
Teradata Employee

Re: How to configure a portlet so that each user their can store his own portlet preferences values?

Hello,

Further research showed that the flag in the 'liferay-portlet.xml' file is the cause of the problem. I've set it's value to 'false' to prevent the user from starting the portlet more than once at the same time. This worked fine.
But the downside of setting the flag to false is that when the user changes the preferences values now, he is not only changing his personal preferences settings he is instead changing the preferences settings for every viewpoint user.

Any comments and further explainations on this are very welcome.

regards
Marcus
Teradata Employee

Re: How to configure a portlet so that each user their can store his own portlet preferences values?

It's the 'instanceable' flag. The flag name disaperared above because I've put it in less-than and greater-than symbols.
Teradata Employee

Re: How to configure a portlet so that each user their can store his own portlet preferences values?

If you use ControllerContext.savePreferences(String portletName, Object preferences), this will save the preferences object as instance-level preferences or user-level preferences, depending upon if the "Save as default" option is checked or not. In neither situation will the preferences be saved for all Viewpoint users.
Teradata Employee

Re: How to configure a portlet so that each user their can store his own portlet preferences values?

I'm using the default 'PreferencesController' as it was created by the 'portletGenerator' tool,
which does use the ctx.savePreferences() method.

I've just verified it with a different portlet again today.
If you first set the 'instanceable' flag to 'false' and then redeploy the portlet.
Then after a user changed his preferences values and closed his preferences form then
all his changed values plus his unchanged values can also been seen in the preferences of any other user, seriously!

It seems that with the 'instanceable' flag set to false, all users do share the same set of preferences values. At least on a PDK V13.03 test system.

regards
Marcus