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.

Window State Usage

The windowState attribute is used to control how the Liferay Portal Permissions UI should be displayed (typically in an <iframe> dialog). Valid values include: maximized, pop_up, and exclusive. The default value is maximized.
https://www.liferayfaces.org:443/zh/portal-showcase?p_p_id=com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet&p_p_lifecycle=0&p_p_state=pop_up&_com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet_mvcPath=%2Fedit_permissions.jsp&_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

源代码

<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">

	<portal:permissionsURL resourcePrimKey="#{permissionsURLModelBean.portletResourcePrimaryKey}" windowState="pop_up"
		var="permissionsURL" />
	<pre>#{permissionsURL}</pre>
	<h:panelGroup rendered="#{liferay.userHasPortletPermission['PERMISSIONS']}">
		<h:outputScript>
			AUI().use('liferay-util-window', function(A) {
				Liferay.component('permissionsPopUp', Liferay.Util.Window.getWindow({
					dialog: {
						centered: true,
						constrain2view: true,
						resizable: false,
						visible: false,
						render: true
					}
				}).plug(A.Plugin.DialogIframe, {
					autoLoad: true,
					iframeCssClass: 'dialog-iframe',
					uri:'#{permissionsURL}'
				}));
			});
		</h:outputScript>
		<button onclick="Liferay.component('permissionsPopUp').show();">#{i18n['permissions']}</button>
	</h:panelGroup>

</ui:composition>
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