Add a new role in the sharing tab for Plone 3

If you want to display a new role in the sharing tabe of Plone 3 it requires a
good knowledge of ZCA. First you need to create another specific role then an
utility. These complexity allows you to control which roles are displayed
using workflows.

Lets take the example of the well known Manager role.

Create the delegating role

First you have to define a new role. The auto defined convention said that it
should be named as Sharing page: Delegate XXX role. As often you need to
register this new role both in Python and ZCML:

# -*- coding: utf-8 -*-
from Products.CMFCore.permissions import setDefaultRoles
from AccessControl import ModuleSecurityInfo

security = ModuleSecurityInfo("my.egg.permissions")

DelegateManagerRole = "Sharing page: Delegate Manager role"
setDefaultRoles(DelegateManagerRole, ('Manager',))


<configure xmlns=""

    <!-- Our custom permissions -->
        title="Sharing page: Delegate Manager role"


Create your Role utility

Now you have a delagating role to control how to share your role you need to
create an utility that implements the ISharingPageRole interface. This
interface requires two attributes:

  • title: a translated title
  • required_permission: the permission defined just before

# -*- coding: utf-8 -*-
from zope.interface import implements
from import ISharingPageRole

from my.egg import permissions
from my.egg import MyEggMessageFactory as _

class ManagerRole(object):

    title = _(u"title_can_manage", default=u"Can manage")
    required_permission = permissions.DelegateManagerRole

At last we have to register this utility and the permissions.zcml defined


<include file="permissions.zcml" />

  <!-- Local roles managed in the @@sharing view -->

By default the sharing tab hide Manager, Owner and Member role
because they can create troubles when they are used in a wrong way. If you
think to show them be sure that persons that will use it are informed how they
can put their site upside down.


One Response to Add a new role in the sharing tab for Plone 3

  1. If you install collective.sharingroles (or Plone 4, where this is part of, you can achieve the same thing with GenericSetup, which should be a lot easier.

%d blogueurs aiment cette page :