refactored imporsanate user
parent
9573f422a6
commit
5137fffb56
|
|
@ -85,10 +85,6 @@ public class RemedyJavaAPI {
|
||||||
* @throws ARException when the user is unknown
|
* @throws ARException when the user is unknown
|
||||||
*/
|
*/
|
||||||
public void impersonateUser(String userName) throws ARException {
|
public void impersonateUser(String userName) throws ARException {
|
||||||
|
|
||||||
if(!this.appConfig.getRssoActive())
|
|
||||||
server.impersonateUser("WuiQualityKV");
|
|
||||||
|
|
||||||
server.impersonateUser(userName);
|
server.impersonateUser(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import com.bmc.thirdparty.org.springframework.beans.factory.annotation.Autowired;
|
import com.bmc.thirdparty.org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.nttdata.calender.ApplicationConfig;
|
import com.nttdata.calender.ApplicationConfig;
|
||||||
|
import com.nttdata.calender.api.RemedyJavaAPI;
|
||||||
/**
|
/**
|
||||||
* Interceptor for handling Rsso related operations.
|
* Interceptor for handling Rsso related operations.
|
||||||
*/
|
*/
|
||||||
|
|
@ -19,11 +20,14 @@ public class RssoInterceptor implements HandlerInterceptor {
|
||||||
private final Rsso rsso;
|
private final Rsso rsso;
|
||||||
private static final Logger applicationLogger = LogManager.getLogger("application");
|
private static final Logger applicationLogger = LogManager.getLogger("application");
|
||||||
private ApplicationConfig appConfig;
|
private ApplicationConfig appConfig;
|
||||||
|
//EW env Fix
|
||||||
|
private final RemedyJavaAPI javaAPI;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public RssoInterceptor(Rsso rsso, ApplicationConfig appConfig) {
|
public RssoInterceptor(Rsso rsso, ApplicationConfig appConfig, RemedyJavaAPI javaAPI) {
|
||||||
this.rsso = rsso;
|
this.rsso = rsso;
|
||||||
this.appConfig=appConfig;
|
this.appConfig=appConfig;
|
||||||
|
this.javaAPI=javaAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -43,6 +47,7 @@ public class RssoInterceptor implements HandlerInterceptor {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
// Check if a session exists, create one if not
|
// Check if a session exists, create one if not
|
||||||
if (!this.appConfig.getRssoActive()) {
|
if (!this.appConfig.getRssoActive()) {
|
||||||
|
this.javaAPI.impersonateUser("WuiQualityKV");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class Approval {
|
||||||
// Clear the list before processing a new request
|
// Clear the list before processing a new request
|
||||||
listOfFieldValues.clear();
|
listOfFieldValues.clear();
|
||||||
|
|
||||||
remedyJavaAPI.impersonateUser("WuiQualityKV");
|
//remedyJavaAPI.impersonateUser("WuiQualityKV");
|
||||||
String action = "APPROVAL";
|
String action = "APPROVAL";
|
||||||
|
|
||||||
var queryUpdate = new Query.QueryBuilder("ASF:CHG_CAL_Interactions")
|
var queryUpdate = new Query.QueryBuilder("ASF:CHG_CAL_Interactions")
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class Presets {
|
||||||
this.presets = new ArrayList<>();
|
this.presets = new ArrayList<>();
|
||||||
this.listOfFieldValues = new ArrayList<>();
|
this.listOfFieldValues = new ArrayList<>();
|
||||||
|
|
||||||
api.impersonateUser("WuiQualityKV");
|
//api.impersonateUser("WuiQualityKV");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class SupportGroup {
|
||||||
*/
|
*/
|
||||||
public void querySupportGroups(RemedyJavaAPI api) throws ARException, NotFoundError {
|
public void querySupportGroups(RemedyJavaAPI api) throws ARException, NotFoundError {
|
||||||
|
|
||||||
api.impersonateUser("WuiQualityKV");
|
//api.impersonateUser("WuiQualityKV");
|
||||||
|
|
||||||
applicationLogger.info("\n\n\nRequest: querySupportGroups (Initial)\nUser: " + api.getUser() + "\nAdmin? "
|
applicationLogger.info("\n\n\nRequest: querySupportGroups (Initial)\nUser: " + api.getUser() + "\nAdmin? "
|
||||||
+ (api.isAdministrator() ? "Yes" : "No"));
|
+ (api.isAdministrator() ? "Yes" : "No"));
|
||||||
|
|
@ -112,7 +112,7 @@ public class SupportGroup {
|
||||||
* @throws ARException if an error occurs during the query
|
* @throws ARException if an error occurs during the query
|
||||||
*/
|
*/
|
||||||
public void queryUserSupportGroup(RemedyJavaAPI api) throws ARException {
|
public void queryUserSupportGroup(RemedyJavaAPI api) throws ARException {
|
||||||
api.impersonateUser("WuiQualityKV");
|
//api.impersonateUser("WuiQualityKV");
|
||||||
|
|
||||||
var querySupportGroups = new Query.QueryBuilder("CTM:Support Group Association")
|
var querySupportGroups = new Query.QueryBuilder("CTM:Support Group Association")
|
||||||
.addFieldId("SupportGroupId", 1000000079).build();
|
.addFieldId("SupportGroupId", 1000000079).build();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue