Action Evaluators in Alfresco

Alfresco provide various actions on the document and spaces which will help users to manipulate the document. It enables users to do various operations like delete, copy, move etc… on the document and space. On document details page actions can be seen on the right hand side.

Out of box various actions available on documents but each of these actions is shown based on the authorization of logged in user. Alfresco has feature called action evaluators which can be imposed on individual action which will decide particular action should be rendered or not for particular user or particular document. There are requirements where we need to hide some of the actions based on some criteria.

Alfresco have many of such action evaluators inbuilt which can be used to hide actions based on the criteria. Some of those actions created generic enough so that based on the parameter passed it will behave differently. There are various action evaluators like chainedMatchOne and chainedMatchAll available which allows chaining multiple actionevaluators to create complex criteria.All the inbuilt action evaluators can be found under

<ALF_HOME>/tomcat/webapps/share/WEB-INF/classes/alfresco/slingshot-documentlibrary-context.xml

All the action evaluators listed there can be extended or reused.

For instance if we want to hide delete action for all the documents on which versionable aspect is applied.

Step 1:

Create custom-action-context.xml file with following entry

<bean id="custom.evaluator.doclib.hasversionable" class="org.alfresco.web.evaluator.HasAspectEvaluator">

      <property name="aspects">
         <list>
            <value> cm:versionable </value>
         </list>
      </property>
   </bean>

Place it under

<ALF_HOME>/tomcat/webapps/share/WEB-INF/classes/alfresco/web-extension

Step 2:

Use above evaluator in share-config-custom.xml  file to hide delete document action

<config evaluator="string-compare" condition="DocLibActions">

 <action id="document-delete" type="javascript" label="actions.document.delete">

            <param name="function">onActionDelete</param>

            <permissions>

               <permission allow="true">Delete</permission>

            </permissions>

            <evaluator> custom.evaluator.doclib.hasversionable </evaluator>

         </action>

</config>

Note: This is applicable to Alfresco Share User Interface only for Alfresco explorer interface you need to follow different set up steps to hide actions.

If inbuilt action evaluators do not meetup our requirement we can create custom action evaluators. We will see about it in upcoming posts.

Looking for quality Alfresco Hosting? Look no further than Arvixe Web Hosting! 

Tags: , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 6 = 10

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>