AnsweredAssumed Answered

How to rename authorityDisplayName Group using web services?

Question asked by relax on Jan 21, 2010
Latest reply on Mar 15, 2010 by relax
Hello,
I create a User Groups using a web service. Then I would like to rename the group created by another name using web service.
Post http://forums.alfresco.com/en/viewtopic.php?f=35&t=21490 talking about AuthorityService.

Is there a way to find AuthorityServiceImpl using web service?

Is there another method to rename User Groups using web service?

Thank you!

This is the code to create a User Group:

public StringBuilder createGroup(String alfrescoAxisUrl,
         String parentGroupName, String groupName)
         throws AccessControlFault, RemoteException {

      StringBuilder stringBuilder = new StringBuilder();

      AccessControlServiceSoapBindingStub accessControlService = WebServiceFactory
            .getAccessControlService(alfrescoAxisUrl);
      // test if exist group name
      AuthorityFilter authorityFilter = new AuthorityFilter();
      authorityFilter.setAuthorityType(GROUP);

      String[] allAuthorities = accessControlService
            .getAllAuthorities(authorityFilter);

      Boolean existGroup = ArrayUtils.contains(allAuthorities,
            Constants.GROUP_PREFIX + groupName);

      if (!existGroup) {
         NewAuthority newAuthorityGroup = new NewAuthority(GROUP, groupName);
         NewAuthority[] newAuthorities = { newAuthorityGroup };

         if (parentGroupName != null) {
            parentGroupName = Constants.GROUP_PREFIX + parentGroupName;
         }
         accessControlService.createAuthorities(parentGroupName,
               newAuthorities);
         stringBuilder.append("parentGroupName = ");
         stringBuilder.append(parentGroupName);
         stringBuilder.append(", groupName = ");
         stringBuilder.append(groupName);
         logger.info(stringBuilder.toString());
      } else {
         stringBuilder.append("group = ");
         stringBuilder.append(groupName);
         stringBuilder.append(" already exists");
         logger.info(stringBuilder.toString());
      }
      stringBuilder.append("\n");
      return stringBuilder;
   }

Outcomes