| 1 |
<?xml version="1.0"?> |
|---|
| 2 |
|
|---|
| 3 |
<component name="org.nuxeo.ecm.platform.actions.ActionService"> |
|---|
| 4 |
<documentation> |
|---|
| 5 |
The action service provides extension points for pluggable actions and |
|---|
| 6 |
filters. |
|---|
| 7 |
|
|---|
| 8 |
Actions are commands that can be accessed and triggered from the site pages. |
|---|
| 9 |
Their visibility is adapted to the current user and site possibilities using |
|---|
| 10 |
filters. |
|---|
| 11 |
|
|---|
| 12 |
@author Anahide Tchertchian (at@nuxeo.com) |
|---|
| 13 |
</documentation> |
|---|
| 14 |
|
|---|
| 15 |
<implementation class="org.nuxeo.ecm.platform.actions.ActionService" /> |
|---|
| 16 |
|
|---|
| 17 |
<service> |
|---|
| 18 |
<provide interface="org.nuxeo.ecm.platform.actions.ejb.ActionManager" /> |
|---|
| 19 |
</service> |
|---|
| 20 |
|
|---|
| 21 |
<extension-point name="filters"> |
|---|
| 22 |
<documentation> |
|---|
| 23 |
An action filter is a set of rules that will apply - or not - given an |
|---|
| 24 |
action and a context. |
|---|
| 25 |
|
|---|
| 26 |
Filter properties : |
|---|
| 27 |
|
|---|
| 28 |
- id: will be used ot identify the filter from actions definitions. |
|---|
| 29 |
|
|---|
| 30 |
- rules: set of rules composing the filter |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
The default filter implementation uses filter rules with the following |
|---|
| 34 |
properties: |
|---|
| 35 |
|
|---|
| 36 |
- grant: boolean indicating whether this is a granting rule or a denying |
|---|
| 37 |
rule. |
|---|
| 38 |
|
|---|
| 39 |
- permission: permission like "Write" that will be checked on the context |
|---|
| 40 |
for the given user. A rule can hold several permissions: it applies if |
|---|
| 41 |
user holds at least one of them. |
|---|
| 42 |
|
|---|
| 43 |
- facet: facet like "Folderish" that can be set on the document type |
|---|
| 44 |
({@see org.nuxeo.ecm.core.schema.types.Type}) to desribe the document type |
|---|
| 45 |
genral behaviour. A rule can hold several facets: it applies if current |
|---|
| 46 |
document in context has at least one of them. |
|---|
| 47 |
|
|---|
| 48 |
- condition: EL expression that can be evaluated against the context. The |
|---|
| 49 |
seam context is made available for conditions evaluation. A rule can hold |
|---|
| 50 |
several conditions: it applies if at least on of the conditions is |
|---|
| 51 |
verified. |
|---|
| 52 |
|
|---|
| 53 |
- type: document type to check against current document in context. A rule |
|---|
| 54 |
can hold several types: it applies if current document is one of them. The |
|---|
| 55 |
fake 'Server' type is used to check the server context. |
|---|
| 56 |
|
|---|
| 57 |
- schema: document schema to check against current document in context. A |
|---|
| 58 |
rule can hold several schemas: it applies if current document has one of |
|---|
| 59 |
them. |
|---|
| 60 |
|
|---|
| 61 |
A filter is granting access to an action if, among its rules, no denying |
|---|
| 62 |
rule is found and at least one granting rule is found. If no rule is set, |
|---|
| 63 |
it is granted. |
|---|
| 64 |
|
|---|
| 65 |
Custom filters can be defined on the extension point, provided they follow |
|---|
| 66 |
the {@see org.nuxeo.ecm.platform.actions.ActionFilter} interface, using |
|---|
| 67 |
the following syntax: |
|---|
| 68 |
|
|---|
| 69 |
<code> |
|---|
| 70 |
<object class="my.package.MyFilter" /> |
|---|
| 71 |
</code> |
|---|
| 72 |
|
|---|
| 73 |
Example of action filter using default filter implementation: |
|---|
| 74 |
|
|---|
| 75 |
<code> |
|---|
| 76 |
<filter id="theFilter"> |
|---|
| 77 |
<rule grant=""> |
|---|
| 78 |
<permission>Write</permission> |
|---|
| 79 |
<facet>Folderish</facet> |
|---|
| 80 |
<condition>EL condition</condition> |
|---|
| 81 |
<type>Workspace</type> |
|---|
| 82 |
<type>Section</type> |
|---|
| 83 |
</rule> |
|---|
| 84 |
<rule grant="false"> |
|---|
| 85 |
<condition>EL condition 1</condition> |
|---|
| 86 |
<condition>EL condition 2</condition> |
|---|
| 87 |
</rule> |
|---|
| 88 |
</filter> |
|---|
| 89 |
</code> |
|---|
| 90 |
|
|---|
| 91 |
</documentation> |
|---|
| 92 |
<object class="org.nuxeo.ecm.platform.actions.DefaultActionFilter" /> |
|---|
| 93 |
<object class="org.nuxeo.ecm.platform.actions.FilterFactory" /> |
|---|
| 94 |
</extension-point> |
|---|
| 95 |
|
|---|
| 96 |
<extension-point name="actions"> |
|---|
| 97 |
<documentation> |
|---|
| 98 |
An action is defined by the following properties: |
|---|
| 99 |
|
|---|
| 100 |
- id: string identifying the action |
|---|
| 101 |
|
|---|
| 102 |
- label: the action name |
|---|
| 103 |
|
|---|
| 104 |
- link: string representing the command the action will trigger |
|---|
| 105 |
|
|---|
| 106 |
- category: a string useful to group actions that will be rendered in the |
|---|
| 107 |
same area of a page. An action can define several categories. |
|---|
| 108 |
|
|---|
| 109 |
- filter-ids: id of a filter that will be used to control the action |
|---|
| 110 |
visibility. An action can have several filters: it is visible if all its |
|---|
| 111 |
filters grant the access. |
|---|
| 112 |
|
|---|
| 113 |
- filter: a filter definition can be done directly within the action |
|---|
| 114 |
definition. It is a filter like others and can be referred by other |
|---|
| 115 |
actions. |
|---|
| 116 |
|
|---|
| 117 |
- icon: the optional icon path for this action |
|---|
| 118 |
|
|---|
| 119 |
- confirm: an optional javascript confirmation string that can be |
|---|
| 120 |
triggered when executing the command. |
|---|
| 121 |
|
|---|
| 122 |
- enabled: boolean indicating whether the action is currently active. This |
|---|
| 123 |
can be used to hide existing actions when customizing the site behaviour. |
|---|
| 124 |
|
|---|
| 125 |
- order: an optional integer used to sort actions within the same |
|---|
| 126 |
category. This attribute may be depracated in the future. |
|---|
| 127 |
|
|---|
| 128 |
It is important to understand that an action does *not* define the way it |
|---|
| 129 |
will be rendered: this is left to pages, templates and other components |
|---|
| 130 |
displaying it. Most of the time, actions will be rendered as command links |
|---|
| 131 |
or command buttons. |
|---|
| 132 |
|
|---|
| 133 |
Examples: |
|---|
| 134 |
|
|---|
| 135 |
<code> |
|---|
| 136 |
<action id="TAB_RIGHTS" link="/incl/tabs/document_rights.xhtml" |
|---|
| 137 |
enabled="true" label="action.view.rights" icon="/icons/file.gif"> |
|---|
| 138 |
<category>VIEW_ACTION_LIST</category> |
|---|
| 139 |
<filter-id>rights</filter-id> |
|---|
| 140 |
</action> |
|---|
| 141 |
|
|---|
| 142 |
<action id="newFile" link="create_file" enabled="true" |
|---|
| 143 |
label="action.new.file" icon="/icons/action_add_file.gif"> |
|---|
| 144 |
<category>SUBVIEW_UPPER_LIST</category> |
|---|
| 145 |
<filter-id>create</filter-id> |
|---|
| 146 |
</action> |
|---|
| 147 |
|
|---|
| 148 |
<action id="newSection" |
|---|
| 149 |
link="#{documentActions.createDocument('Section')}" enabled="true" |
|---|
| 150 |
label="command.create.section" icon="/icons/action_add.gif"> |
|---|
| 151 |
<category>SUBVIEW_UPPER_LIST</category> |
|---|
| 152 |
<filter id="newSection"> |
|---|
| 153 |
<rule grant="true"> |
|---|
| 154 |
<permission>AddChildren</permission> |
|---|
| 155 |
<type>SectionRoot</type> |
|---|
| 156 |
</rule> |
|---|
| 157 |
</filter> |
|---|
| 158 |
</action> |
|---|
| 159 |
</code> |
|---|
| 160 |
|
|---|
| 161 |
Actions extension point provides mergeing features: you can change an |
|---|
| 162 |
existing action definition in your custom extension point provided you use |
|---|
| 163 |
the same identifier. |
|---|
| 164 |
|
|---|
| 165 |
</documentation> |
|---|
| 166 |
<object class="org.nuxeo.ecm.platform.actions.Action" /> |
|---|
| 167 |
</extension-point> |
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
<extension target="org.nuxeo.runtime.api.ServiceManagement" point="services"> |
|---|
| 171 |
|
|---|
| 172 |
<service class="org.nuxeo.ecm.platform.actions.ejb.ActionManager" group="platform/web/actions"> |
|---|
| 173 |
<locator>%ActionManagerBean</locator> |
|---|
| 174 |
</service> |
|---|
| 175 |
|
|---|
| 176 |
</extension> |
|---|
| 177 |
|
|---|
| 178 |
</component> |
|---|