Foren

hide a portlet if the user not logged in

bo li, geändert vor 11 Jahren.

hide a portlet if the user not logged in

Junior Member Beiträge: 38 Beitrittsdatum: 14.11.11 Neueste Beiträge
how to make a portlet not showing on the page, if the user has not logged in, same as the behavior of web content display portlet..


thanks!
thumbnail
Mitesh S Panchal, geändert vor 11 Jahren.

RE: hide a portlet if the user not logged in

New Member Beiträge: 20 Beitrittsdatum: 10.12.08 Neueste Beiträge
Hi

Simple thing is to assign permission such a way that only logged in user can see this portlet.

Thanks
Mitesh
bo li, geändert vor 11 Jahren.

RE: hide a portlet if the user not logged in

Junior Member Beiträge: 38 Beitrittsdatum: 14.11.11 Neueste Beiträge
Could you give me the details about how to configure it this way? I think there is no way to make configuration for a logged in user, cuz it is not a role or something.
thumbnail
David H Nebinger, geändert vor 11 Jahren.

RE: hide a portlet if the user not logged in

Liferay Legend Beiträge: 14914 Beitrittsdatum: 02.09.06 Neueste Beiträge
Click on the wrench, choose Configuration, then Permissions, and uncheck the Guest's View permission.
bo li, geändert vor 11 Jahren.

RE: hide a portlet if the user not logged in

Junior Member Beiträge: 38 Beitrittsdatum: 14.11.11 Neueste Beiträge
thanks for your help, this is not what I want.

If I configured it this way, when a user logged in, with a guest role, he also can not see the portlet.

The separation line is "logged in" or "not logged in".
thumbnail
Mitesh S Panchal, geändert vor 11 Jahren.

RE: hide a portlet if the user not logged in

New Member Beiträge: 20 Beitrittsdatum: 10.12.08 Neueste Beiträge
Hi

Can you configure your liferay instance to add all user as a community member ( can be done via control panel) ? this way user who are not logged in they have guest role and user who are logged in they have community role.
will that work for you?

other wise you need to update portlet to defect the logged vs not logged in and put similar code as web content display to hide portlet. you can find code snippet in web content display portlet src.

Thanks
Mitesh
bo li, geändert vor 11 Jahren.

RE: hide a portlet if the user not logged in

Junior Member Beiträge: 38 Beitrittsdatum: 14.11.11 Neueste Beiträge
first solution should be working, I have used this approach earlier for another requirement.

I have found the code for achieving the same behavior as web content display.
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.FALSE);

Thanks for your help!