Note: Liferay Portal has three types of resources, each having associated permissions:

  1. Portlet Resource: Permissions associated with the UI of the portlet, such as permission to VIEW the portlet.
  2. Top-Level Model Resource: Permissions associated with the database entity itself, such as permission to ADD a row.
  3. Row-Level Model Resource: Permissions associated with individual rows of the database entity, such as permission to UPDATE a row.

portal:permissionsURL

PermissionsURL is a UIOutput component that generates a URL pointing to the Liferay Portal Permissions UI. If the var attribute is present, the component introduces a variable into the EL. Otherwise, the URL is written to the response.

General Usage

Access the Portlet Resource Permissions by specifying the primary key of a portlet via the resourcePrimKey attribute, and optionally specifying roleTypes in order to control which roles are displayed in the Liferay Portal Permissions UI.
https://www.liferayfaces.org:443/ca/portal-showcase?p_p_id=com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet&p_p_lifecycle=0&p_p_state=maximized&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_mvcPath=%2Fedit_permissions.jsp&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_redirect=%2Fca%2Fweb%2Fguest%2Fportal-showcase%2F-%2Fportal-tag%2Fportal%2Fpermissionsurl%2Fgeneral&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_returnToFullPageURL=%2Fca%2Fweb%2Fguest%2Fportal-showcase%2F-%2Fportal-tag%2Fportal%2Fpermissionsurl%2Fgeneral&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_portletConfiguration=true&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_portletResource=1_WAR_comliferayfacesdemoportalshowcaseportlet&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_modelResource=&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_modelResourceDescription=&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_resourceGroupId=20121&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_resourcePrimKey=15_LAYOUT_1_WAR_comliferayfacesdemoportalshowcaseportlet
https://www.liferayfaces.org:443/ca/portal-showcase?p_p_id=com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet&p_p_lifecycle=0&p_p_state=maximized&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_mvcPath=%2Fedit_permissions.jsp&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_redirect=%2Fca%2Fweb%2Fguest%2Fportal-showcase%2F-%2Fportal-tag%2Fportal%2Fpermissionsurl%2Fgeneral&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_returnToFullPageURL=%2Fca%2Fweb%2Fguest%2Fportal-showcase%2F-%2Fportal-tag%2Fportal%2Fpermissionsurl%2Fgeneral&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_portletConfiguration=true&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_portletResource=1_WAR_comliferayfacesdemoportalshowcaseportlet&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_modelResource=&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_modelResourceDescription=&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_resourceGroupId=20121&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_resourcePrimKey=15_LAYOUT_1_WAR_comliferayfacesdemoportalshowcaseportlet&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_roleTypes=1
			

Codi font

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:portal="http://liferay.com/faces/portal" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

	<!-- Example 1: Introducing a var into the EL with default role types (Guest, Owner, Power User, Site Member, User) -->
	<portal:permissionsURL resourcePrimKey="#{permissionsURLModelBean.portletResourcePrimaryKey}" var="permissionsURL1" />
	<pre>#{permissionsURL1}</pre>
	<h:panelGroup rendered="#{liferay.userHasPortletPermission['PERMISSIONS']}">
		<a href="#{permissionsURL1}">#{i18n['permissions']}</a>
	</h:panelGroup>

	<!-- Example 2: Output directly to the response with specific role types (Guest, Owner, Power User, User) -->
	<pre>
		<portal:permissionsURL resourcePrimKey="#{permissionsURLModelBean.portletResourcePrimaryKey}"
			roleTypes="#{permissionsURLModelBean.roleConstants.TYPES_REGULAR}" />
	</pre>
	<portal:permissionsURL resourcePrimKey="#{permissionsURLModelBean.portletResourcePrimaryKey}"
		roleTypes="#{permissionsURLModelBean.roleConstants.TYPES_REGULAR}" var="permissionsURL2" />
	<h:panelGroup rendered="#{liferay.userHasPortletPermission['PERMISSIONS']}">
		<a href="#{permissionsURL2}">#{i18n['permissions']}</a>
	</h:panelGroup>

</ui:composition>
@RequestScoped
@ManagedBean
public class PermissionsURLModelBean {

	// Private Data Members
	private String portletResourcePrimaryKey;
	private Map<String, Object> roleConstants;

	public String getPortletResourcePrimaryKey() {

		if (portletResourcePrimaryKey == null) {
			FacesContext facesContext = FacesContext.getCurrentInstance();
			long plid = LiferayPortletHelperUtil.getPlid(facesContext);
			Portlet portlet = LiferayPortletHelperUtil.getPortlet(facesContext);
			String portletId = portlet.getPortletId();
			portletResourcePrimaryKey = PortletPermissionUtil.getPrimaryKey(plid, portletId);
		}

		return portletResourcePrimaryKey;
	}

	public Map<String, Object> getRoleConstants() {

		if (roleConstants == null) {

			roleConstants = new HashMap<String, Object>();

			Field[] fields = RoleConstants.class.getFields();

			for (Field field : fields) {
				int modifiers = field.getModifiers();

				if (Modifier.isStatic(modifiers)) {

					try {
						roleConstants.put(field.getName(), field.get(null));
					}
					catch (IllegalAccessException e) {
						// ignore
					}
				}

			}
		}

		return roleConstants;
	}
}
Liferay Faces Bridge Implementation 5.0.0 + Liferay Faces Portal 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20