Current

This document is valid for the current version of Plone.

Sharing

by Plone Documentation Team last modified Dec 27, 2009 05:45 PM
Contributors: Mikko Ohtamma, Martin Aspeli, Kamon Ayeva, Israel Saeta Pérez
Info about the sharing tab GenericSetup handler

The GenericSetup handler for the sharing tab, new in Plone 4, allows you to define new local role labels. When you add a new role to your site you may want to assign that role from the sharing tab. The sharing.xml allows us to do this.

The sharing export handler does not export the globally registered utilities. This means that by default there will be no entries in the sharing.xml when it is exported.

As an example, let's say you've added a new role named CopyEditor (see the rolemap reference for more details on adding roles) to your site. This would not be present on the sharing page. To make it show up you would add the following to your sharing.xml.

<?xml version="1.0"?>
<sharing xmlns:i18n="http://xml.zope.org/namespaces/i18n"
         i18n:domain="my.package">
  <role
      id="CopyEditor"
      title="Can edit copy"
      permission="Manage portal"
      i18n:attributes="title"
      />
</sharing>

The sharing.xml file has a container named sharing. Inside of the sharing tag there are role tags. Here is an explanation of what the attributes of the role tag will do.

id
The id is the name of the role that you have defined
title
The title is what will show on the sharing tab to represent this local role
permission
The permission is the Zope permission needed to assign the local role

Modify existing sharing tab entries

You can change existing sharing tab entries by redefining them. All you need to define is the id, then you can change the title and the permission to your liking. In this example we change the title to something funny and probably confusing to the end user. The permission can also be changed, here we changed it to View. If you had access to the sharing page and had the View permission on the item then you could assign the local role.

NOTE: When changing the stock local role entries you are creating a local utility that overrides the globally registered utility.

<?xml version="1.0"?>
<sharing>
  <role
      id="Reviewer"
      title="Content Overlord"
      permission="View"
      />
</sharing>

Removing entries

To remove an entry, just use the remove attribute on a <role /> node:

<role
  remove="True"
  id="Reviewer"
  />