How to prevent users from removing the liferay portlet?

I have an IFrame portlet on the liferay page. I want a quick fix to prevent users from uninstalling this portlet. This can be done through user roles, css, code, or something else. Is it possible?

+4
source share
2 answers

I would suggest changing the portlet.vm theme portlet.vm . This is pretty straight forward if you 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 will no longer be able to close / delete portlets. Note that this applies to all portlets (with its template).

If you want to disable the close button only for some portlets, I just do it with CSS. Make display: none in the .portlet-close-icon class, which is inherited by the div containing the iFrame. In particular,

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

will complete the task for the iFrame liferay portlet.

+5
source

You can always do this:

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

Source: https://habr.com/ru/post/1301722/


All Articles