Hello,
I have read posts about how to disable download actions for a consumer or at all. But, I need to disable Download action on a folder.
Any suggestions?
https://community.alfresco.com/people/sakshik/blog/2018/04/04/disable-download-on-a-file
This can be done share document library XML file. It has an entry for folder and document actions. You can remove or add specific evaluator for folder action.
Hi , Sakshi Kochhar
Add the following entry in Alfresco_Home/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file.
< !-- Document Library Actions config section -- >
< config evaluator="string-compare" condition="DocLibActions" >
< !--
Action definitions
-- >
< actions >
< !-- Download document -- >
< action id="document-download" type="link" label="actions.document.download" >
< param name="href" >{downloadUrl}</ param >
Evaluator to Disable Download action when document is locked by a user
< evaluator negate="true" >"DOWNLOAD_CUSTOM_EVALUATOR"</ evaluator >
</ action >
</ actions >
</ config >
refer this documentation Creating a custom evaluator | Alfresco Documentation to create custom evaluator .
Wouldn't this disable Download Action on all of the folders.. I want to disable Download on a particular folder.
Hi ashwin.mor _
I want to disable Download on a particular folder such that no document on that folder is allowed to be downloaded. Could you elaborate on your answer.
Hi Sakshi,
Evaluators can come in handy for your use case. You need a way to identify folders for which you want to disable the action.
You can do that by using folder names as well, but I would suggest go via a aspect route. Add an aspect to the folder you want to disable the action and have a check in the evaluator.
Hope this is helpful
Hi ,
yes ..
and I needed information on how to create such an aspect. Could you please help with that.
First which you need to do is creating an marker aspect.Apply it to the folder on which you want to disable the download action.There are multiple ways for adding an aspect.
For disabling the download action on the children/files which are inside the folder we have 2 approach.
First one is,
Creating new custom evaluator in which you need to check whether the parent folder has the marker aspect or not.If it has you can disable the download action by returning fals evalue in custome java evaluator.
Below link will help you in creating an custom java evaluator.
Evaluators | Alfresco Documentation
Second one it.
Create a behavior, which will get called when you add in aspect in a folder.In this behavior write the logic that when you add aspect in folder it will also apply that aspect to all childrens.
Create one more behavior , when you upload or create a content inside that folder , it will check whether the parent folder has an aspect or not, if it has it will apply it to the new content as well.
Below links will help you in creating policies.
Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials
Behaviours / Policies | Alfresco Documentation
After creating policies use hasAspct evaluator which is mentioned in below link.For creating hasAspect evaluator you do not need to do any java coding.
Predefined Evaluators | Alfresco Documentation