/**
* Synchronizes <code>user</code> with fields from <code>proxyUser</code>. The roles set of given
* <code>user</code> is unmodified.
*/
public static IPentahoUser syncUsers( IPentahoUser user, ProxyPentahoUser proxyUser ) {
IPentahoUser syncedUser = user;
if ( syncedUser == null ) {
syncedUser = new PentahoUser( proxyUser.getName() );
}
syncedUser.setDescription( proxyUser.getDescription() );
// PPP-1527: Password is never sent back to the UI. It always shows as blank. If the user leaves it blank,
// password is not changed. If the user enters a value, set the password.
if ( !StringUtils.isBlank( proxyUser.getPassword() ) ) {
PasswordEncoder encoder =
PentahoSystem.get( PasswordEncoder.class, "passwordEncoder", PentahoSessionHolder.getSession() ); //$NON-NLS-1$
syncedUser.setPassword( encoder.encodePassword( proxyUser.getPassword(), null ) );
}
syncedUser.setEnabled( proxyUser.getEnabled() );
return syncedUser;
}