public static List<RUserDto> getUsers(DbConn cnx) { return getUsers(cnx, "user_select_all", 0); }
public static List<RUserDto> getUsers(DbConn cnx) { return getUsers(cnx, "user_select_all", 0); }
public static RUserDto getUser(DbConn cnx, int id) { List<RUserDto> res = getUsers(cnx, "user_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
public static RUserDto getUser(DbConn cnx, int id) { List<RUserDto> res = getUsers(cnx, "user_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
public static void changeUserPassword(DbConn cnx, String userLogin, String newPassword) { List<RUserDto> dtos = getUsers(cnx, "user_select_by_key", 0, userLogin); if (dtos.size() == 0) { throw new JqmAdminApiUserException("Cannot update the password of a user which does not exist - given login was " + userLogin); } changeUserPassword(cnx, dtos.get(0).getId(), newPassword); }
public static void changeUserPassword(DbConn cnx, String userLogin, String newPassword) { List<RUserDto> dtos = getUsers(cnx, "user_select_by_key", 0, userLogin); if (dtos.size() == 0) { throw new JqmAdminApiUserException("Cannot update the password of a user which does not exist - given login was " + userLogin); } changeUserPassword(cnx, dtos.get(0).getId(), newPassword); }
public static void syncUsers(DbConn cnx, List<RUserDto> dtos) { for (RUserDto existing : getUsers(cnx)) { boolean foundInNewSet = false; for (RUserDto newdto : dtos) { if (newdto.getId() != null && newdto.getId().equals(existing.getId())) { foundInNewSet = true; break; } } if (!foundInNewSet) { deleteUser(cnx, existing.getId()); } } for (RUserDto dto : dtos) { upsertUser(cnx, dto); } } }
public static void syncUsers(DbConn cnx, List<RUserDto> dtos) { for (RUserDto existing : getUsers(cnx)) { boolean foundInNewSet = false; for (RUserDto newdto : dtos) { if (newdto.getId() != null && newdto.getId().equals(existing.getId())) { foundInNewSet = true; break; } } if (!foundInNewSet) { deleteUser(cnx, existing.getId()); } } for (RUserDto dto : dtos) { upsertUser(cnx, dto); } } }