Actions
GenericSetup can export the actions that are set up in each of the action providers. When you export the actions step then you will be given an actions.xml file. Here is an excerpt from the actions.xml file.
<?xml version="1.0"?>
<object name="portal_actions" meta_type="Plone Actions Tool"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<action-provider name="portal_workflow"/>
<action-provider name="portal_types"/>
<action-provider name="portal_actions"/>
<object name="document_actions" meta_type="CMF Action Category">
<object name="print" meta_type="CMF Action" i18n:domain="plone">
<property name="title" i18n:translate="">Print this</property>
<property name="description" i18n:translate=""></property>
<property name="url_expr">string:javascript:this.print();</property>
<property name="icon_expr">string:$portal_url/print_icon.png</property>
<property name="available_expr"></property>
<property name="permissions">
<element value="View"/>
</property>
<property name="visible">True</property>
</object>
<!-- more actions here -->
</object>
</object>
Here we can see that there are three different things being defined here. First is the list of action providers as defined in the portal_actions tool. Each action-provider element provides the name of the tool or object that provides the actions. In the following example the types tool is being set up.
<action-provider name="portal_types"/>
The next element that you see is the document_actions. This is an action category in the portal_actions tool. Each action category is a folder of actions. You can see that the category is defined as follows.
<object name="document_actions" meta_type="CMF Action Category">
<!-- contained actions here -->
</object>
Action Objects
Inside the action category are the actions. In our example above we were looking at the print action. Here is the action.
<object name="print" meta_type="CMF Action" i18n:domain="plone">
<property name="title" i18n:translate="">Print this</property>
<property name="description" i18n:translate=""></property>
<property name="url_expr">string:javascript:this.print();</property>
<property name="icon_expr">string:$portal_url/print_icon.png</property>
<property name="available_expr"></property>
<property name="permissions">
<element value="View"/>
</property>
<property name="visible">True</property>
</object>
The object element has a name of print, this is the id of the action. We know that this object is an action because its meta_type is CMF Action. Inside of the action object we can see the properties for that action. These correspond to the form that we see in the ZMI.
Each property consists of the name and the value inside the element. Let's say we wanted to add a description to the print action. We would modify the description property as follows.
<property name="description">Print the current page</property>
Permissions
The permissions property accepts multiple elements. If you want multiple permissions you could add multiple elements to the permissions property as follows.
<property name="permissions">
<element name="Modify portal content"/>
<element name="Manage portal"/>
</property>
The name of each element is the name of the permission as seen on the security tab or on the action form in the ZMI. Of course, the easiest way to modify these settings is to change them in the ZMI and then export. This way there is no guess work involved.
Visible
The visible property is a boolean. This means it has a slightly different syntax. If you want the action to show up then you would set it to True.
<property name="visible">True</property>
And of course, if you want to hide it then you would set the value to False.
<property name="visible">False</property>
Please note that hiding an action affects only the UI and won't disable it. It will still be accessible using the associated URL.
Removing Action Objects
You can remove actions and action categories via the actions.xml. First let's see how to remove a particular action. In the following example we will remove the print action.
<object name="print" remove="True"/>
Since we are removing the action, all we need to do is define the name and add the remove attribute. Here is what our actions.xml would look like if we were to remove that action.
<?xml version="1.0"?>
<object name="portal_actions">
<object name="document_actions">
<object name="print" remove="True"/>
</object>
</object>
We could do the same for the whole category with the following.
<?xml version="1.0"?>
<object name="portal_actions">
<object name="document_actions" remove="True"/>
</object>

Author: