AnsweredAssumed Answered

Delete the downloaded file

Question asked by landerigeno on Aug 20, 2009
I have to develop in alfresco a feature that delete a document once the user download it.
Right now I'm triying:

I create a new Aspect toDelete and works fine.
I want to execute an scrpt each time I download a file so I edit web-client-config-actions.xml
 <!– Download document –>
         <action id="download_doc">
               <permission allow="true">Write</permission>
               <param name="ref">#{actionContext.nodeRef}</param>
            <script>/Company Home/Diccionario de datos/Scripts/addaspect.js</script>

And also create an script addaspect.js:
var nodeRef = args[0];
var document = search.findNode(nodeRef);
props = new Array(1);
props["cm:toDelete"] = true;
document.addAspect("cm:toDelete", props);;

I will have a schedule job to delete each file with the aspect toDelete but I can't make the script work correctlly.
Someone can help me? There is another way to do it? It's the script correct?
Thank you