留言板

Remove Portlet Programmatically - Permissions problems?

Marco Lalla,修改在8 年前。

Remove Portlet Programmatically - Permissions problems?

Junior Member 帖子: 25 加入日期: 09-11-19 最近的帖子
Request:
Any users may add and remove (from their private home page) some web content display portlets - programmatically - from a custom portlet.
The code is ok, Administrator can add and remove portlets.

PortletID= 56 (Web Content Viewer)
Liferay: 6.1.2-ga3

Permissions:
Web Content Display: View
Web Content Display: Add to page

When I try to execute the same code with any other user: I can add portlet but I cannot remove it.

The only way to remove portlet from private home page (I've found) is: give the permission "update page" to the user (role), but in this case the user can remove all portlet from page and can move any portlet in the page layout (it's not requested).

I haven't exceptions when I execute the code (with a non admin user) to remove the portlets from page.

It's strange: the user can add the portlet but cannot remove it... But the user it's the owner of the page (home private page)..

Ideas?
thumbnail
Denis Signoretto,修改在8 年前。

RE: Remove Portlet Programmatically - Permissions problems?

Expert 帖子: 375 加入日期: 09-4-21 最近的帖子
Have you already considered to leverage Page Customization Settings ?
Marco Lalla,修改在8 年前。

RE: Remove Portlet Programmatically - Permissions problems?

Junior Member 帖子: 25 加入日期: 09-11-19 最近的帖子
Hi Denis
thank you for the reply!

I considered this possibility (I'm on LR 6.1), and the functionality "customization" is perfect to achieve my goals, but I have to develop custom solution to add/remove portlets from a specific page "user home page", from another page "user admin page".

A workaround is give update permission to any user and hide/remove programmatically "Drop zone and portlet menu" from "user home page".

But I've another problem, this page "user home page" is associated to a site template and when the user add/remove portlet, the page may lose the propagation changes from the site template...
thumbnail
Denis Signoretto,修改在8 年前。

RE: Remove Portlet Programmatically - Permissions problems?

Expert 帖子: 375 加入日期: 09-4-21 最近的帖子
A solution could be adding a custom portlet in the user template page that includes programmatically other portlets, e.g. using

<liferay-portlet:runtime portletname="<portlet-id>"></liferay-portlet:runtime>
Marco Lalla,修改在8 年前。

RE: Remove Portlet Programmatically - Permissions problems?

Junior Member 帖子: 25 加入日期: 09-11-19 最近的帖子
Cool!

I'm trying

Many thanks