AnsweredAssumed Answered

Prevent rules propagation to parent folder

Question asked by oshikaru on Apr 17, 2018
Latest reply on May 11, 2018 by jpotts

Hello !

 

I'm facing an issue with rules triggering in Alfresco (Community v5.2.0 (r135134-b14) schema 10 005).

 

In our installation, we are using the rules to:

  • Communicate to other server components about what happens in Alfresco
  • Prevent unwanted actions (like deleting some folders)

 

We faced multiple issues and random behaviors that we fixed with a lot of checks in our JS code but one "unsolvable" case remains.

 

We have a rule that is used to prevent people to rename or delete folders with a name starting by "_" , this rule only applies to elements that have the custom property 'gofast:preventDelete' set to true.

 

The problem is : When we are doing something on an element in a folder starting by "_", the rules will trigger on the document but also on the parent folder.

 

Exemple : 

 

A delete request is called : 

16:58:31,244 WebDAV request DELETE on path /alfresco/webdav/Sites/_Groups/_Var%20dump%20land/content%20(2).mp4

Rules triggers on the document : 

16:58:31,345 ==== STARTING SCRIPT SCRIPT SYNCHRONIZE ====
16:58:31,346 Script called on content (2).mp4 / 10651e68-7a35-4727-a1d1-f6e889805656
............................SOME ACTIONS..............................
16:58:31,423 Request has been sent
16:58:31,423 Drupal answered OK
16:58:31,424 Closing XHR Object
16:58:31,424 ==== ENDING SCRIPT SCRIPT SYNCHRONIZE ====

But just after this, the rule to prevent to delete a folder starting with '_' is called, not on the document but on it's parent folder : 

16:58:31,491 ==== STARTING SCRIPT SCRIPT PREVENT DELETE SPACE FOLDER ====
16:58:31,492 Script called on _Var dump land / eb8dc7e7-dd04-4a6a-8909-3c263e54e0e6
16:58:31,492 Edition of _Var dump land will lead to a crash.
16:58:31,492 Exception org.mozilla.javascript.JavaScriptException: ROLLBACK : Edition of a space folder is not authorized (workspace://SpacesStore/ca813b71-8f57-4057-8496-8a4d39ee3d63#17)

And the transaction is rollbacked.

 

Do you think it's possible to stop propagation in the first script ?

 

Thanks for your help !

 

Regards,

Outcomes