Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent users from deleting a liferay portlet?

Tags:

liferay

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?

like image 658
Nacho Avatar asked Feb 27 '23 13:02

Nacho


1 Answers

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.

like image 184
Gerhard Dinhof Avatar answered May 09 '23 17:05

Gerhard Dinhof