AnsweredAssumed Answered

To modify permissions

Question asked by limarin on Sep 28, 2006
Latest reply on Oct 10, 2006 by andy
Hi,

I add two new aspects: state folder (opened/closed) and finish date

And I have created a scheduled job to update the state folder.

It does:

To look for the folders and for every folder:
If the folder has my new aspect assigned (state folder) and the finish date has expired,
1. The state is modified: closed
2. Delete permissions:

The step 1 it's ok, but the step 2 does not work

public void execUpdateWork()
{
    TransactionWork<Object> updWork = new TransactionWork<Object>()
    {
        public Object doWork() throws Exception
        {
               ….. search folders
      
      authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
      QName qStFolder = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "stateFolder");
      for(ResultSetRow row : results)
      {
         currentNodeRef = row.getNodeRef();
         if (currentDate.compareTo(closeDate)>-1) {
         this.nodeService.setProperty(nodeRef, qStFolder, "CLOSED");
                              
         Set<String> users = this.authorityService.getContainedAuthorities(AuthorityType.USER,"GROUP_MyGroup",false);
         for (String userAuth : users)
         {
            this.permissionService.deletePermission(nodeRef, userAuth, PermissionService.ALL_PERMISSIONS);
         }
         }
      }
      
      ….. results.close();
      
                return null;
        }
    };
    TransactionUtil.executeInUserTransaction(this.transactionService, updWork);
}

Why does not work deletePermission or clearPermission ???

Thanks for your help

Outcomes