Adding a "Sharing" action-tab to your product/type
First things first - decide which of the following statements is more true for you, and then find the corresponding directions below:
- You are making a Plone product and want your product (or one of the classes/types in your product) to always have a "Sharing" action-tab when it's used
- You just need the "Sharing" action-tab to show up for an item type in a single Plone instance
A. Adding a "Sharing" action-tab to your product/class/type
To accomplish this, you'll need to define a sharing action as part of the 'actions' tuple of your class definition in your Python module (your .py file). First, add the following to the top of your module:
from Products.CMFCore import CMFCorePermissions
Then, if you haven't defined the variable 'actions' for your class yet, add the following to your class (I usually add it just before my function definitions), making sure to indent according to how the rest of your class is indented:
actions = (
{
'id': 'local_roles',
'name': 'Sharing',
'action': 'string:${object_url}/folder_localrole_form',
'permissions': (CMFCorePermissions.ManageProperties)
},
)
If you did already define the variable 'actions', then just add the dictionary (the code from curly brace to curly brace, including curly braces) to your 'actions' definition.
When you've finished editing your file, save your file, upload if needed, and then refresh your product through the ZMI (and you may have to uninstall/reinstall your product in Plone - I'm never sure when I need to do this and when I don't). Still through the ZMI, go to your Plone object, click on portal_types, click on your product/type, and click on the Actions tab. If there is a listing in there with the name 'Sharing', and the settings all look right (matching what you entered), you should be all set.
B. Adding a sharing tab to an item type in a single Plone instance
In the ZMI, click on your Plone object, click on portal_types, click on your item type, and click on the Actions tab. At the bottom of that page, in the 'Add an action' area, fill in the fields with the following data:
Name: Sharing
Id: local_roles
Action: string:${object_url}/folder_localrole_form
Permission: Manage Properties
Category: object
Visible: (check)
Then click Add. If a listing shows up with the name 'Sharing', and the settings all look right (matching what you entered), you should be all set.

Author: