Foros de discusión

hide a portlet if the user not logged in

bo li, modificado hace 11 años.

hide a portlet if the user not logged in

Junior Member Mensajes: 38 Fecha de incorporación: 14/11/11 Mensajes recientes
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, modificado hace 11 años.

RE: hide a portlet if the user not logged in

New Member Mensajes: 20 Fecha de incorporación: 10/12/08 Mensajes recientes
Hi

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

Thanks
Mitesh
bo li, modificado hace 11 años.

RE: hide a portlet if the user not logged in

Junior Member Mensajes: 38 Fecha de incorporación: 14/11/11 Mensajes recientes
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, modificado hace 11 años.

RE: hide a portlet if the user not logged in

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
Click on the wrench, choose Configuration, then Permissions, and uncheck the Guest's View permission.
bo li, modificado hace 11 años.

RE: hide a portlet if the user not logged in

Junior Member Mensajes: 38 Fecha de incorporación: 14/11/11 Mensajes recientes
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, modificado hace 11 años.

RE: hide a portlet if the user not logged in

New Member Mensajes: 20 Fecha de incorporación: 10/12/08 Mensajes recientes
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, modificado hace 11 años.

RE: hide a portlet if the user not logged in

Junior Member Mensajes: 38 Fecha de incorporación: 14/11/11 Mensajes recientes
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!