Foros de discusión
Check Permssions for own Portlet
Jan Bub, modificado hace 13 años.
Check Permssions for own Portlet
Junior Member Mensajes: 78 Fecha de incorporación: 2/03/11 Mensajes recientes
Hey. I have a problem with my permissions in my Portlet.
I definded Portlet Action in my resource.xml:
When I try to check in my jsp like it is descipted in the wiki, I get 2 problems.
1. Actionkeys and Portletkeys not contains the values for my portlet. Wich values I have to define here?
2. I got always the error message: "Cannot make a static reference to the non-static method"
Do i have to use the PortletPermissionUtil.
I have tried it with this code:
It works, but is it the right liferay way?
I definded Portlet Action in my resource.xml:
<portlet-resource>
<portlet-name>ebookportlet</portlet-name>
<permissions>
<supports>
<action-key>ADD_BOOK</action-key>
<action-key>VIEW</action-key>
</supports>
<community-defaults>
<action-key>ADD_BOOK</action-key>
<action-key>VIEW</action-key>
</community-defaults>
<guest-defaults>
<action-key>VIEW</action-key>
</guest-defaults>
<guest-unsupported>
<action-key>ADD_BOOK</action-key>
</guest-unsupported>
</permissions>
</portlet-resource> ...
When I try to check in my jsp like it is descipted in the wiki, I get 2 problems.
<%
boolean test = PortletPermission.contains(permissionChecker, plid, [b]Portletkeys.???[/b] , [b]Actionkeys.???[/b]);
%>
1. Actionkeys and Portletkeys not contains the values for my portlet. Wich values I have to define here?
2. I got always the error message: "Cannot make a static reference to the non-static method"
Do i have to use the PortletPermissionUtil.
I have tried it with this code:
PortletPermissionUtil.getPortletPermission().contains(permissionChecker, plid, themeDisplay.getPortletDisplay().getId()
, \"ADD_BOOK\")
It works, but is it the right liferay way?
Thiago Leão Moreira, modificado hace 13 años.
RE: Check Permssions for own Portlet (Respuesta)
Liferay Legend Mensajes: 1449 Fecha de incorporación: 10/10/07 Mensajes recientes
Usually we use the PortletId statically instead of themeDisplay.getPortletDisplay().getId(). Like ebookportlet_WAR_libraryportlet.