Welcome to the Jazz Community Forum
Programatically add members to an RTC Access Group

Accepted answer

public IContributor getUserById(String id) throws TeamRepositoryException{
return repo.contributorManager().fetchContributorByUserId(id, MONITOR);
}
IContributor[] contributors = {null};
IAccessGroupClientService service = (IAccessGroupClientService) repo.getClientLibrary(IAccessGroupClientService.class);
// Get user
try {
contributors[0] = getUserById(user);
} catch (TeamRepositoryException e) {
return ("ERROR:");
}
IAccessGroup groups[] = service.getAccessGroups(accessGroup, MONITOR);
if (groups.length == 0) {
throw new TeamRepositoryException("Could not find accessGroup " + accessGroup);
}
// Remove user to access group
IAccessGroup workGroup = (IAccessGroup) groups[0].getWorkingCopy();
workGroup.add(contributors[0]);
// to remove workGroup.remove(contributors[0]);
service.save(workGroup,MONITOR);
return repo.contributorManager().fetchContributorByUserId(id, MONITOR);
}
IContributor[] contributors = {null};
IAccessGroupClientService service = (IAccessGroupClientService) repo.getClientLibrary(IAccessGroupClientService.class);
// Get user
try {
contributors[0] = getUserById(user);
} catch (TeamRepositoryException e) {
return ("ERROR:");
}
IAccessGroup groups[] = service.getAccessGroups(accessGroup, MONITOR);
if (groups.length == 0) {
throw new TeamRepositoryException("Could not find accessGroup " + accessGroup);
}
// Remove user to access group
IAccessGroup workGroup = (IAccessGroup) groups[0].getWorkingCopy();
workGroup.add(contributors[0]);
// to remove workGroup.remove(contributors[0]);
service.save(workGroup,MONITOR);
One other answer

Hi guys!
Does some one used this or a similar code to automatically add members to an RTC access group?
Does some one have some example or documentation to how to implement it?
I am trying to automatically add members to an RTC access group but I do not know how to do it.
Comments

https://rsjazz.wordpress.com/2016/02/03/setting-access-control-permissions-for-scm-versionables/ gives a bit more context and also hints where to start if you are new with RTC Java APIS. It is a series of articles.
Comments
Neal McKegney
Apr 04 '13, 12:42 p.m.I've found no mention of Access groups in the REST API, so I'm going to assume it isn't possible.
My backup plan was to add members of certain project areas to the Access group, but this doesn't appear to include members of the team areas, inside the project.
Can anyone confirm either of these two options?