return process(userDto, scopeDto, false);
}
public UserAuthDTO process(UserDTO userDto, ScopeDTO scopeDto,
boolean needPassword) {
UserAuthDTO userAuthDto = new UserAuthDTO();
userAuthDto.setId(userDto.getId());
userAuthDto.setScopeId(scopeDto.getId());
userAuthDto.setUsername(userDto.getUsername());
userAuthDto.setRef(userDto.getRef());
userAuthDto.setDisplayName(userDto.getDisplayName());
userAuthDto.setStatus(Integer.toString(userDto.getStatus()));
// password
if (needPassword) {
String password = jdbcTemplate.queryForObject(sqlFindPassword,
String.class, userDto.getId());
userAuthDto.setPassword(password);
}
// permissions
List<Map<String, Object>> permissions = jdbcTemplate.queryForList(
sqlFindPermissions, userDto.getId(), scopeDto.getId());
userAuthDto.setPermissions(this.convertMapListToStringList(permissions,
"permission"));
// roles
List<Map<String, Object>> roles = jdbcTemplate.queryForList(
sqlFindRoles, userDto.getId(), scopeDto.getId());
userAuthDto.setRoles(this.convertMapListToStringList(roles, "role"));
return userAuthDto;
}