It's all about the answers!

Ask a question

Programatically add members to an RTC Access Group


Neal McKegney (551422) | asked Mar 20 '13, 9:52 a.m.
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

Comments
Neal McKegney commented 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?

Accepted answer


permanent link
K M (38325051) | answered Jul 04 '13, 11:11 a.m.
    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



permanent link
Leonardo Benevides (266327) | answered Feb 06 '19, 11:44 a.m.
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
Ralph Schoon commented Feb 07 '19, 4:26 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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