It's all about the answers!

Ask a question

How to remove duplicate users in RTC

Venkatesh Nadamuni (137) | asked Aug 16 '12, 8:10 p.m.
edited Aug 17 '12, 2:39 a.m. by Ralph Schoon (63.1k33646)

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?

One answer

permanent link
Ralph Schoon (63.1k33646) | answered Aug 17 '12, 2:38 a.m.
edited Aug 17 '12, 2:40 a.m.
The following code is based on 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) {
                    .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
        .registerLoginHandler(new ITeamRepository.ILoginHandler() {
            public ILoginInfo challenge(ITeamRepository repository) {
                return new ILoginInfo() {
                    public String getUserId() {
                        return userId;

                    public String getPassword() {
                        return password;


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

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

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


        return true;

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.