2013-06-12 97 views

回答

3

在您的控制器創建這個功能,我不知道爲什麼他們不包括通過一些的Liferay的Util功能

public boolean hasUserPermissionForAction(String actionKey){ 

    // where actionKey can be "VIEW", "UPDATE" etc 

    long groupId = themeDisplay.getScopeGroupId(); 

    String name = PortalUtil.getPortletId(request); 
    String primKey = themeDisplay.getLayout().getPlid() + LiferayPortletSession.LAYOUT_SEPARATOR + name; 

    return themeDisplay.getPermissionChecker().hasPermission(groupId, name, primKey, actionKey); 
} 

對於你的情況有類似的功能,使用"VIEW"作爲actionKey參數調用它。

相關問題