问题
How can i define custom permisssion to custom portlet for specific user in liferay I used enviroment liferay 6.1.2 ga3 with jboss In my custom portlet deploy/undeploy button but how can i give specific permission to that only admin person can access that function any other can not use that
check this link http://i.imgur.com/Qwfbg2H.png
Can you please elaborate.
I also check this link for reference
and in jsp page for rendering all the datagrid data render through jeasyui and rest API
Removing Custom Permissions/Actions from a Portlet http://liferayzone.wordpress.com/2013/09/01/liferay-permission-on-custom-portlet/
回答1:
Liferay allows assigning permissions to roles only, you just cannot do it for single users. You have either define a new role or implement this functionality on your own (not using Liferay's permission system).
Just in case if you would come up with this idea, avoid using creating roles for every user - it is a performance killer. People sometimes try do do this in order to get around the limitations of Liferay's permission system - it is a very bad idea!
回答2:
This tutorial can help you:
- You need to create a resource-action-mapping XML file, and add a new action-key (plain string)
- Put it into /src/main/resources/resource-action (name it as default.xml)
- Create a portlet.properties file under /src/main/resources
- Add the following line:
resource.actions.configs=resource-actions/default.xml
Deploy your portlet, and check your new permission under Roles -> Select role -> Define permissions tab
You can check the user permissions with the permissionChecker on your JSP
- You need this import:
<%@ taglib prefix="theme" uri="http://liferay.com/tld/theme" %>
- Define objects:
<theme:defineObjects />
Now you can use the permissionchecker object:
permissionChecker.hasPermission(scopeGroupId, portletName, scopeGroupId, permissionName)
来源:https://stackoverflow.com/questions/24840274/custom-permission-to-custom-portlet-on-specific-user-in-liferay