How to prevent users from deleting a liferay portlet?

爷,独闯天下 提交于 2019-12-21 05:13:14

问题


I have an IFrame portlet in a liferay page. I want some quick fix to prevent logged in users from deleting that portlet. It can be done via user roles, css, code, or whatever. Is this possible?


回答1:


I would suggest modifying your themes portlet.vm template. It's pretty straight forward, if you take a quick look at the sevencogs theme:

#if ($portlet_display.isShowBackIcon())
    <a href="$portlet_back_url" class="portlet-icon-back">#language ("return-to-full-page")</a>
#else
    $theme.iconOptions()
    $theme.iconMinimize()
    $theme.iconMaximize()
    $theme.iconClose()
#end

Just remove $theme.iconClose() and your users won't be able to close/remove portlets anymore. Note that this applies to all portlets (since its a template).

If you'd like to deactivate the close button for some portlets only, I would simply do it by CSS. Do a display: none on the class .portlet-close-icon which is inherited by the div holding the iFrame. In particular

.portlet-iframe .portlet-close-icon {
     display: none;
}

will do the job for the liferay iFrame portlet.




回答2:


You always can do that:

    $theme.iconMinimize()
    $theme.iconMaximize()               
#if ($permissionChecker.isOmniadmin())
    $theme.iconClose()
#end    


来源:https://stackoverflow.com/questions/2290486/how-to-prevent-users-from-deleting-a-liferay-portlet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!