留言板
hide portlets if user is not in role
Hubert Felber,修改在14 年前。
hide portlets if user is not in role
Regular Member 帖子: 157 加入日期: 09-11-23 最近的帖子
Hi,
Can I hide portlets, if the user is not in the role to see them?
Before login the user is not allowed to see the portlet content, because he is not in the required roles.
So he sees lots of "Application Portlet is temporarily unavailable!"
How can I control portlet availability/visibility depending on the roles? I want to apply the portlet to all users but only make them visible if the user is in the required role (after login or after having assigned different roles)
Thank you
Hubert
p.s.
Additionally is to say that the logfile is filled with stacktraces because portlet calls methods without the user beeing in the required role.
Can I hide portlets, if the user is not in the role to see them?
Before login the user is not allowed to see the portlet content, because he is not in the required roles.
So he sees lots of "Application Portlet is temporarily unavailable!"
How can I control portlet availability/visibility depending on the roles? I want to apply the portlet to all users but only make them visible if the user is in the required role (after login or after having assigned different roles)
Thank you
Hubert
p.s.
Additionally is to say that the logfile is filled with stacktraces because portlet calls methods without the user beeing in the required role.
Oliver Bayer,修改在14 年前。
RE: hide portlets if user is not in role
Liferay Master 帖子: 894 加入日期: 09-2-18 最近的帖子
Hi Hubert,
you can hide portlets for users who haven't the right roles by using the following property:
Oli
you can hide portlets for users who haven't the right roles by using the following property:
layout.show.portlet.access.denied=false
Oli
Hubert Felber,修改在14 年前。
RE: hide portlets if user is not in role
Regular Member 帖子: 157 加入日期: 09-11-23 最近的帖子
Hi Oliver,
But the portlets are still shown although the user is not in required role.
Configuration:
in web.xml I have
Thank you
Hubert
you can hide portlets for users who haven't the right roles by using the following property:Thank you, but it does not work. I see that this property is applied: com.liferay.portal.model.impl.PortletImpl.isShowPortletAccessDenied() returns false now.layout.show.portlet.access.denied=false
But the portlets are still shown although the user is not in required role.
Configuration:
in web.xml I have
<security-role-ref>
<role-name>workflowAdmin</role-name>
</security-role-ref>
in liferay-portlet.xml I have <role-mapper>
<role-name>workflowAdmin</role-name>
<role-link>Administrator</role-link>
</role-mapper>
Is there anything else I need to configure or do you have any hints what I could check? I would expect that PortletRequestImpl.isUserInRole() is called to check permission, but this is not the case.Thank you
Hubert
Shagul Khaja,修改在14 年前。
RE: hide portlets if user is not in role
Liferay Master 帖子: 758 加入日期: 07-9-27 最近的帖子
Hi Hubert,
You should set the init param in liferay-portlet.xml to false like below.
If you are overriding core portlets then you need to do this in liferay-portlet-ext.xml.
As you can see below in the comments show-portlet-access-denied overrides the settings in properties file.
Best,
Shagul
You should set the init param in liferay-portlet.xml to false like below.
<portlet>
<portlet-name>49</portlet-name>
<icon>/html/icons/default.png</icon>
<struts-path>my_places</struts-path>
<use-default-template>false</use-default-template>
<show-portlet-access-denied>false</show-portlet-access-denied>
<show-portlet-inactive>false</show-portlet-inactive>
<restore-current-view>false</restore-current-view>
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<add-default-resource>true</add-default-resource>
<system>true</system>
</portlet>
If you are overriding core portlets then you need to do this in liferay-portlet-ext.xml.
As you can see below in the comments show-portlet-access-denied overrides the settings in properties file.
#
# Set this to true if users are shown that they do not have access to a
# portlet. The portlet init parameter "show-portlet-access-denied" will
# override this setting.
#
layout.show.portlet.access.denied=true
Best,
Shagul
Hubert Felber,修改在14 年前。
RE: hide portlets if user is not in role
Regular Member 帖子: 157 加入日期: 09-11-23 最近的帖子Shagul Khaja:
You should set the init param in liferay-portlet.xml to false like below.<portlet> <show-portlet-access-denied>false</show-portlet-access-denied> <show-portlet-inactive>false</show-portlet-inactive> </portlet>
Shagul,
Thank you, this did the trick :-)
Hubert
Wilson Man,修改在14 年前。
RE: hide portlets if user is not in role
Liferay Master 帖子: 581 加入日期: 06-6-21 最近的帖子
is this your custom portlet or a liferay portlet? Have you tried setting up the permission in Control Panel?
Hubert Felber,修改在14 年前。
RE: hide portlets if user is not in role
Regular Member 帖子: 157 加入日期: 09-11-23 最近的帖子Wilson Man:
is this your custom portlet or a liferay portlet? Have you tried setting up the permission in Control Panel?Wilson,
They are custom portlets, and yes, setting permission in Control Panel works.
Thank you
Hubert