AnsweredAssumed Answered

Problem with owner permission

Question asked by mrey on Nov 2, 2009
Latest reply on Dec 13, 2009 by zaizi
Hi there

Can somebody help me?

I´m tryin with an action to change permission in an space to consumer for all the users, included the user who exectutes the action, and the spaces owner.

We use this method
     private void CambiarPermisosLectura() {
          // Este método cambia los permisos del espacio que se ha cerrado a
          // SOLO LECTURA
         
             NodeRef folderNodeRef = nodoEsp.getNodeRef();
             String usuActual = this.services.getAuthenticationService().getCurrentUserName();
             authenticationComponent.setSystemUserAsCurrentUser();
            
             services.getPermissionService().setInheritParentPermissions(folderNodeRef, false);
             Set<AccessPermission> permisos = services.getPermissionService().getAllSetPermissions(folderNodeRef);
             Iterator it = permisos.iterator();
            
             while (it.hasNext()){
               
                AccessPermission acceso = (AccessPermission)it.next();
                if(acceso.getAuthority().equals("admin")){
                   services.getPermissionService().clearPermission(folderNodeRef, acceso.getAuthority());
                   services.getPermissionService().setPermission(folderNodeRef,  acceso.getAuthority(), PermissionService.CONSUMER, true);

                }
             }
             authenticationComponent.clearCurrentSecurityContext();
           authenticationComponent.setCurrentUser(usuActual);
          /* where "folderNoderef" is the Noderef of the given space. */
       }

It works good except the space's owner, who continues with owner`s permission.

Could I change the owners permission?
Change the owner?

Thank you very much.

Outcomes