Aggiunta nuova login per steup
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -5,6 +5,7 @@ import it.integry.ems.activity.dto.SteUPEntryDTO;
|
||||
import it.integry.ems.activity.dto.SteUpScoreDTO;
|
||||
import it.integry.ems.activity.exception.IspezioneCompletataException;
|
||||
import it.integry.ems.activity.service.SteUPService;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.response.StatusResponse;
|
||||
@@ -42,6 +43,8 @@ public class SteUPController {
|
||||
private LoginService loginService;
|
||||
@Autowired
|
||||
private ServiceChecker serviceChecker;
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
@RequestMapping(value = "/status", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
@@ -67,6 +70,15 @@ public class SteUPController {
|
||||
return response;
|
||||
}
|
||||
|
||||
@GetMapping(value = "login2")
|
||||
public @ResponseBody ServiceRestResponse loginUsernameAndPassword
|
||||
(@RequestParam(value = "username") String username,
|
||||
@RequestParam(value = "password") String password) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(steUPService.login(requestDataDTO.getProfileDB(), username, password));
|
||||
}
|
||||
|
||||
//Si può rimuovere nel momento in cui tutti avranno aggiornato steup (>= 14/02/24)
|
||||
@Deprecated()
|
||||
@RequestMapping(value = EmsRestConstants.PATH_LOGIN_STEUP, method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse Login(HttpServletRequest request,
|
||||
|
||||
@@ -17,12 +17,12 @@ import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.order.dto.UserGroupENUM;
|
||||
import it.integry.ems.report.dto.JasperDTO;
|
||||
import it.integry.ems.report.dto.PairsDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.MailService;
|
||||
import it.integry.ems.service.ReportProcessor;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.service.SystemService;
|
||||
import it.integry.ems.utility.UtilityDirs;
|
||||
@@ -46,9 +46,6 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
@@ -91,7 +88,7 @@ public class SteUPService {
|
||||
}
|
||||
|
||||
private HashMap<String, Object> authMd5User(String md5User, String profileDB) throws Exception {
|
||||
HashMap<String, Object> loggedUser = systemService.login("", "", md5User, profileDB);
|
||||
HashMap<String, Object> loggedUser = systemService.login(null, null, md5User, profileDB);
|
||||
if (loggedUser != null) {
|
||||
int keyGroup = Integer.parseInt(loggedUser.get("key_group").toString());
|
||||
if (!(this.isGroupRilevatore(keyGroup) || this.isGroupTecnico(keyGroup))) {
|
||||
@@ -124,10 +121,15 @@ public class SteUPService {
|
||||
return userNamePv;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> login(String md5User, String profileDB) throws Exception {
|
||||
|
||||
|
||||
public HashMap<String, Object> login(String profileDb, String username, String password) throws Exception {
|
||||
return login(profileDb, UtilityHash.generateMd5(String.format("%s%s", username, password)));
|
||||
}
|
||||
public HashMap<String, Object> login(String profileDb, String md5User) throws Exception {
|
||||
HashMap<String, Object> toReturn = new HashMap<>();
|
||||
|
||||
HashMap<String, Object> loggedUser = this.authMd5User(md5User, profileDB);
|
||||
HashMap<String, Object> loggedUser = this.authMd5User(md5User, profileDb);
|
||||
String userName = loggedUser.get("user_name").toString();
|
||||
Integer keyGroup = Integer.valueOf(loggedUser.get("key_group").toString());
|
||||
|
||||
@@ -137,10 +139,10 @@ public class SteUPService {
|
||||
userData.put("key_group", keyGroup);
|
||||
toReturn.put("user", userData);
|
||||
|
||||
String profileDb = userData.get("profile_db").toString(), sql;
|
||||
profileDb = userData.get("profile_db").toString();
|
||||
multiDBTransactionManager.setPrimaryDs(profileDb);
|
||||
|
||||
sql = "SELECT mtb_depo.cod_mdep, mtb_depo.descrizione, mtb_depo.indirizzo, mtb_depo.citta, mtb_depo.cap, mtb_depo.prov " +
|
||||
String sql = "SELECT mtb_depo.cod_mdep, mtb_depo.descrizione, mtb_depo.indirizzo, mtb_depo.citta, mtb_depo.cap, mtb_depo.prov " +
|
||||
"FROM mtb_depo INNER JOIN wtb_depo ON wtb_depo.cod_mdep = mtb_depo.cod_mdep " +
|
||||
" INNER JOIN wtb_users ON wtb_depo.user_name = wtb_users.user_name AND " +
|
||||
" wtb_users.key_group = 10 " +
|
||||
|
||||
Reference in New Issue
Block a user