Creation of user failed, now it is a zombie...
we have a portalservice, which is creating users with the following code:
IUserAccountFactory userAccountFactory = UMFactory.getUserAccountFactory(); userAccount = userAccountFactory.newUserAccount(logonId, uniqueUserId);
When we try to create users with unique names with a length which does not satisfy the required minimum length of user-id (customizable in the UM configuration), the above code raises an UMException with message LOGONID_TOO_SHORT. Everything fine up this point.
What is amazing now: After changing the minimum length we tried to create this user (lets say 'xyz') again, but we get the message "user with unique name 'xyz' already exits". Whereas searching for user 'xyz' returns "user not found"!
Is this a bug? Or is there a possibility to unlock these "zombies"?
Thanks and regards
Ok, the problem was: I first created the User and based on that User I tried to create the UserAccount. Creating the User was fine, but creating the account failed (due to a logon-id which was too short).
A User without an account can not be found inside the portal, it is only an internal instance of the UME, but without an account it does not have an external representation. But it still exists and therefore can not be created again.
So I solved the problem by deleting the user like this:
IUserFactory userFactoryEP6 = UMFactory.getUserFactory(); IUser userEP6 = userFactoryEP6.getUserByUniqueName(uniqueName); String uid = userEP6.getUniqueID(); userFactoryEP6.deleteUser(uid);
I also rewrote my Exception-handling in the createUser-coding: If creation an account fails, I delete the user I created right before. This ensures, that no "zombie"-users are left behind.