01-16-2015 09:55 AM
Hello,
I would like to add a user to a nuxeo group with an automation operation write in IDE.
I try to do that with :
String groupName="group";
String user="userlogin";
NuxeoGroup group = usermanager.getGroup(groupName);
NuxeoPrincipal up=usermanager.getPrincipal(user);
List<String> userGroups = up.getGroups();
userGroups.add(group.getName());
up.setGroups(userGroups);
//this part don't works
usermanager.updatePrincipal(up);
//same problem don't update
DocumentModel userModel = userManager.getUserModel(user);
userModel.setProperty("user", "groups", userGroups);
userManager.updateUser(userModel);
//this part works
group.getMemberUsers().add(user);
usermanager.updateGroup(group);
The group's user are Ok, but the user's group information is not set while I don't restart the server.
Why ? Why group is instantally set and user not?
What can I do to make this work ?
thanks
ps: try also code nuxeo code example and it failed.
ps2 : my user is a ldap user
Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.
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.