Deleting users (non-LDAP Tomcat) in RTC 4.x?
We have a large number of users created back in RTC 2.x that had bad user IDs. These accounts were never actually used - have no work items or source artifacts associated with them - and thus there should not be any risk in removing them completely. I also wrote an app that uses the API to spit out a list of archived user accounts that don't own any work items or source artifacts, just to be sure.
We are using Tomcat with manually added IDs, not using LDAP. I know how to CHANGE user IDs, but we need to delete them as we long ago created good IDs to replace the bad ones.
One answer
I checked the repotools and there is also only the capability to archive the users exposed to users.
I can only imagine that the reason for this is that users could be potentially referenced at all kinds of places and deleting users could cause dangling references in many places.
There is an API call that allows to delete users, and it could be used, however, I am not sure if that could have bad consequences, should a user ID actually be referenced from other repository artifacts.
Comments
Can it be done with the REST API or does it require the Java API?
Since I am checking connections myself before deleting, I am not worried about breaking things. The report takes a long time to run since it checks ownership of 50,000 work items and all SCM and Build artifacts, but it does the job. These are "unused" user accounts.
Mike, I have not tried REST. I found teamRepository.contributorManager().deleteContributor(contributorHandle, monitor) in the Plain Java Client Libraries. You could use this easily by modifying the code from http://rsjazz.wordpress.com/2012/10/12/changing-the-jazz-user-id-using-the-rtc-plain-java-client-libraries/. The code is available for download from the post. You would just only have to change very few lines e.g. add a new method
public static void deleteUserID(ITeamRepository teamRepository, String originalID, String newID, Boolean doUpdate, IProgressMonitor monitor) throws TeamRepositoryException { System.out.print("Delete user: " + originalID + (doUpdate ? "" : " - Simulation")); IContributor user = teamRepository.contributorManager() .fetchContributorByUserId(originalID, monitor); if (doUpdate) { teamRepository.contributorManager().deleteContributor(user, monitor); } System.out.println(" - OK"); }
and replace the call to the other method by the call to the new method.
Mind the risk 8-)
Comments
sam detweiler
Jan 06 '14, 9:29 p.m.There is no Delete User function.