Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
shahab mahtab
portlet access control by user role
January 12, 2012 7:03 AM
Answer

shahab mahtab

Rank: New Member

Posts: 5

Join Date: December 12, 2011

Recent Posts

Hi:

I would like to grant access to a portlet ("add to page" and "view") based on few custom roles only, which are imported from LDAP.
I have defined the roles in portlet.xml and liferay-portlet.xml of the portlet.

However, it looks like any user can view the portlet. What is the correct way to enforce it?

I have tried adding the permission file (resource-actions\....xml). I can restrict guests from viewing the portlet this way. But, it looks like "resource-action-mapping" DTD does not support custom roles.

Is there a way to enfore role based access control without using the built-in Permissions GUI?

Thanks.
David H Nebinger
RE: portlet access control by user role
January 12, 2012 8:02 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6263

Join Date: September 1, 2006

Recent Posts

Sure...

Drop the portlet on the page, go to the configuration page for the portlet, to the permissions tab, and set the permissions there. Disable guest perms on the portlet, and you should be golden...
shahab mahtab
RE: portlet access control by user role
January 12, 2012 8:37 AM
Answer

shahab mahtab

Rank: New Member

Posts: 5

Join Date: December 12, 2011

Recent Posts

Hi:

Can I configure it from any configuration file other than the "Permissions" tab?

Thanks
Mauro Almeida
RE: portlet access control by user role
May 3, 2012 8:58 AM
Answer

Mauro Almeida

Rank: Junior Member

Posts: 31

Join Date: March 15, 2012

Recent Posts

Hi Shahab.

Did you manage to overcome this?

Best regards,
MJA
Thomas Berg
RE: portlet access control by user role
May 3, 2012 9:09 AM
Answer

Thomas Berg

Rank: Regular Member

Posts: 121

Join Date: September 7, 2009

Recent Posts

Hello Shahab,
You should be able to achieve what you need by reading the information in this thread

HTH

Regards / Thomas
shahab mahtab
RE: portlet access control by user role
May 3, 2012 4:17 PM
Answer

shahab mahtab

Rank: New Member

Posts: 5

Join Date: December 12, 2011

Recent Posts

Hi HTH,

I believe, resource-action-mapping takes some pre-defined roles only (guest, community etc.). I ended up writing a filter to checks user's role, and show appropriate message if user is not authorized.

My use case is slightly different. Users are accessing some pre-configured pages with bunch of portlets, and they can view portlets that they are entitled to. (users' entitlement can change dynamically)

Thanks
Shahab