cancel
Showing results for 
Search instead for 
Did you mean: 

Changing folder permit inheritance from java application

skushnerenko
Confirmed Champ
Confirmed Champ

We are using CMIS to interact from java web application with Alfresco repository. Folder permissions are also changed by CMIS except folder permit inheritance.

To turn off permit inheritance on each folder we had to use folder rule with script (in brief):

function main()
{
if (document.isContainer)
   document.setInheritsPermissions(false);
}

main();

The folders were under some root folder.

The application uses POST REST which creates folder and immediatly after this creates files inside folder.

It was supposed, that at the moment, when files are added, rules have already fired.

It all worked fine for a long, but at some moment we began to get errors while changing folder ACL via CMIS:

unexpected shared acl

According to this link: [MNT-12003] Thumbnail ACL inconsistent after move (possible concurrency problem between move and thu...   the error was the result of creating file inside folder before folder rule fired, so first file acl was inherited from root folder, not from the parent folder.

So, the queston is, how to provide consistent interaction of folder rule and CMIS in upper described case, may be there is a way to lock folder until the rule is fired.

Currently I have to check folder permit inheritence before adding files, and if the rule has not fired, to bypass adding files till next REST call.

1 ACCEPTED ANSWER

angelborroy
Community Manager Community Manager
Community Manager

IMO there is no way to be sure that this is going to run in every invocation.

You need to change the rule by other approach. As CMIS does not allow to reset inheritance, you should use Alfresco Native REST API. I'm not aware that this option is available in the new Rest API (the Swagger one) nor in the traditional Rest API. So you have to use Share REST API (which is not the best choice but it's the only one). Take a look at  

So you can make a REST invocation and then use your CMIS code.

Hyland Developer Evangelist

View answer in original post

1 REPLY 1

angelborroy
Community Manager Community Manager
Community Manager

IMO there is no way to be sure that this is going to run in every invocation.

You need to change the rule by other approach. As CMIS does not allow to reset inheritance, you should use Alfresco Native REST API. I'm not aware that this option is available in the new Rest API (the Swagger one) nor in the traditional Rest API. So you have to use Share REST API (which is not the best choice but it's the only one). Take a look at  

So you can make a REST invocation and then use your CMIS code.

Hyland Developer Evangelist