Custom permission to custom portlet on specific user in liferay

笑着哭i 提交于 2020-01-06 02:50:13

问题


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:

  1. You need to create a resource-action-mapping XML file, and add a new action-key (plain string)
  2. Put it into /src/main/resources/resource-action (name it as default.xml)
  3. Create a portlet.properties file under /src/main/resources
  4. 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

  1. You need this import: <%@ taglib prefix="theme" uri="http://liferay.com/tld/theme" %>
  2. Define objects: <theme:defineObjects />
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!