This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. Overwrite Liferay Portlet Permissions
Table of Contents [-]
There are times when you want to change the default and available permissions of Liferay portlets. The default permissions are found in the configuration screen -> permissions tab for each Liferay portlet and their respective modules. For example you can set the permissions for the Document Library Portlet at large, and also at the Folder and File level. This document will help you overwrite Liferay portlet permissions files without touching the source code.
Disclaimer: This document will only help you change what you see in the configuration screen and permissions tabs. This document will NOT implement permissions for you. If you want to implement custom permissions, you can use this document in conjunction with [http://content.liferay.com/4.0.0/docs/developers/ch07.html]
For a more up to date explanation of permissions read http://www.liferay.com/web/jshum/blog/-/blogs/permissionchecker-explained
Key Concept#
The permissions for all portlets are held inside /resource-actions/$portletname.xml files, so the goal would be to overwrite the $portletname.xml resource-actions file. Since there is a lot of mapping inside Liferay code, we need to include the files that map up to $portletname.xml.
Overwrite#
In the Source Code, there are 3 files and some related code lines to pay attention to:
- portal-ejb/classes/portal.properties
- resource.actions.configs=resource-actions/default.xml
- portal-ejb/classes/resource-actions/default.xml
- <resource-action-mapping>
- <resource file="resource-actions/$portletname.xml" />
- </resource-action-mapping>
- portal-ejb/classes/resource-actions/$portletname.xml
Notice how the files map to each other! In order to overwrite $portletname.xml we need to duplicate this structure and mapping in the EXT environment.
Create or modify these 3 files:
- ext-ejb/classes/portal-ext.properties
- resource.actions.configs=resource-actions/default.xml,resource-actions/default-ext.xml
- ext-ejb/classes/resource-actions/default-ext.xml
- <resource-action-mapping>
- <resource file="resource-actions/$portletname.xml" />
- </resource-action-mapping>
- ext-ejb/classes/resource-actions/$portletname.xml
Note: If you are not using an extension environment but modifying an existing installation of Liferay just create those files and put them in the application classpath.