import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
-import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.binary.Hex;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.onap.portalapp.portal.logging.aop.EPAuditLog;
import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
import org.onap.portalapp.portal.logging.logic.EPLogUtil;
-import org.onap.portalapp.portal.transport.BulkUploadRoleFunction;
-import org.onap.portalapp.portal.transport.BulkUploadUserRoles;
-import org.onap.portalapp.portal.transport.CentralApp;
-import org.onap.portalapp.portal.transport.CentralRole;
-import org.onap.portalapp.portal.transport.CentralRoleFunction;
-import org.onap.portalapp.portal.transport.CentralUser;
-import org.onap.portalapp.portal.transport.CentralUserApp;
-import org.onap.portalapp.portal.transport.CentralV2Role;
-import org.onap.portalapp.portal.transport.CentralV2User;
-import org.onap.portalapp.portal.transport.CentralV2UserApp;
-import org.onap.portalapp.portal.transport.CentralizedAppRoles;
-import org.onap.portalapp.portal.transport.EPUserAppCurrentRoles;
-import org.onap.portalapp.portal.transport.EcompUserRoles;
-import org.onap.portalapp.portal.transport.ExternalAccessPerms;
-import org.onap.portalapp.portal.transport.ExternalAccessPermsDetail;
-import org.onap.portalapp.portal.transport.ExternalAccessRole;
-import org.onap.portalapp.portal.transport.ExternalAccessRolePerms;
-import org.onap.portalapp.portal.transport.ExternalAccessUser;
-import org.onap.portalapp.portal.transport.ExternalAccessUserRoleDetail;
-import org.onap.portalapp.portal.transport.ExternalRequestFieldsValidator;
-import org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction;
-import org.onap.portalapp.portal.transport.LocalRole;
+import org.onap.portalapp.portal.transport.*;
import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
import org.onap.portalapp.portal.utils.EcompPortalUtils;
import org.onap.portalapp.portal.utils.PortalConstants;
logger.debug(EELFLoggerDelegate.debugLogger, "getSingleAppRole: Connecting to External Auth system");
response = template.exchange(
SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "roles/"
- + app.getNameSpace()
- + "." + addRole
+ + app.getNameSpace() + "." + addRole
.replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"),
HttpMethod.GET, entity, String.class);
logger.debug(EELFLoggerDelegate.debugLogger,
* @param updateExtRole
* @param app
* @return true if success else false
- * @throws Exception
- * If updateRoleInExternalSystem fails we catch it in logger for
- * detail message
+ * @throws Exception If updateRoleInExternalSystem fails we catch it in logger
+ * for detail message
*/
private boolean updateRoleInExternalSystem(Role updateExtRole, EPApp app, boolean isGlobalRole) throws Exception {
boolean response = false;
}
/*
- * Adds function to the role in the external auth system while editing a
- * role or updating new functions to a role
+ * Adds function to the role in the external auth system while editing a role or
+ * updating new functions to a role
*
*/
private boolean addFunctionsToRoleInExternalAuthSystem(Role updateExtRole, EPApp app, ObjectMapper mapper,
/**
*
- * It converts list of functions in updateExtRole parameter to the
- * RoleFunction object
+ * It converts list of functions in updateExtRole parameter to the RoleFunction
+ * object
*
* @param updateExtRole
* @return list of functions
* @param newRole
* @param app
* @return true if successfully added in the system else false
- * @throws Exception
- * If fails to add role in the system
+ * @throws Exception If fails to add role in the system
*/
private void addNewRoleInExternalSystem(List<EPRole> newRole, EPApp app)
throws Exception, HttpClientErrorException {
*
* It updates existing role in the External Auth System
*
- * @param addRole
- * It Contains role information
+ * @param addRole It Contains role information
* @param app
* @return string which is formatted to match with the external auth system
* @throws JsonProcessingException
*
* @param checkRole
* @param app
- * @throws Exception
- * If role exits
+ * @throws Exception If role exits
*/
private void checkIfRoleExitsInExternalSystem(Role checkRole, EPApp app) throws Exception {
getNameSpaceIfExists(app);
/**
*
- * It filters the app functions which starts with similar name in the result
- * set
+ * It filters the app functions which starts with similar name in the result set
*
* @param roleFunc
* @param roleFunction
}
/**
- * It returns user detail information which is deep copy of EPUser.class
- * object
+ * It returns user detail information which is deep copy of EPUser.class object
*
* @param userInfo
* @param userAppSet
@SuppressWarnings("unchecked")
private CentralV2User createEPUser(EPUser userInfo, Set<EPUserApp> userAppSet, EPApp app) throws Exception {
final Map<String, Long> params = new HashMap<>();
- CentralV2User userAppList = new CentralV2User();
+ CentralV2User userAppList = new CentralV2User.CentralV2UserBuilder().createCentralV2User();
CentralV2User user1 = null;
final Map<String, Long> params1 = new HashMap<>();
List<EPRole> globalRoleList = new ArrayList<>();
&& (globalRole.toLowerCase().startsWith("global_")))) {
CentralV2UserApp cua = new CentralV2UserApp();
cua.setUserId(null);
- CentralApp cenApp = new CentralApp(1L, epApp.getCreated(), epApp.getModified(),
- epApp.getCreatedId(), epApp.getModifiedId(), epApp.getRowNum(), epApp.getName(),
- epApp.getImageUrl(), epApp.getDescription(), epApp.getNotes(), epApp.getUrl(),
- epApp.getAlternateUrl(), epApp.getAppRestEndpoint(), epApp.getMlAppName(),
- epApp.getMlAppAdminId(), String.valueOf(epApp.getMotsId()), epApp.getAppPassword(),
- String.valueOf(epApp.getOpen()), String.valueOf(epApp.getEnabled()),
- epApp.getThumbnail(), epApp.getUsername(), epApp.getUebKey(), epApp.getUebSecret(),
- epApp.getUebTopicName());
+ CentralApp cenApp = new CentralApp.CentralAppBuilder().setId(1L).setCreated(epApp.getCreated())
+ .setModified(epApp.getModified()).setCreatedId(epApp.getCreatedId())
+ .setModifiedId(epApp.getModifiedId()).setRowNum(epApp.getRowNum())
+ .setName(epApp.getName()).setImageUrl(epApp.getImageUrl())
+ .setDescription(epApp.getDescription()).setNotes(epApp.getNotes())
+ .setUrl(epApp.getUrl()).setAlternateUrl(epApp.getAlternateUrl())
+ .setRestEndpoint(epApp.getAppRestEndpoint()).setMlAppName(epApp.getMlAppName())
+ .setMlAppAdminId(epApp.getMlAppAdminId()).setMotsId(String.valueOf(epApp.getMotsId()))
+ .setAppPassword(epApp.getAppPassword()).setOpen(String.valueOf(epApp.getOpen()))
+ .setEnabled(String.valueOf(epApp.getEnabled())).setThumbnail(epApp.getThumbnail())
+ .setUsername(epApp.getUsername()).setUebKey(epApp.getUebKey())
+ .setUebSecret(epApp.getUebSecret()).setUebTopicName(epApp.getUebTopicName())
+ .createCentralApp();
cenApp.setAppPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD);
cua.setApp(cenApp);
Long appId = null;
} else {
userRoleId = userApp.getRole().getAppRoleId();
}
- CentralV2Role cenRole = new CentralV2Role(userRoleId, userApp.getRole().getCreated(),
- userApp.getRole().getModified(), userApp.getRole().getCreatedId(),
- userApp.getRole().getModifiedId(), userApp.getRole().getRowNum(),
- userApp.getRole().getName(), userApp.getRole().getActive(),
- userApp.getRole().getPriority(), roleFunctionSet, null, null);
+ CentralV2Role cenRole = new CentralV2Role.CentralV2RoleBuilder().setId(userRoleId)
+ .setCreated(userApp.getRole().getCreated()).setModified(userApp.getRole().getModified())
+ .setCreatedId(userApp.getRole().getCreatedId())
+ .setModifiedId(userApp.getRole().getModifiedId())
+ .setRowNum(userApp.getRole().getRowNum()).setName(userApp.getRole().getName())
+ .setActive(userApp.getRole().getActive()).setPriority(userApp.getRole().getPriority())
+ .setRoleFunctions(roleFunctionSet).setChildRoles(null).setParentRoles(null)
+ .createCentralV2Role();
cua.setRole(cenRole);
userAppList.getUserApps().add(cua);
}
}
}
- user1 = new CentralV2User(null, userInfo.getCreated(), userInfo.getModified(), userInfo.getCreatedId(),
- userInfo.getModifiedId(), userInfo.getRowNum(), userInfo.getOrgId(), userInfo.getManagerId(),
- userInfo.getFirstName(), userInfo.getMiddleInitial(), userInfo.getLastName(), userInfo.getPhone(),
- userInfo.getFax(), userInfo.getCellular(), userInfo.getEmail(), userInfo.getAddressId(),
- userInfo.getAlertMethodCd(), userInfo.getHrid(), userInfo.getOrgUserId(), userInfo.getOrgCode(),
- userInfo.getAddress1(), userInfo.getAddress2(), userInfo.getCity(), userInfo.getState(),
- userInfo.getZipCode(), userInfo.getCountry(), userInfo.getOrgManagerUserId(),
- userInfo.getLocationClli(), userInfo.getBusinessCountryCode(), userInfo.getBusinessCountryName(),
- userInfo.getBusinessUnit(), userInfo.getBusinessUnitName(), userInfo.getDepartment(),
- userInfo.getDepartmentName(), userInfo.getCompanyCode(), userInfo.getCompany(),
- userInfo.getZipCodeSuffix(), userInfo.getJobTitle(), userInfo.getCommandChain(),
- userInfo.getSiloStatus(), userInfo.getCostCenter(), userInfo.getFinancialLocCode(),
- userInfo.getLoginId(), userInfo.getLoginPwd(), userInfo.getLastLoginDate(), userInfo.getActive(),
- userInfo.getInternal(), userInfo.getSelectedProfileId(), userInfo.getTimeZoneId(),
- userInfo.isOnline(), userInfo.getChatId(), userAppList.getUserApps(), null);
+ user1 = new CentralV2User.CentralV2UserBuilder().setId(null).setCreated(userInfo.getCreated())
+ .setModified(userInfo.getModified()).setCreatedId(userInfo.getCreatedId())
+ .setModifiedId(userInfo.getModifiedId()).setRowNum(userInfo.getRowNum())
+ .setOrgId(userInfo.getOrgId()).setManagerId(userInfo.getManagerId())
+ .setFirstName(userInfo.getFirstName()).setMiddleInitial(userInfo.getMiddleInitial())
+ .setLastName(userInfo.getLastName()).setPhone(userInfo.getPhone()).setFax(userInfo.getFax())
+ .setCellular(userInfo.getCellular()).setEmail(userInfo.getEmail())
+ .setAddressId(userInfo.getAddressId()).setAlertMethodCd(userInfo.getAlertMethodCd())
+ .setHrid(userInfo.getHrid()).setOrgUserId(userInfo.getOrgUserId()).setOrgCode(userInfo.getOrgCode())
+ .setAddress1(userInfo.getAddress1()).setAddress2(userInfo.getAddress2()).setCity(userInfo.getCity())
+ .setState(userInfo.getState()).setZipCode(userInfo.getZipCode()).setCountry(userInfo.getCountry())
+ .setOrgManagerUserId(userInfo.getOrgManagerUserId()).setLocationClli(userInfo.getLocationClli())
+ .setBusinessCountryCode(userInfo.getBusinessCountryCode())
+ .setBusinessCountryName(userInfo.getBusinessCountryName())
+ .setBusinessUnit(userInfo.getBusinessUnit()).setBusinessUnitName(userInfo.getBusinessUnitName())
+ .setDepartment(userInfo.getDepartment()).setDepartmentName(userInfo.getDepartmentName())
+ .setCompanyCode(userInfo.getCompanyCode()).setCompany(userInfo.getCompany())
+ .setZipCodeSuffix(userInfo.getZipCodeSuffix()).setJobTitle(userInfo.getJobTitle())
+ .setCommandChain(userInfo.getCommandChain()).setSiloStatus(userInfo.getSiloStatus())
+ .setCostCenter(userInfo.getCostCenter()).setFinancialLocCode(userInfo.getFinancialLocCode())
+ .setLoginId(userInfo.getLoginId()).setLoginPwd(userInfo.getLoginPwd())
+ .setLastLoginDate(userInfo.getLastLoginDate()).setActive(userInfo.getActive())
+ .setInternal(userInfo.getInternal()).setSelectedProfileId(userInfo.getSelectedProfileId())
+ .setTimeZoneId(userInfo.getTimeZoneId()).setOnline(userInfo.isOnline())
+ .setChatId(userInfo.getChatId()).setUserApps(userAppList.getUserApps()).setPseudoRoles(null)
+ .createCentralV2User();
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "createEPUser: createEPUser failed", e);
throw e;
public CentralV2Role getRoleInfo(Long roleId, String uebkey) throws Exception {
final Map<String, Long> params = new HashMap<>();
List<CentralV2Role> roleList = new ArrayList<>();
- CentralV2Role cenRole = new CentralV2Role();
+ CentralV2Role cenRole = new CentralV2Role.CentralV2RoleBuilder().createCentralV2Role();
List<EPRole> roleInfo = null;
List<EPApp> app = null;
try {
return roleInfo;
}
+ @Override
@SuppressWarnings("unchecked")
- private List<EPRole> getPortalAppRoleInfo(Long roleId) {
+ public List<EPRole> getPortalAppRoleInfo(Long roleId) {
List<EPRole> roleInfo;
final Map<String, Long> getPortalAppRoleParams = new HashMap<>();
getPortalAppRoleParams.put("roleId", roleId);
/**
*
- * It returns list of app roles along with role functions and which went
- * through deep copy
+ * It returns list of app roles along with role functions and which went through
+ * deep copy
*
* @param app
* @param roleInfo
SortedSet<CentralV2Role> childRoles = new TreeSet<>();
SortedSet<CentralV2Role> parentRoles = new TreeSet<>();
CentralV2Role cenRole = null;
- if (role.getAppRoleId() == null) {
- cenRole = new CentralV2Role(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(),
- role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(),
- roleFunctionSet, childRoles, parentRoles);
- } else {
- cenRole = new CentralV2Role(role.getAppRoleId(), role.getCreated(), role.getModified(),
- role.getCreatedId(), role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(),
- role.getPriority(), roleFunctionSet, childRoles, parentRoles);
- }
+ if (role.getAppRoleId() == null) {
+ cenRole = new CentralV2Role.CentralV2RoleBuilder().setId(role.getId()).setCreated(role.getCreated())
+ .setModified(role.getModified()).setCreatedId(role.getCreatedId())
+ .setModifiedId(role.getModifiedId()).setRowNum(role.getRowNum()).setName(role.getName())
+ .setActive(role.getActive()).setPriority(role.getPriority()).setRoleFunctions(roleFunctionSet)
+ .setChildRoles(childRoles).setParentRoles(parentRoles).createCentralV2Role();
+ } else {
+ cenRole = new CentralV2Role.CentralV2RoleBuilder().setId(role.getAppRoleId())
+ .setCreated(role.getCreated()).setModified(role.getModified()).setCreatedId(role.getCreatedId())
+ .setModifiedId(role.getModifiedId()).setRowNum(role.getRowNum()).setName(role.getName())
+ .setActive(role.getActive()).setPriority(role.getPriority()).setRoleFunctions(roleFunctionSet)
+ .setChildRoles(childRoles).setParentRoles(parentRoles).createCentralV2Role();
+ }
roleList.add(cenRole);
}
return roleList;
@Override
public CentralV2RoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception {
String code = EcompPortalUtils.getFunctionCode(functionCode);
- String encodedCode = encodeFunctionCode(code);
+ String encodedCode = EcompPortalUtils.encodeFunctionCode(code);
CentralV2RoleFunction roleFunc = null;
EPApp app = getApp(uebkey).get(0);
List<CentralV2RoleFunction> getRoleFuncList = null;
throws Exception {
boolean saveOrUpdateFunction = false;
try {
- domainCentralRoleFunction.setCode(encodeFunctionCode(domainCentralRoleFunction.getCode()));
+ if(EcompPortalUtils.checkFunctionCodeHasEncodePattern(domainCentralRoleFunction.getCode()))
+ domainCentralRoleFunction.setCode(EcompPortalUtils.encodeFunctionCode(domainCentralRoleFunction.getCode()));
final Map<String, String> functionParams = new HashMap<>();
functionParams.put("appId", String.valueOf(app.getId()));
if (EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) {
if (extPerms.getJSONObject(i).has("description")) {
description = extPerms.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION);
} else {
- description = extPerms.getJSONObject(i).getString("type") + "|"
+ description = extPerms.getJSONObject(i).getString("type").substring(app.getNameSpace().length() + 1) + "|"
+ extPerms.getJSONObject(i).getString("instance") + "|"
+ extPerms.getJSONObject(i).getString("action");
}
/**
*
- * While sync functions form external auth system if new role found we
- * should add in local and return Role.class object
+ * While sync functions form external auth system if new role found we should
+ * add in local and return Role.class object
*
* @param app
* @param role
}
}
- /**
- *
- * It checks description in External Auth System if found any
- * changes updates in DB
- *
- * @param app
- * @param finalRoleList
- * contains list of External Auth System roles list which is
- * converted to EPRole
- */
- @SuppressWarnings("unchecked")
- private void checkAndUpdateRoleInDB(EPApp app, List<EPRole> finalRoleList) {
- for (EPRole roleItem : finalRoleList) {
- final Map<String, String> roleParams = new HashMap<>();
- List<EPRole> currentList = null;
- roleParams.put(APP_ROLE_NAME_PARAM, roleItem.getName());
- if (app.getId() == 1) {
- currentList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, roleParams, null);
- } else {
- roleParams.put(APP_ID, app.getId().toString());
- currentList = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM,
- roleParams, null);
- }
- if (!currentList.isEmpty()) {
- try {
- Boolean aafRoleActive;
- Boolean localRoleActive;
- boolean result;
- aafRoleActive = Boolean.valueOf(roleItem.getActive());
- localRoleActive = Boolean.valueOf(currentList.get(0).getActive());
- result = aafRoleActive.equals(localRoleActive);
- EPRole updateRole = currentList.get(0);
- if (!result) {
- updateRole.setActive(roleItem.getActive());
- dataAccessService.saveDomainObject(updateRole, null);
- }
- if (roleItem.getPriority() != null
- && !currentList.get(0).getPriority().equals(roleItem.getPriority())) {
- updateRole.setPriority(roleItem.getPriority());
- dataAccessService.saveDomainObject(updateRole, null);
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "syncApplicationRolesWithEcompDB: Failed to update role ", e);
- }
- }
- }
- }
-
/**
*
* It de-activates application roles in DB if not present in External Auth
- * system
+ * system
*
* @param app
- * @param finalRoleList
- * contains list of current roles present in External Auth System
- * @param applicationRolesList
- * contains list of current roles present in DB
+ * @param finalRoleList contains list of current roles present in
+ * External Auth System
+ * @param applicationRolesList contains list of current roles present in DB
*/
@SuppressWarnings("unchecked")
private void inactiveRolesNotInExternalAuthSystem(EPApp app, List<EPRole> finalRoleList,
final Map<String, String> extRoleParams = new HashMap<>();
List<EPRole> roleList = null;
extRoleParams.put(APP_ROLE_NAME_PARAM, role.getName());
- if (!checkRolesInactive.containsKey(role.getName()
- .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"))) {
+ if (!checkRolesInactive.containsKey(role.getName())) {
if (app.getId() == 1) {
roleList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, extRoleParams, null);
} else {
roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId",
appFuncsParams, null);
}
- if (!roleFunction.isEmpty()) {
+ if (!roleFunction.isEmpty() && roleId != null) {
EPAppRoleFunction apRoleFunction = new EPAppRoleFunction();
apRoleFunction.setAppId(app.getId());
apRoleFunction.setRoleId(roleId);
}
}
if (!found) {
- CentralV2Role cenrole = new CentralV2Role();
+ CentralV2Role cenrole = new CentralV2Role.CentralV2RoleBuilder().createCentralV2Role();
cenrole.setName(role.getRoleName());
cenrole.setId(role.getRoleId());
cenrole.setActive(role.isActive());
}
private CentralV2Role convertRoleToCentralV2Role(EPRole role) {
- return new CentralV2Role(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(),
- role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(),
- new TreeSet<>(), new TreeSet<>(), new TreeSet<>());
+ return new CentralV2Role.CentralV2RoleBuilder().setId(role.getId()).setCreated(role.getCreated())
+ .setModified(role.getModified()).setCreatedId(role.getCreatedId()).setModifiedId(role.getModifiedId())
+ .setRowNum(role.getRowNum()).setName(role.getName()).setActive(role.getActive())
+ .setPriority(role.getPriority()).setRoleFunctions(new TreeSet<>()).setChildRoles(new TreeSet<>())
+ .setParentRoles(new TreeSet<>()).createCentralV2Role();
}
@Override
cua.setRole(role);
userApps.add(cua);
}
- return new CentralUser(cenV2User.getId(), cenV2User.getCreated(), cenV2User.getModified(),
- cenV2User.getCreatedId(), cenV2User.getModifiedId(), cenV2User.getRowNum(), cenV2User.getOrgId(),
- cenV2User.getManagerId(), cenV2User.getFirstName(), cenV2User.getMiddleInitial(),
- cenV2User.getLastName(), cenV2User.getPhone(), cenV2User.getFax(), cenV2User.getCellular(),
- cenV2User.getEmail(), cenV2User.getAddressId(), cenV2User.getAlertMethodCd(), cenV2User.getHrid(),
- cenV2User.getOrgUserId(), cenV2User.getOrgCode(), cenV2User.getAddress1(), cenV2User.getAddress2(),
- cenV2User.getCity(), cenV2User.getState(), cenV2User.getZipCode(), cenV2User.getCountry(),
- cenV2User.getOrgManagerUserId(), cenV2User.getLocationClli(), cenV2User.getBusinessCountryCode(),
- cenV2User.getBusinessCountryName(), cenV2User.getBusinessUnit(), cenV2User.getBusinessUnitName(),
- cenV2User.getDepartment(), cenV2User.getDepartmentName(), cenV2User.getCompanyCode(),
- cenV2User.getCompany(), cenV2User.getZipCodeSuffix(), cenV2User.getJobTitle(),
- cenV2User.getCommandChain(), cenV2User.getSiloStatus(), cenV2User.getCostCenter(),
- cenV2User.getFinancialLocCode(), cenV2User.getLoginId(), cenV2User.getLoginPwd(),
- cenV2User.getLastLoginDate(), cenV2User.isActive(), cenV2User.isInternal(),
- cenV2User.getSelectedProfileId(), cenV2User.getTimeZoneId(), cenV2User.isOnline(),
- cenV2User.getChatId(), userApps);
+ return new CentralUser.CentralUserBuilder().setId(cenV2User.getId()).setCreated(cenV2User.getCreated())
+ .setModified(cenV2User.getModified()).setCreatedId(cenV2User.getCreatedId())
+ .setModifiedId(cenV2User.getModifiedId()).setRowNum(cenV2User.getRowNum())
+ .setOrgId(cenV2User.getOrgId()).setManagerId(cenV2User.getManagerId())
+ .setFirstName(cenV2User.getFirstName()).setMiddleInitial(cenV2User.getMiddleInitial())
+ .setLastName(cenV2User.getLastName()).setPhone(cenV2User.getPhone()).setFax(cenV2User.getFax())
+ .setCellular(cenV2User.getCellular()).setEmail(cenV2User.getEmail())
+ .setAddressId(cenV2User.getAddressId()).setAlertMethodCd(cenV2User.getAlertMethodCd())
+ .setHrid(cenV2User.getHrid()).setOrgUserId(cenV2User.getOrgUserId()).setOrgCode(cenV2User.getOrgCode())
+ .setAddress1(cenV2User.getAddress1()).setAddress2(cenV2User.getAddress2()).setCity(cenV2User.getCity())
+ .setState(cenV2User.getState()).setZipCode(cenV2User.getZipCode()).setCountry(cenV2User.getCountry())
+ .setOrgManagerUserId(cenV2User.getOrgManagerUserId()).setLocationClli(cenV2User.getLocationClli())
+ .setBusinessCountryCode(cenV2User.getBusinessCountryCode())
+ .setBusinessCountryName(cenV2User.getBusinessCountryName()).setBusinessUnit(cenV2User.getBusinessUnit())
+ .setBusinessUnitName(cenV2User.getBusinessUnitName()).setDepartment(cenV2User.getDepartment())
+ .setDepartmentName(cenV2User.getDepartmentName()).setCompanyCode(cenV2User.getCompanyCode())
+ .setCompany(cenV2User.getCompany()).setZipCodeSuffix(cenV2User.getZipCodeSuffix())
+ .setJobTitle(cenV2User.getJobTitle()).setCommandChain(cenV2User.getCommandChain())
+ .setSiloStatus(cenV2User.getSiloStatus()).setCostCenter(cenV2User.getCostCenter())
+ .setFinancialLocCode(cenV2User.getFinancialLocCode()).setLoginId(cenV2User.getLoginId())
+ .setLoginPwd(cenV2User.getLoginPwd()).setLastLoginDate(cenV2User.getLastLoginDate())
+ .setActive(cenV2User.isActive()).setInternal(cenV2User.isInternal())
+ .setSelectedProfileId(cenV2User.getSelectedProfileId()).setTimeZoneId(cenV2User.getTimeZoneId())
+ .setOnline(cenV2User.isOnline()).setChatId(cenV2User.getChatId()).setUserApps(userApps)
+ .createCentralUser();
}
@Override
return userRolesAdded;
}
- @Override
- public String encodeFunctionCode(String funCode) {
- String encodedString = funCode;
- List<Pattern> encodingList = new ArrayList<>();
- encodingList.add(Pattern.compile("/"));
- encodingList.add(Pattern.compile("-"));
- for (Pattern xssInputPattern : encodingList) {
- encodedString = xssInputPattern.matcher(encodedString)
- .replaceAll("%" + Hex.encodeHexString(xssInputPattern.toString().getBytes()));
- }
- encodedString = encodedString.replaceAll("\\*", "%" + Hex.encodeHexString("*".getBytes()));
- return encodedString;
- }
-
@Override
public void bulkUploadRoleFunc(UploadRoleFunctionExtSystem data, EPApp app) throws Exception {
ObjectMapper mapper = new ObjectMapper();
ExternalAccessRolePerms extRolePerms;
ExternalAccessPerms extPerms;
extPerms = new ExternalAccessPerms(app.getNameSpace() + "." + data.getType(),
- encodeFunctionCode(data.getInstance()), data.getAction());
+ EcompPortalUtils.encodeFunctionCode(data.getInstance()), data.getAction());
String appNameSpace = "";
if (data.getIsGlobalRolePartnerFunc()) {
appNameSpace = epAppService.getApp(1l).getNameSpace();
}
return roleDescUpdated;
}
+
}