cancel
Showing results for 
Search instead for 
Did you mean: 

setInheritParentPermissions not applied

amandine_b
Champ in-the-making
Champ in-the-making
Hi,

I'm working on a java code which create a new PDF and modify permissions of it.

I try to set the inherit permissions to false but it's not applied. The PDF still have inheritance at the end of the execution.

private void droitsDuPDF() {   PermissionService permissionService = getServiceRegistry().getPermissionService();   // Suppression des droits sur le fichier   permissionService.deletePermissions(nodePDF);   permissionService.setInheritParentPermissions(nodePDF, false);   // Récupération du répertoire parent   ChildAssociationRef caRepertoire = nodeService.getPrimaryParent(nodeOrigine);   NodeRef repertoire = caRepertoire.getParentRef();   // Récupération des groupes ayant des droits sur l'espace   Set<AccessPermission> droitsRepertoire = permissionService.getAllSetPermissions(repertoire);    // Ajout des droits en lecture sur le PDF, pour chaque groupe récupéré du répertoire    for (AccessPermission permission : droitsRepertoire) {      permissionService.setPermission(nodePDF,permission.getAuthority(),PermissionService.CONSUMER, true);   }}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


I try to use RetryingTransactionCallback to commit the PDF when it's created, but it doesn't change anything.
   private NodeRef convertToPdf() throws Exception  {      RetryingTransactionCallback<Object> txnWork = new RetryingTransactionCallback<Object>() {         @Override         public Object execute() throws Exception         {            //mon traitement         }      };      TransactionService transactionService = getServiceRegistry().getTransactionService();      NodeRef child = (NodeRef) transactionService.getRetryingTransactionHelper().doInTransaction(txnWork, true);      return child;   }‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Also, I use "AuthenticationUtil.runAsSystem" to execute the code.

I work on Alfresco 4.0.2 Enterprise.

Do you have some ideas to fix this issue ?

Thanks !

Regards
2 REPLIES 2

amandine_b
Champ in-the-making
Champ in-the-making
Hi !

I still haven't found a solution yet.
If you have an idea, do not hesitate !

Regards

mrogers
Star Contributor
Star Contributor
You are running an update in a read only transaction!
I'd expect an exception to be thrown.