弹出窗口中的liferay portlet问题

时间:2014-06-19 16:27:03

标签: liferay

我在弹出窗口中打开自定义portlet时遇到问题。

以下是打开弹出窗口的代码。

LiferayPortletURL documentLibURL = PortletURLFactoryUtil.create(request, "portlet name with WAR name", themeDisplay.getPlid(), PortletRequest.RENDER_PHASE);   
documentLibURL.setWindowState(LiferayWindowState.POP_UP);   
documentLibURL.setPortletMode(PortletMode.VIEW);

  AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
        var dialog = new A.Dialog({
                width: 800,
                height: 500,
                title: 'Popup Title',
                centered: true,
                draggable: true,
                modal: true
            }).plug(A.Plugin.IO, {uri: '<%= documentLibURL.toString() %>'}).render();

            dialog.show();

      });

当我的portlet没有调用本地服务时,portlet正在弹出窗口中呈现。但在添加一些复杂的代码之后。 Portlet正在给出权限错误。 “您没有访问此portlet所需的角色。”

1)我还在liferay-portlet.xml中添加了true。

2)我已从访客用户为控制面板的视图分配了权限。

如果有任何更改,请告诉我。

提前致谢

3 个答案:

答案 0 :(得分:1)

本地服务调用永远不会生成权限异常(PrincipalException),但会删除服务。

审核此URL将调用的代码,并查看是否有任何删除服务调用。它们很容易区分。例如,如果是User服务,您通过UserLocalServiceUtil调用将永远不会抛出PrincipalException,但会调用UserServiceUtil。检查您正在对*ServiceUtil拨打的电话,并确保执行该操作的用户具有足够的访问权限。

答案 1 :(得分:0)

您使用哪种版本的liferay 该对话框在liferay 6.2中也不起作用,也可能在6.1中,请参考下面的代码。

 function popup(url){

 AUI().ready(function(A) {
    AUI().use('aui-base', function(A) {
        Liferay.Util.Window.getWindow(
            {
                title : "Popup Tile",
                uri: url,
                dialog: {
                    cache: false,
                    modal: true
                }
            }
        ).on('hide', function() {
              console.log("Modal closed")});

    });
});
}

如果它的正确不要忘记将其标记为答案

答案 2 :(得分:0)

只需在portal-ext.properties中添加以下代码并重新启动服务器

layout.show.portlet.access.denied=false
相关问题