Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

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

0 votes

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?


Accepted answer

Permanent link
    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

0 votes


One other answer

Permanent link
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.

0 votes

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

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,046

Question asked: Mar 20 '13, 9:52 a.m.

Question was seen: 6,048 times

Last updated: Feb 07 '19, 4:26 a.m.

Confirmation Cancel Confirm