留言板

How to Restrict portlets based on the roles ?

thumbnail
Dinesh Balaji,修改在12 年前。

How to Restrict portlets based on the roles ?

Junior Member 帖子: 51 加入日期: 10-10-6 最近的帖子
Dear All,

I have developed a portlet which should be visibile to one particular role.

In Portal-ext I have added this portlet- default.user.private.layout.column-1=quickfind_WAR_QuickFindportlet and this is coming in all private pages.

To restrict the same I tried restricting by liferay-portal.xml where I can given only
<role-mapper>
<role-name>customer</role-name>
<role-link>Customer</role-link>
</role-mapper>

and I have chnaged also the portlet.xml also. But still I am not able to restrict the same. Already questions are raised on this but no reply were there - http://www.liferay.com/community/forums/-/message_boards/message/8338186

Kinldy help.

Warm Regards,
Dinesh V
thumbnail
Tomáš Polešovský,修改在12 年前。

RE: How to Restrict portlets based on the roles ?

Liferay Master 帖子: 676 加入日期: 09-2-13 最近的帖子
Dinesh,

I think there must be bug in the portal. I can define it but just for the first time. This means:
1, I created regular role named Customer
2, In liferay-portlet.xml I defined
	<role-mapper>
		<role-name>customer</role-name>
		<role-link>Customer</role-link>
	</role-mapper>

3, In portlet.xml I defined
 		<security-role-ref>
			<role-name>customer</role-name>
		</security-role-ref>


When I deploy my portlet for the first time, everything works as expected. But for the 2nd time, when I change anything (add another security-role-ref), my changes are not published into DB.

If you can't delete rows in your DB then try to rename your portlet (portlet name or war file name=project name).

I've found LPS-8955 that describes this behaviour.