Disable copy action based on node type

cancel
Showing results for 
Search instead for 
Did you mean: 
zlucy82
Active Member II

Disable copy action based on node type

Hi all, is there a way to disable the default copy action of alfresco-share for only a custom type of node?

3 Replies
abhinavmishra14
Advanced

Re: Disable copy action based on node type

You can make use of evaluators to disable the action on the custom types of your choice. You can make use of "evaluator.doclib.action.nodeType" predefined evaluator and pass the list of custom type (s) you want to include.

Refer these docs:

https://docs.alfresco.com/5.2/concepts/doclib-predefined-evaluators-reference.html

https://docs.alfresco.com/5.2/concepts/dev-extensions-share-evaluators.html

e.g.

Action config in share-config-custom.xml would be like:

 

<action id="document-copy-to" type="javascript" label="actions.document.copy-to">
   <param name="function">onActionCopyTo</param>
   <evaluator>evaluator.doclib.action.editableByCurrentUser</evaluator>
<evaluator negate="true">evaluator.doclib.action.customTypes</evaluator> </action>

share custom-slingshot-context  defined the bean :

<bean id="evaluator.doclib.action.customTypes" parent="evaluator.doclib.action.nodeType">
      <property name="types">
         <list>
            <value>demo:customType1</value>
<value>demo:customType2</value>
</list> </property> </bean>

 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)
zlucy82
Active Member II

Re: Disable copy action based on node type

Hi @abhinavmishra14, thank you very much for your reply, it works perfectly and disable action for all roles! Now, i would to manage the action (with id "onActionCopyTo") item menu of "<multi-select>" element in DocumentLibrary of Share, i would to get the same result, so, that this action will be visible for all node type except my custom node type. Have you any ideas? Thank you!

Here is a picture:

Schermata 2021-03-09 alle 13.17.11.png

abhinavmishra14
Advanced

Re: Disable copy action based on node type

Unfortulately, you can't control multi select menu using evaluators. you have to customize the toolbar.js

You would have to look at this function to check for custom type check implementation:

https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/tool...

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)