Username renaming is not directly possible by an (official) public API, but:
- If the Security System is 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 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 then the method setName(..) 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;
}
});
}
}
answered
12.02.2016 at 14:21
Flavio Sadeghi ♦♦
(suspended)
accept rate:
75%
Hello Emmanuel. Is the root use case the renaming of a user name?
Hallo Flavio, Yes this is the root cause.