This is only used when UserVO is a member of UserGroupVO.
Only that group is populated as a substructure to store roles.
@param groupId
@param roleName
774981
public void addRoleForGroup(String groupName, String roleName) {
        if (workgroups==null) {
            workgroups = new Workgroup[1];
            workgroups[0] = new Workgroup(null, groupName, null);
        }
        List<String> roles = workgroups[0].getRoles();
        if (roles==null) {
            roles = new ArrayList<String>();
            workgroups[0].setRoles(roles);
        }
        roles.add(roleName);
    }
881652
def create_role_config_group(self, name, display_name, role_type):
    
    return role_config_groups.create_role_config_group(
        self._get_resource_root(), self.name, name, display_name, role_type,
        self._get_cluster_name())
831651
public void setGroupName (@Nonnull @Nonempty final String sGroupName)
  {
    ValueEnforcer.notEmpty (sGroupName, "GroupName");
    m_sGroupName = sGroupName;
  }
1023431
public Response addUserToGroup(String username, String groupName) {
		return restClient.post("users/" + username + "/groups/"+ groupName, null,
				new HashMap<String, String>());
	}
333193
public function removeGroupFromRole(int $group_id, int $role_id)
    {

        $role = $this->getRole($role_id);
        if ($role->groups()->detach($group_id) > 0)
            event(new UserGroupRoleRemoved($group_id, $role));

    }
1189242
private void processGroups(ConfigurationAdmin configAdmin,
                               String roleName,
                               Dictionary<String, Object> roleProps, Set<String> pids) {

        String[] groupPids = (String[]) roleProps.get(CFG_KEY_GROUP);
        if (groupPids == null || groupPids.length == 0) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "No groups in role " + roleName);
            }
        } else {
            Set<String> badGroups = new HashSet<String>();
            Set<String> badAccessIds = new HashSet<String>();
            for (int i = 0; i < groupPids.length; i++) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "group pid " + i + ": " + groupPids[i]);
                }
                pids.add(groupPids[i]);
                Configuration groupConfig = null;
                try {
                    groupConfig = configAdmin.getConfiguration(groupPids[i], bundleLocation);
                } catch (IOException ioe) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Invalid group entry " + groupPids[i]);
                    }
                    continue;
                }
                if (groupConfig == null || groupConfig.getProperties() == null) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Null group element", groupPids[i]);
                    }
                    continue;
                }

                Dictionary<String, Object> groupProps = groupConfig.getProperties();
                final String name = (String) groupProps.get("name");
                final String accessId = (String) groupProps.get("access-id");
                if (name == null || name.trim().isEmpty()) {
                    continue;
                }
                // access id takes precedence
                if (accessId != null && AccessIdUtil.isGroupAccessId(accessId)) {
                    if (badAccessIds.contains(accessId)) {
                        // This accessId is already flagged as a duplicate
                        continue;
                    }
                    if (!accessIds.add(accessId)) {
                        Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_ACCESSID, accessId);
                        badAccessIds.add(accessId);
                        accessIds.remove(accessId);
                    }
                } else {
                    // TODO: check for bad access id
                    if (badGroups.contains(name)) {
                        // This group is already flagged as a duplicate
                        continue;
                    }
                    if (name.trim().isEmpty()) {
                        // Empty entry, ignoring
                        continue;
                    }
                    if (!groups.add(name)) {
                        Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_GROUP, name);
                        badGroups.add(name);
                        groups.remove(name);
                    }
                }
            }
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Role " + roleName + " has groups:", groups);
            }
        }
    }
1183422
public void setUserGroup(String userGroup) {

        CmsGroup group = checkGroup(userGroup);
        if (group != null) {
            m_project.setGroupId(group.getId());
        }
    }
330104
public void addUser(String username, Role role) {
        if (StringUtils.isNullOrEmpty(username)) {
            throw new IllegalArgumentException("A username must be specified.");
        }

        if (role == null) {
            throw new IllegalArgumentException("A role must be specified.");
        }

        users.add(new User(username, role));
    }
1254210
@Override
    public void setGroupId(String groupId) {
        room.setGroupId(groupId);
        apiRoom.setGroupdId(groupId);
    }
1055848
public void setThingGroups(java.util.Collection<ThingGroupDocument> thingGroups) {
        if (thingGroups == null) {
            this.thingGroups = null;
            return;
        }

        this.thingGroups = new java.util.ArrayList<ThingGroupDocument>(thingGroups);
    }
894243
public function loadRoleAssignmentForUserGroup($groupPath, $roleId, Request $request)
    {
        $groupLocationParts = explode('/', $groupPath);
        $groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts));
        $userGroup = $this->userService->loadUserGroup($groupLocation->contentId);

        $roleAssignments = $this->roleService->getRoleAssignmentsForUserGroup($userGroup);
        foreach ($roleAssignments as $roleAssignment) {
            if ($roleAssignment->getRole()->id == $roleId) {
                return new Values\RestUserGroupRoleAssignment($roleAssignment, $groupPath);
            }
        }

        throw new Exceptions\NotFoundException("Role assignment not found: '{$request->getPathInfo()}'.");
    }
20267
public BoxGroupMembership.Info addMembership(BoxUser user, Role role) {
        BoxAPIConnection api = this.getAPI();

        JsonObject requestJSON = new JsonObject();
        requestJSON.add("user", new JsonObject().add("id", user.getID()));
        requestJSON.add("group", new JsonObject().add("id", this.getID()));
        if (role != null) {
            requestJSON.add("role", role.toJSONString());
        }

        URL url = ADD_MEMBERSHIP_URL_TEMPLATE.build(api.getBaseURL());
        BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
        request.setBody(requestJSON.toString());
        BoxJSONResponse response = (BoxJSONResponse) request.send();
        JsonObject responseJSON = JsonObject.readFrom(response.getJSON());

        BoxGroupMembership membership = new BoxGroupMembership(api, responseJSON.get("id").asString());
        return membership.new Info(responseJSON);
    }
442534
public void setJobGroup (final String jobGroup)
  {
    if (jobGroup != null && jobGroup.trim ().length () == 0)
      throw new IllegalArgumentException ("Group name cannot be null or empty.");

    if (jobGroup == null)
      m_sJobGroup = IScheduler.DEFAULT_GROUP;
    else
      m_sJobGroup = jobGroup;
  }
212763
public void addGroup(CmsAdminMenuGroup group, float position) {

        m_groupContainer.addIdentifiableObject(group.getName(), group, position);
    }
676151
public void deleteGroup(final String id) throws NotFoundException, GeneralException, UnauthorizedException {
        if (id == null) {
            throw new IllegalArgumentException("Group ID must be specified.");
        }
        messageBirdService.deleteByID(GROUPPATH, id);
    }
931943
public void setSecurityGroupIds(java.util.Collection<String> securityGroupIds) {
        if (securityGroupIds == null) {
            this.securityGroupIds = null;
            return;
        }

        this.securityGroupIds = new java.util.ArrayList<String>(securityGroupIds);
    }
1222232
public function removeGroup($role_id, $group_id)
    {

        $this->removeGroupFromRole($group_id, $role_id);

        return redirect()->back()
            ->with('success', trans('web::seat.user_removed'));
    }