This section shows you how to assign users to existing groups available in the portal via two ways:
Directly inline, via the UI of eXo Platform. See the Adding a user to a group section for more details.
In your extension, via the configuration. In Creating a user, you can see that while creating the newuser user, the user is assigned to the /platform/users group and the member membership.
Group group = groupHandler.findGroupById("/platform/users");
membershipHandler.linkMembership(newUser, group, membershipTypeHandler.findMembershipType("member"), false);