Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to remove duplicate users in RTC

Recently the LDAP team renamed all the upper case users to lower case, but forgot to tell us.  RTC LDAP synch picked up the lower case users without removing or archivng the uppercase.  Now when a user tries to login they get a message that there is a duplicate user and the system locks them out.  I have few hundred users with this issue. 

System should not have allowed these users to be uploaded, if it prevents the user from loggin-in.

I have been able to manually rename the users names and archive them.  But this will take me a few weeks. 

Any idea on how I can make this happen in bulk?

0 votes



One answer

Permanent link
The following code is based on https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation and would archive (or delete) a user given its ID. If you wrap it into reading a file with the user ID's you should be able to do this. I'd suggest to archive the users first and if needed run a second pass later if no one has any issues making sure the users are archived before deleting them. You might want to test this on a test server.

    private static boolean run(String[] args) throws TeamRepositoryException {

        if (args.length != 4) {
            System.out
                    .println("Usage: ArchiveUser <repositoryURI> <userId> <password> <userToArchive>");
            return false;
        }

        String repositoryURI = args[0];
        final String userId = args[1];
        final String password = args[2];
        String archiveID = args[3];

        ITeamRepository teamRepository = TeamPlatform
                .getTeamRepositoryService().getTeamRepository(repositoryURI);
        teamRepository
        .registerLoginHandler(new ITeamRepository.ILoginHandler() {
            public ILoginInfo challenge(ITeamRepository repository) {
                return new ILoginInfo() {
                    public String getUserId() {
                        return userId;
                    }

                    public String getPassword() {
                        return password;
                    }
                };
            }

        });
        teamRepository.login(null);

        IContributor user = teamRepository.contributorManager().fetchContributorByUserId(archiveID, null);
        IContributor archiveIDWorkingCopy = (IContributor) user.getWorkingCopy();
        archiveIDWorkingCopy.setArchived(true);
        teamRepository.contributorManager().saveContributor(archiveIDWorkingCopy, null);

        /**
         * Delete User!!
         *
         * teamRepository.contributorManager().deleteContributor(archiveIDWorkingCopy, null);
         */
       

        System.out.println("Archived user: " + archiveID + ".");

        teamRepository.logout();

        return true;
    }

0 votes

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
× 411

Question asked: Aug 16 '12, 8:10 p.m.

Question was seen: 6,900 times

Last updated: Nov 06 '20, 2:55 a.m.

Confirmation Cancel Confirm