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.
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.
Based on the API this looks like the correct method.
But you could try calling this method afterwards on the IUserAccountFactory and see if it helps
invalidateCacheEntry
public void invalidateCacheEntry(java.lang.String uniqueid)
throws UMExceptionremoves the user account object which has the specified uniqueid from the factory's cache Note: Use this method carefully, because calling it too often may cause performance problems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.