Username renaming is not directly possible by an (official) public API, but:
- If the Security System is backed by AD, connected with an External Security System (i.e. AD), a renaming of the external security name OR the user name is supported. Except, both are changed at the same time.
- If the Security System is not connected by AD, to an External Security System, you could rename the user name in the IWA_User system database table (after stopping the Axon.ivy Engine).
- Or, as a workaround, the Interface IUser could be casted to User, and call the then the method setName(..) on this class instance. is available. But the method has to be executed as system.
Code example:
package wf;
import java.util.concurrent.Callable;
import ch.ivyteam.ivy.security.IUser;
import ch.ivyteam.ivy.security.internal.User;
import ch.ivyteam.ivy.server.ServerFactory;
public final class WorkflowAdminUtil {
private WorkflowAdminUtil(){}
public static void setUserName(IUser user, String newUserName) throws Exception {
ServerFactory.getServer().getSecurityManager().executeAsSystem(
new Callable<Void>() {
@Override
public Void call() throws Exception {
((User) user).setName(newUserName);
return null;
}
});
}
}