cancel
Showing results for 
Search instead for 
Did you mean: 

java client: addUserToGroup / attachGroupToUser functions

Iago_Iglesias_Á
Champ in-the-making
Champ in-the-making

Hi,

i'm trying to add several users to a group using java client but it doesnt work.The users and the group are already created.

The functions i have tried for this are:

  • org.nuxeo.client.object.user.UserManager.addUserToGroup
  • org.nuxeo.client.object.user.UserManager.attachGroupToUser

can anyone help me?

thanks in advance

1 REPLY 1

Jackie_A
Confirmed Champ
Confirmed Champ

You can add groups to a user by setting the user groups field in the User:

// Get the user groups that they already have
ArrayList<String> userGroups = (ArrayList<String>) user.getProperty("user", "groups");
// Add another group
userGroups.add("some_group_name_that_already_exists");
// Set the groups via user schema, fieldname: groups
user.setProperty("user", "groups", userGroups);
userManager.updateUser(user);

Does that work for you?

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.