I am trying to add permissions to a Liferay-Portlet based on the documentation of Liferay. Since the Portlet will be delivered in a war-package, I want to mantain the permission definition of the portlets inside the portlet itself.
I created a file resource-actions.xml with the following content (portlet-name is identical to the name specified in portlet.xml and liferay-*.xml):
<?xml version="1.0"?>
<resource-action-mapping>
<portlet-resource>
&l开发者_开发百科t;portlet-name>test-portlet</portlet-name>
<supports>
<action-key>SELECT</action-key>
<action-key>VIEW</action-key>
<action-key>TEST_PERM</action-key>
</supports>
<community-defaults>
<action-key>VIEW</action-key>
</community-defaults>
<guest-defaults>
<action-key>VIEW</action-key>
</guest-defaults>
</portlet-resource>
There is no model-resource defined, because first I just want to see, if Liferay loads the permissions I set in the mapping file.
I placed the file in the folders - WEB-INF - WEB-INF/classes - inside the portal-impl.jar of Liferay - ...
But the new permission TEST_PERM does not show up under Control Panel -> Roles -> Define Permissions -> Add Portlet Permissions -> test-portlet. Does anybody know, what I am doing wrong here?
I posted this question in the offical Liferay forum and got a nice reply:
I've faced this before and placed resource file in \WEB-INF\classes\resource-actions my resource-actions.zip is attached. hope it helps
UPDATE:
Link to the Liferay-Forum: Where to place resource-action-mapping in Liferay-Portlet?
精彩评论