on 09-29-2004 11:28 AM
Hi everybody,
I've created a user with the following lines:
String testUserId = "User0815";
IUserMaint user = userFactory.newUser(testUserId);
user.setFirstName("firstname");
user.setLastName("lastname");
user.setEmail("first.last@test.de");
user.commit();
IUserAccount userAccount = userAccountFactory.newUserAccount(testUserId, user.getUniqueID());
userAccount.setPassword("secret");
userAccount.setPasswordChangeRequired(false);
userAccount.save();
userAccount.commit();
This works fine, but afterwards I want to the delete the user and the according account with
IUser userToDelete = userFactory.getUserByLogonID(testDUserId);
userFactory.deleteUser(userToDelete.getUniqueID());
The second call to
IUserMaint user = userFactory.newUser(testUserId);
gives me a com.sap.security.api.UserAlreadyExistsException, i.e. it seems the user was not deleted. So my question is, what's the right way to delete an user?
Best Regards,
Daniel
Hi,
What is your data source? Check whether the userid actually present there? Were any exceptions raised? Put a print in the catch statement and see if there is any error.
The code you have given seems to be correct, except that I did it as below and it worked. Try this way.
IUser user=uf.getUserByUniqueName(strUserID);
String strUniqueUserID=user.getUniqueID();
uf.deleteUser(strUniqueUserID);
Good luck
Bhanu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.