Programatically add members to an RTC Access Group
I want all members of a specific LDAP group to be added to an Access Group. Is there a way to do this programatically?
Can an access group be managed through the RTC API? eg. Add or Remove members |
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); Neal McKegney selected this answer as the correct answer
|
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. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
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?