Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Vahid M
Show specific portlets to specific users
March 8, 2011 2:30 AM
Answer

Vahid M

Rank: Junior Member

Posts: 26

Join Date: March 27, 2008

Recent Posts

Hi all,
I have a requirement to show a portlet in a page based on a condition. For example, I want a user to see and interact with a portlet only if they have support contracts. On the other hand, they should not see that specific portlet and it should not leave an empty space. My condition might change during time and I want to have full control over it. I know that I must somehow deal with the rendering of a page in Liferay but not sure how to approach this issue. Any help is appreciated

Regards
Ravi Kumar Gupta
RE: Show specific portlets to specific users
March 8, 2011 2:38 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

Try playing with Liferay Roles. Based on roles you can show/hide portlets that you want. Create roles, assign proper permissions to those roles, assign the role to users and so on..

For each portlet you can define which role can view/edit/delete etc.

Thanks and Regards
Ravi Kumar Gupta
Vahid M
RE: Show specific portlets to specific users
March 8, 2011 9:28 PM
Answer

Vahid M

Rank: Junior Member

Posts: 26

Join Date: March 27, 2008

Recent Posts

Thanks a lot, I'll give it a try
Vahid M
RE: Show specific portlets to specific users
March 12, 2011 11:16 PM
Answer

Vahid M

Rank: Junior Member

Posts: 26

Join Date: March 27, 2008

Recent Posts

Ravi Kumar Gupta:

For each portlet you can define which role can view/edit/delete etc.


Hi Ravi Kumar Gupta

I tried what you had suggested. Its working but there is a problem with it. When I defined a role and assigned portlet view permission to it then, the portal showed the portlet with an error message that was indicating the user does not have necessary role to access the portlet. This method prevents any user without the required role to interact with the portlet BUT the portal still is rendering the portlet. I want to prevent the rendering. I don't want the portlet to be shown on the page for some users.

Cheers
Olaf Kock
RE: Show specific portlets to specific users
March 13, 2011 12:16 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 3561

Join Date: September 23, 2008

Recent Posts

portal.properties:

1    #
2    # Set this to true if users are shown that they do not have access to a
3    # portlet. The portlet init parameter "show-portlet-access-denied" will
4    # override this setting.
5    #
6    layout.show.portlet.access.denied=true
Ravi Kumar Gupta
RE: Show specific portlets to specific users
March 13, 2011 6:26 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

By default it will show the message. To avoid that you need to follow as Olaf mentioned..

Thanks and Regards
Ravi Kumar Gupta