cancel
Showing results for 
Search instead for 
Did you mean: 

chainedMatchAll & chainedMatchOne syntax/example

zputnoky
Star Contributor
Star Contributor

Dear All,

Still trying to hide/activate document library actions based on user role settings.

The code below hides the move to action, but unfortuantely hides for all users:

<config evaluator="string-compare" condition="DocLibActions" parent="evaluator.doclib.action.chainedMatchAll "> 
     <actions>
          <action id="document-download" type="javascript" label="actions.document.move-to">
               <param name="function">onActionMoveTo</param>
               <evaluator>evaluator.doclib.action.isSiteConsumer</evaluator>
               <evaluator>evaluator.doclib.action.disableAction</evaluator>
     </action>
     </actions>
</config>

I am not sure about the usage of evaluator.doclib.action.chainedMatchAll here.

Is there an example somewhere about how to use the chainedMatchAll and chainedMatchOne evaluators?

Regards,

Zsolt Putnoky

5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator

Setting the parent attribute does not make sense in this configuration file - this attribute is not supported at all and will be ignored. "parent" is an attribute that you use in Spring configuration files, not the Alfresco Share configuration files. As always, the source of Alfresco is the best example to look at for usages of chainedAll etc.

zputnoky
Star Contributor
Star Contributor

Thanks for the link! got the impression that I cannot chain together an evaluator which is checking user group membership and another one which is disabling a certain action.

Run into a demand, where I need to be able to hide certain document action based on the role of the logged in user. Basically I need to create company specific action groups out of the standard actions and show them depending on the user role.

douglascrp
World-Class Innovator
World-Class Innovator

Hello.

You can write a custom evaluator and make it check the user's membership to decide if the action should be active or not.

This is a simple example you can adapt to what you need:

public class IsSecretariaUserEvaluator extends BaseEvaluator {
private static String GRUPO_SECRETARIAS = "GROUP_SECRETARIAS";
protected SlingshotEvaluatorUtil util = null;
public void setSlingshotEvaluatorUtil(SlingshotEvaluatorUtil slingshotExtensibilityUtil) {
this.util = slingshotExtensibilityUtil;
}
public boolean evaluate(JSONObject jsonObject) {
ArrayList<String> groups = new ArrayList<String>();
groups.add(GRUPO_SECRETARIAS);
final RequestContext rc = ThreadLocalRequestContext.getRequestContext();
return this.util.isMemberOfGroups(rc, groups, false);
}
}

And then you declare it as:

<bean id="evaluator.doclib.isSecretaria" class="custom.evaluators.IsSecretariaUserEvaluator">
<property name="slingshotEvaluatorUtil" ref="slingshot.evaluator.utility" />
</bean>

Hi Douglas,

Thanks for the code! Have a question though. Why I need an evaluator when Alfresco has an OOTB evaluator to check role?

Regards,


Zsolt Putnoky

Getting started

Explore our Alfresco products with the links below. Use labels to filter content by product module.