Enable Portlet Management for non-Admins trhough "Sharing"-Action

Hello,

i'm managing a bigger Site with plone and i would like to allow "normal" users to manage portlets (Like Static portlets) on their Subpages.

In the earlier versions i managed this by giving the users edit rights through the "Sharing"-Action, but on Plone 5 this doesn't seem to be working.

Can anyone help me with this?

Yours Sincerly

No idea what worked in former Plone versions (however the Plone access management did not change lately).
Assign or adjust the Portlets: Manage portlets permission through the ZMI (Security tab as needed).

1 Like

@RayMagini That might have been a very old Plone version, because we have custom code in some Plone 4 sites to add a PortletManager role that you can assign to users/groups using the sharing page.

For Plone 4 (not tested yet with/in Plone 5), you can add the following in a policy/add'on project for your site:

profiles/default/rolemap.xml:

<?xml version="1.0"?>
<rolemap>

  <roles>
    <role name="PortletManager"/>
  </roles>

  <permissions>

    <!-- Portlets -->
    <permission name="Portlets: Manage portlets"
                acquire="True">
      <role name="Manager"/>
      <role name="PortletManager"/>
      <role name="Site Administrator"/>
    </permission>
    <permission name="Portlets: Manage own portlets"
                acquire="True">
      <role name="Manager"/>
      <role name="Member"/>
      <role name="PortletManager"/>
      <role name="Site Administrator"/>
    </permission>
    <permission name="plone.portlet.collection: Add collection portlet"
                acquire="True">
      <role name="Manager"/>
      <role name="PortletManager"/>
      <role name="Site Administrator"/>
    </permission>
    <permission name="plone.portlet.static: Add static portlet"
                acquire="True">
      <role name="Manager"/>
      <role name="PortletManager"/>
      <role name="Site Administrator"/>
    </permission>
  </permissions>

</rolemap>

roles.py:

"""Defines and tests a new PortletManager role.

A new PortletManager role is added to plone's default list::

  >>> 'PortletManager' in list(self.portal.__ac_roles__)
  True

"""

from zope.interface import implements
from plone.app.workflow.interfaces import ISharingPageRole

# translation: change this:
from yourpolicypackage import _


class PortletManagerRole(object):
    implements(ISharingPageRole)

    title = _('Can manage portlets')
    required_permission = 'Manage portal'

And in the configure.zcml of your add'on:

  <!-- Extra local roles managed in the @@sharing view -->
  <utility
      name="PortletManager"
      factory=".roles.PortletManagerRole"
      />

And you'd need an upgrade step to update/apply the GenericSetup rolemap.xml. Hope this helps.

1 Like

And assign "plone.portlet.static: Add static portlet" for portlets of type static text.

Yes you are right. I had already forgotten I made this post many years ago, until we discussed portlets during TPN10 and I dug up again the project code for this.

I've created a gist now as well: