1
votes

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/

2

2 Answers

2
votes

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!

1
votes

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)