Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
bo li
hide a portlet if the user not logged in
2. Januar 2013 08:14
Antwort

bo li

Rang: Junior Member

Nachrichten: 34

Eintrittsdatum: 14. November 2011

Neue 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!
Mitesh S Panchal
RE: hide a portlet if the user not logged in
2. Januar 2013 08:37
Antwort

Mitesh S Panchal

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 10. Dezember 2008

Neue 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
RE: hide a portlet if the user not logged in
2. Januar 2013 08:40
Antwort

bo li

Rang: Junior Member

Nachrichten: 34

Eintrittsdatum: 14. November 2011

Neue 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.
David H Nebinger
RE: hide a portlet if the user not logged in
2. Januar 2013 09:05
Antwort

David H Nebinger

Rang: Liferay Legend

Nachrichten: 6270

Eintrittsdatum: 1. September 2006

Neue Beiträge

Click on the wrench, choose Configuration, then Permissions, and uncheck the Guest's View permission.
bo li
RE: hide a portlet if the user not logged in
2. Januar 2013 09:14
Antwort

bo li

Rang: Junior Member

Nachrichten: 34

Eintrittsdatum: 14. November 2011

Neue 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".
Mitesh S Panchal
RE: hide a portlet if the user not logged in
2. Januar 2013 14:36
Antwort

Mitesh S Panchal

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 10. Dezember 2008

Neue 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
RE: hide a portlet if the user not logged in
2. Januar 2013 14:40
Antwort

bo li

Rang: Junior Member

Nachrichten: 34

Eintrittsdatum: 14. November 2011

Neue 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!