summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishore Reddy, Gujja (kg811t) <kg811t@research.att.com>2018-09-25 13:59:56 -0400
committerKishore Reddy, Gujja (kg811t) <kg811t@research.att.com>2018-09-26 16:52:00 -0400
commita59bc3e85eaf33c0a38063e5c30fe890588a0eb1 (patch)
treeb19ba17d5dbd6cecc0b34c0ef6b158c088746384
parent4be6886a011ddbc4543e8c27b759a27ff3415c18 (diff)
login and Certman AAF Integration changes
Issue-ID: PORTAL-386, PORTAL-389 failed to create user with special char in login_id Change-Id: I415adf615a7af97319d8d11a740e75d3dfa11583 Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
-rw-r--r--deliveries/.env7
-rw-r--r--deliveries/Apps_Users_OnBoarding_Script.sql9
-rw-r--r--deliveries/Dockerfile.portal2
-rwxr-xr-xdeliveries/build_portalapps_dockers.sh3
-rw-r--r--deliveries/docker-compose.yml11
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java95
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java8
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java4
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java39
-rw-r--r--ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml18
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java10
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java58
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java124
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java15
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java7
-rw-r--r--ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java22
-rw-r--r--ecomp-portal-FE-common/client/app/views/tabs/tabframe.html10
-rw-r--r--ecomp-portal-FE-common/client/app/views/tabs/tabs.controller.js35
-rw-r--r--ecomp-portal-FE-os/client/src/directives/search-users/search-users.tpl.html4
-rw-r--r--ecomp-portal-widget-ms/widget-ms/pom.xml5
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java18
-rw-r--r--pom.xml7
22 files changed, 196 insertions, 315 deletions
diff --git a/deliveries/.env b/deliveries/.env
index 3b2fa140..d1cc7d61 100644
--- a/deliveries/.env
+++ b/deliveries/.env
@@ -22,6 +22,13 @@ PORTAL_TAG=casablanca
# Name of directory in apps container (NOT host)
WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps
+TOMCAT_DIR=/opt/apache-tomcat-8.0.37
+
+# Certs
+TOMCAT_KEY=keystoreONAP.keystore
+TOMCAT_TRUST=truststoreONAPall.jks
+CERT_PWD=changeit
+
# Required settings with default values.
# Export shell environment variables on ALL hosts.
diff --git a/deliveries/Apps_Users_OnBoarding_Script.sql b/deliveries/Apps_Users_OnBoarding_Script.sql
index 74017a7a..583238f0 100644
--- a/deliveries/Apps_Users_OnBoarding_Script.sql
+++ b/deliveries/Apps_Users_OnBoarding_Script.sql
@@ -15,6 +15,15 @@ INSERT INTO `fn_app` (`app_id`, `app_name`, `app_image_url`, `app_description`,
(8, 'CLI', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://portal.api.simpledemo.onap.org:8080/', NULL, NULL, '', '', NULL, '', 'Y', 'Y', NULL, '', '', '', '', 1,'N',NULL),
(9, 'MSB', 'images/cache/portal-345993588_92550.png', NULL, NULL, 'http://msb-iag:80/iui/microservices/index.html', NULL, NULL, '', '', NULL, '', 'Y', 'Y', NULL, '', '', '', '', 2,'N',NULL);
+-- aaf centralize
+
+update fn_app set auth_central = 'Y' , auth_namespace = 'org.onap.portal' where app_id = 1;
+update fn_app set auth_central = 'Y' , auth_namespace = 'org.onap.sdc' where app_id = 4;
+update fn_app set auth_central = 'Y' , auth_namespace = 'org.onap.policy' where app_id = 5;
+update fn_app set auth_central = 'Y' , auth_namespace = 'org.onap.vid' where app_id = 6;
+update fn_app set auth_central = 'Y' , auth_namespace = 'org.onap.aai' where app_id = 7;
+
+
-- insert SDC users user id2-8
Insert into fn_user (USER_ID, ORG_ID, MANAGER_ID,FIRST_NAME,MIDDLE_NAME,LAST_NAME,PHONE,FAX,CELLULAR,EMAIL,ADDRESS_ID,ALERT_METHOD_CD,HRID,ORG_USER_ID,ORG_CODE,LOGIN_ID,LOGIN_PWD,LAST_LOGIN_DATE,ACTIVE_YN,CREATED_ID,CREATED_DATE,MODIFIED_ID,MODIFIED_DATE,IS_INTERNAL_YN,ADDRESS_LINE_1,ADDRESS_LINE_2,CITY,STATE_CD,ZIP_CODE,COUNTRY_CD,LOCATION_CLLI,ORG_MANAGER_USERID,COMPANY,DEPARTMENT_NAME,JOB_TITLE,TIMEZONE,DEPARTMENT,BUSINESS_UNIT,BUSINESS_UNIT_NAME,COST_CENTER,FIN_LOC_CODE,SILO_STATUS) values (2,NULL,NULL,'Jimmy',NULL,'Hendrix',NULL,NULL,NULL,'admin@onap.org',NULL,NULL,NULL,'jh0003',NULL,'jh0003','4Gl6WL1bmwviYm+XZa6pS1vC0qKXWtn9wcZWdLx61L0=','2016-10-20 15:11:16','Y',NULL,'2016-10-14 21:00:00',1,'2016-10-20 15:11:16','N',NULL,NULL,NULL,'NJ',NULL,'US',NULL,NULL,NULL,NULL,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL);
diff --git a/deliveries/Dockerfile.portal b/deliveries/Dockerfile.portal
index 81eeb655..9b9f5489 100644
--- a/deliveries/Dockerfile.portal
+++ b/deliveries/Dockerfile.portal
@@ -11,6 +11,7 @@ ARG PORTAL_WAR=build/ecompportal-be-os.war
ARG FE_DIR=build/public
ARG HTTP_PROXY
ARG HTTPS_PROXY
+# ARG PORTAL_CERT=truststoreONAPall.jks
# Just variables, never passed in
ARG TOMCAT=apache-tomcat-8.0.37
@@ -31,6 +32,7 @@ RUN rm ${TOMCATTAR}
# Remove manager and sample apps
RUN rm -fr ${TOMCAT}/webapps/[a-z]*
RUN mkdir -p /opt
+COPY ${SERVERXML} ${TOMCAT}/conf
RUN mv ${TOMCAT} /opt
WORKDIR ${TOMCATHOME}/webapps
diff --git a/deliveries/build_portalapps_dockers.sh b/deliveries/build_portalapps_dockers.sh
index f7510acc..5092b407 100755
--- a/deliveries/build_portalapps_dockers.sh
+++ b/deliveries/build_portalapps_dockers.sh
@@ -125,13 +125,14 @@ cp $BASEDIR/ecomp-portal-DB-common/*.cql ${DELIVDIR}
# SDK app
cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-common/db-scripts/*.cql ${DELIVDIR}
-
+# Build Docker Images
echo "Build portal docker image"
PORTAL_DOCKER_CMD="
docker build -t ${EP_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
--build-arg FE_DIR=$BUILD_REL/public
--build-arg PORTAL_WAR=$BUILD_REL/portal-be-os.war
+ --build-arg SERVERXML=${DELIVDIR}/server.xml
-f $PORTAL_DOCKERFILE .
"
$PORTAL_DOCKER_CMD
diff --git a/deliveries/docker-compose.yml b/deliveries/docker-compose.yml
index bba42aac..77538542 100644
--- a/deliveries/docker-compose.yml
+++ b/deliveries/docker-compose.yml
@@ -99,6 +99,7 @@ services:
- 8989:8080
- 8010:8009
- 8006:8005
+ - 8443:8443
links:
- portal-db
- portal-wms
@@ -116,7 +117,9 @@ services:
- ${PROPS_DIR}/ONAPPORTAL/music.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/music.properties
- ${PROPS_DIR}/ONAPPORTAL/openid-connect.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/openid-connect.properties
- ${PROPS_DIR}/ONAPPORTAL/logback.xml:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/logback.xml
- - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs
+ - ./${TOMCAT_TRUST}:${TOMCAT_DIR}/${TOMCAT_TRUST}
+ - ./${TOMCAT_KEY}:${TOMCAT_DIR}/${TOMCAT_KEY}
+ - ${LOGS_DIR}:${TOMCAT_DIR}/logs
command:
- /start-apache-tomcat.sh
# see comments in .env file
@@ -128,6 +131,10 @@ services:
driver: json-file
environment:
- CATALINA_OPTS=-Xmx1536m -Xms1536m
+ - javax.net.ssl.keyStore=${TOMCAT_DIR}/${TOMCAT_TRUST}
+ - javax.net.ssl.keyStorePassword=${CERT_PWD}
+ - javax.net.ssl.trustStore=${TOMCAT_DIR}/${TOMCAT_TRUST}
+ - javax.net.ssl.trustStorePassword=${CERT_PWD}
portal-sdk:
image: ${SDK_IMG_NAME}:${PORTAL_TAG}
ports:
@@ -146,7 +153,7 @@ services:
- ${PROPS_DIR}/ONAPPORTALSDK/portal.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/portal.properties
- ${PROPS_DIR}/ONAPPORTALSDK/music.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/music.properties
- ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml
- - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs
+ - ${LOGS_DIR}:${TOMCAT_DIR}/logs
command:
- /start-apache-tomcat.sh
logging:
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
index 4197d232..a77b9589 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
@@ -867,23 +867,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
ObjectMapper mapper = new ObjectMapper();
String addNewRole = "";
ExternalAccessRole extRole = new ExternalAccessRole();
- List<EPRole> role = null;
- String addDesc = null;
- Map<String, String> extSystemUpdateRole = new LinkedHashMap<>();
- if (app.getId().equals(PortalConstants.PORTAL_APP_ID)) {
- role = getPortalAppRoleInfo(addRole.getId());
- } else {
- role = getPartnerAppRoleInfo(addRole.getId(), app);
- }
- extSystemUpdateRole.put(ID, String.valueOf(role.get(0).getId()));
- extSystemUpdateRole.put(ROLE_NAME, String.valueOf(addRole.getName()));
- extSystemUpdateRole.put(ACTIVE, String.valueOf(role.get(0).getActive()));
- extSystemUpdateRole.put(PRIORITY, String.valueOf(role.get(0).getPriority()));
- extSystemUpdateRole.put(APP_ID, String.valueOf(role.get(0).getAppId()));
- extSystemUpdateRole.put(APP_ROLE_ID, String.valueOf(role.get(0).getAppRoleId()));
- addDesc = mapper.writeValueAsString(extSystemUpdateRole);
extRole.setName(app.getNameSpace() + "." + addRole.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
- extRole.setDescription(addDesc);
+ extRole.setDescription(String.valueOf(addRole.getName()));
addNewRole = mapper.writeValueAsString(extRole);
return addNewRole;
}
@@ -897,7 +882,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
* @throws Exception
*/
@SuppressWarnings("unchecked")
- @Transactional(rollbackFor = Exception.class)
+ @Transactional(rollbackFor = Exception.class)
public boolean addRoleInEcompDB(Role addRoleInDB, EPApp app) throws Exception {
boolean result = false;
EPRole epRole = null;
@@ -2738,7 +2723,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
applicationRolesList = getAppRoles(app.getId());
List<String> applicationRoleIdList = new ArrayList<>();
for (EPRole applicationRole : applicationRolesList) {
- applicationRoleIdList.add(applicationRole.getName());
+ applicationRoleIdList.add(applicationRole.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
}
List<EPRole> roleListToBeAddInEcompDB = new ArrayList<>();
@@ -2915,30 +2900,27 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
throws IOException {
List<ExternalRoleDetails> externalRoleDetailsList = new ArrayList<>();
ExternalRoleDescription ApplicationRole = new ExternalRoleDescription();
- ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms();
+ ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms();
List<String> functionCodelist = new ArrayList<>();
+ Map<String, EPRole> curRolesMap = getCurrentRolesInDB(app);
+
for (int i = 0; i < extRole.length(); i++) {
ExternalRoleDetails externalRoleDetail = new ExternalRoleDetails();
EPAppRoleFunction ePAppRoleFunction = new EPAppRoleFunction();
JSONObject Role = (JSONObject) extRole.get(i);
- if (!extRole.getJSONObject(i).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) {
- ApplicationRole.setActive("true");
- ApplicationRole.setAppId(IS_NULL_STRING);
- ApplicationRole.setPriority(IS_NULL_STRING);
- ApplicationRole.setAppRoleId(IS_NULL_STRING);
- String roleName = extRole.getJSONObject(i).getString(ROLE_NAME);
- ApplicationRole.setName(roleName.substring(app.getNameSpace().length() + 1));
- } else {
+ String roleName = extRole.getJSONObject(i).getString(ROLE_NAME);
+ ApplicationRole.setName(roleName.substring(app.getNameSpace().length() + 1));
+ if (extRole.getJSONObject(i).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) {
String desc = extRole.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION);
- ApplicationRole = mapper.readValue(desc, ExternalRoleDescription.class);
+ ApplicationRole.setName(desc);
}
-
SortedSet<ExternalAccessPerms> externalAccessPermsOfRole = new TreeSet<>();
if (extRole.getJSONObject(i).has(EXTERNAL_AUTH_PERMS)) {
JSONArray extPerm = (JSONArray) Role.get(EXTERNAL_AUTH_PERMS);
for (int j = 0; j < extPerm.length(); j++) {
JSONObject perms = extPerm.getJSONObject(j);
- boolean isNamespaceMatching = EcompPortalUtils.checkNameSpaceMatching(perms.getString("type"), app.getNameSpace());
+ boolean isNamespaceMatching = EcompPortalUtils.checkNameSpaceMatching(perms.getString("type"),
+ app.getNameSpace());
if (isNamespaceMatching) {
externalAccessPerms = new ExternalAccessPerms(perms.getString("type"),
perms.getString("instance"), perms.getString("action"));
@@ -2949,46 +2931,33 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
}
}
-
- if (ApplicationRole.getActive().equals(IS_NULL_STRING)) {
- externalRoleDetail.setActive(false);
- } else {
- externalRoleDetail.setActive(Boolean.parseBoolean(ApplicationRole.getActive()));
- }
+ externalRoleDetail.setActive(true);
externalRoleDetail.setName(ApplicationRole.getName());
-
- if (ApplicationRole.getAppId().equals(IS_NULL_STRING) && app.getId() == 1) {
+ if (app.getId() == 1) {
externalRoleDetail.setAppId(null);
- } else if (ApplicationRole.getAppId().equals(IS_NULL_STRING)) {
- externalRoleDetail.setAppId(app.getId());
- } else {
- externalRoleDetail.setAppId(Long.parseLong(ApplicationRole.getAppId()));
- }
-
- if (ApplicationRole.getPriority().equals(IS_NULL_STRING)) {
- externalRoleDetail.setPriority(null);
} else {
- externalRoleDetail.setPriority(Integer.parseInt(ApplicationRole.getPriority()));
- }
-
- if (ApplicationRole.getAppRoleId().equals(IS_NULL_STRING) && app.getId() == 1) {
- externalRoleDetail.setAppRoleId(null);
+ externalRoleDetail.setAppId(app.getId());
}
-
+ // get role functions from DB
+ EPRole currRole = curRolesMap.get(ApplicationRole.getName()
+ .replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
+ Long roleId = null;
+ if (currRole != null)
+ roleId = currRole.getId();
// get role functions from DB
final Map<String, EPAppRoleFunction> roleFunctionsMap = new HashMap<>();
- if (!ApplicationRole.getId().equals(IS_NULL_STRING)) {
- final Map<String, Long> appRoleFuncsParams = new HashMap<>();
+ final Map<String, Long> appRoleFuncsParams = new HashMap<>();
+ if (roleId != null) {
appRoleFuncsParams.put("appId", app.getId());
- appRoleFuncsParams.put("roleId", Long.valueOf(ApplicationRole.getId()));
- List<EPAppRoleFunction> appRoleFunctions = dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null);
+ appRoleFuncsParams.put("roleId", roleId);
+ List<EPAppRoleFunction> appRoleFunctions = dataAccessService
+ .executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null);
if (!appRoleFunctions.isEmpty()) {
for (EPAppRoleFunction roleFunc : appRoleFunctions) {
roleFunctionsMap.put(roleFunc.getCode(), roleFunc);
}
}
}
-
if (!externalAccessPermsOfRole.isEmpty()) {
// Adding functions to role
for (ExternalAccessPerms externalpermission : externalAccessPermsOfRole) {
@@ -3000,22 +2969,24 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
EPAppRoleFunction checkRoleFunctionPipeExits = roleFunctionsMap.get(funcCode);
if (checkRoleFunctionPipeExits == null) {
try {
- final Map<String, String> appFuncsParams = new HashMap<>();
+ final Map<String, String> appFuncsParams = new HashMap<>();
appFuncsParams.put("appId", String.valueOf(app.getId()));
appFuncsParams.put("functionCd", externalpermission.getInstance());
logger.debug(EELFLoggerDelegate.debugLogger,
"SyncApplicationRolesWithEcompDB: Adding function to the role: {}",
externalpermission.getInstance());
List<CentralV2RoleFunction> roleFunction = null;
- roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId", appFuncsParams, null);
+ roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId",
+ appFuncsParams, null);
if (roleFunction.isEmpty()) {
appFuncsParams.put("functionCd", funcCode);
- roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId", appFuncsParams, null);
+ roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId",
+ appFuncsParams, null);
}
if (!roleFunction.isEmpty()) {
EPAppRoleFunction apRoleFunction = new EPAppRoleFunction();
apRoleFunction.setAppId(app.getId());
- apRoleFunction.setRoleId(Long.parseLong(ApplicationRole.getId()));
+ apRoleFunction.setRoleId(roleId);
apRoleFunction.setCode(roleFunction.get(0).getCode());
dataAccessService.saveDomainObject(apRoleFunction, null);
}
@@ -3089,7 +3060,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
*/
private EPRole convertExternalRoleDetailstoEpRole(ExternalRoleDetails externalRoleDetails) {
EPRole role = new EPRole();
- role.setActive(externalRoleDetails.isActive());
+ role.setActive(true);
role.setAppId(externalRoleDetails.getAppId());
role.setAppRoleId(externalRoleDetails.getAppRoleId());
role.setName(externalRoleDetails.getName());
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
index a192ad94..c766106d 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
@@ -39,9 +39,9 @@ package org.onap.portalapp.portal.service;
import java.util.ArrayList;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import org.onap.portalapp.portal.service.SearchService;
+import org.onap.portalapp.portal.service.SearchServiceImpl;
import org.onap.portalapp.portal.domain.EPUser;
import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
import org.onap.portalapp.portal.transport.UserWithNameSurnameTitle;
@@ -74,10 +74,8 @@ public class SearchServiceImpl implements SearchService {
public String searchUsersInPhoneBook(String searchString) {
String orgUserId = null;
List<String> tokens = EcompPortalUtils.parsingByRegularExpression(searchString, " ");
- Pattern pattern = Pattern.compile(EcompPortalUtils.SEARCH_USERS_REGEX);
for (int i = 0; i < tokens.size(); i++) { // find orgUserId if possible and remove it from tokens
- Matcher matcher = pattern.matcher(tokens.get(i));
- if (matcher.matches()) {
+ if (tokens.get(i).matches(".*\\d+.*")) {
orgUserId = tokens.get(i);
tokens.remove(i);
}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
index a4b6cc24..809e42f9 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
@@ -58,7 +58,6 @@ import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
import org.onap.portalapp.portal.logging.logic.EPLogUtil;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.onboarding.util.CipherUtil;
-import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
import org.onap.portalsdk.core.util.SystemProperties;
import org.slf4j.MDC;
import org.springframework.http.HttpHeaders;
@@ -80,9 +79,6 @@ public class EcompPortalUtils {
// It is a regular expression used for while creating a External Central Auth Role
public static final String EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS = "([^A-Z^a-z^0-9^\\.^%^(^)^=^:])";
- // regex for alphanumeric , dashes and underscore
- public static final String SEARCH_USERS_REGEX = "(^[a-zA-Z0-9_-]*$)";
-
/**
* @param orgUserId
* User ID to validate
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java
index 75c66162..988b97a5 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java
@@ -1,17 +1,39 @@
-/*
- * Copyright 2012-2016 the original author or authors.
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
*/
package org.onap.portalapp.portal.utils;
@@ -35,8 +57,7 @@ public final class MusicCookieCsrfTokenRepository implements CsrfTokenRepository
static final String CSRF_PARAMETER_NAME = "_csrf";
static final String EP_SERVICE = "EPService";
CookieCsrfTokenRepository cookieRepo = null;
- private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicService.class);
-
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicCookieCsrfTokenRepository.class);
public MusicCookieCsrfTokenRepository() {
}
@@ -64,12 +85,14 @@ public final class MusicCookieCsrfTokenRepository implements CsrfTokenRepository
if(cookieRepoToken==null){ // if cookieRepo does not has the token, check the cassandra for the values stored by other tomcats
try { // todo this part of the code needs to be replaced with out depending on EPService cookie
String sessionId = getSessionIdFromCookie(request);
+ if(sessionId == null)
+ return null;
String token = MusicService.getAttribute(CSRF_COOKIE_NAME, sessionId);
if (token==null || !StringUtils.hasLength(token))
return null;
cookieRepoToken = new DefaultCsrfToken(CSRF_HEADER_NAME, CSRF_PARAMETER_NAME , token);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Error while calling csrf saveToken" , e);
+ logger.error(EELFLoggerDelegate.errorLogger, "Error while calling csrf loadToken" , e);
}
}
return cookieRepoToken;
diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
index becfe7c2..e4b81448 100644
--- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
+++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
@@ -1306,9 +1306,12 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
where a.user_id =:userId and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
) A
left outer join
- (select distinct
- c.AFFECTED_RECORD_ID, c.AUDIT_DATE
- from FN_AUDIT_LOG c
+ (select FN_AUDIT_LOG.AFFECTED_RECORD_ID, max(FN_AUDIT_LOG.AUDIT_DATE) AS AUDIT_DATE
+ from FN_APP LEFT JOIN FN_AUDIT_LOG
+ on FN_APP.APP_ID = FN_AUDIT_LOG.AFFECTED_RECORD_ID
+ where FN_APP.ENABLED = 'Y' and FN_AUDIT_LOG.user_id=:userId
+ and (audit_date) BETWEEN (CURDATE() - INTERVAL 90 DAY) and CURDATE()
+ group by FN_AUDIT_LOG.AFFECTED_RECORD_ID
)B
on A.app_id = B.Affected_record_id
order by AUDIT_DATE DESC;
@@ -1349,9 +1352,12 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
) A
left outer join
- (select distinct
- c.AFFECTED_RECORD_ID, c.AUDIT_DATE
- from FN_AUDIT_LOG c
+ (select FN_AUDIT_LOG.AFFECTED_RECORD_ID, max(FN_AUDIT_LOG.AUDIT_DATE) AS AUDIT_DATE
+ from FN_APP LEFT JOIN FN_AUDIT_LOG
+ on FN_APP.APP_ID = FN_AUDIT_LOG.AFFECTED_RECORD_ID
+ where FN_APP.ENABLED = 'Y' and FN_AUDIT_LOG.user_id=:userId
+ and (audit_date) BETWEEN (CURDATE() - INTERVAL 90 DAY) and CURDATE()
+ group by FN_AUDIT_LOG.AFFECTED_RECORD_ID
)B
on A.app_id = B.Affected_record_id
order by AUDIT_DATE DESC;
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
index ee53eba0..e9c48251 100644
--- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
+++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
@@ -161,9 +161,10 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
MDC.put(MDC_SERVICE_INSTANCE_ID, "");
MDC.put(MDC_ALERT_SEVERITY, AlarmSeverityEnum.INFORMATIONAL.severity());
MDC.put(MDC_INSTANCE_UUID, SystemProperties.getProperty(SystemProperties.INSTANCE_UUID));
- if("true".equalsIgnoreCase(remotecentralizedsystemaccess)){
- importFromExternalAuth();
- }
+
+ // if("true".equalsIgnoreCase(remotecentralizedsystemaccess)){
+ // importFromExternalAuth();
+ // }
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "init failed", e);
}
@@ -174,7 +175,10 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
* for all the centralized applications between AAF and ONAP, updates
* fn_user and fn_user_role with user information from AAF.
*
+ * This is being handled in AAF directly, so it has been deprecated
+ *
*/
+ @Deprecated
private void importFromExternalAuth() throws Exception {
JSONArray aafAppRoles = new JSONArray();
JSONArray aafUserList = new JSONArray();
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java
deleted file mode 100644
index a3255480..00000000
--- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * ============LICENSE_START==========================================
- * ONAP Portal
- * ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END============================================
- *
- *
- */
-
-package org.onap.portalapp.portal.service;
-
-import org.onap.portalapp.portal.domain.EPApp;
-
-public interface AppsCacheService {
-
- /**
- * returns an app by id from the cache
- * @param appId
- * @return corresponding App
- */
- EPApp getApp(Long appId);
-
- /**
- * returns the corresponding application endpoint
- * @param appId
- * @return if appId exists in cache, then return corresponding application endpoint, null otherwise.
- */
- String getAppEndpoint(Long appId);
-}
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java
deleted file mode 100644
index e6306c9c..00000000
--- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START==========================================
- * ONAP Portal
- * ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END============================================
- *
- *
- */
-package org.onap.portalapp.portal.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-
-import org.onap.portalapp.portal.domain.EPApp;
-import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
-import org.onap.portalapp.portal.service.AppsCacheService;
-import org.onap.portalapp.portal.service.EPAppService;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.stereotype.Service;
-
-@Service("appsCacheService")
-@org.springframework.context.annotation.Configuration
-@EnableAspectJAutoProxy
-@EPMetricsLog
-public class AppsCacheServiceImple implements AppsCacheService {
- @Autowired
- EPAppService appsService;
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsCacheServiceImple.class);
-
- private static long updateTime = 0;
- private static final int cacheUpdateIntervalInSeconds = 10;
-
- private static volatile Map<Long, EPApp> appsMap;
-
- @PostConstruct
- public void init() {
- this.refreshAppsMap();
- }
-
- private Map<Long, EPApp> refreshAppsMap() {
- long now = System.currentTimeMillis();
-
- if(noNeedToUpdate(now))
- return null;
-
- synchronized (this) {
- if(noNeedToUpdate(now))
- return null;
- List<EPApp> allApps = appsService.getAppsFullList();
- Map<Long, EPApp> newAppsMap = new HashMap<Long, EPApp>();
- for (EPApp app : allApps) {
- newAppsMap.put(app.getId(), app);
- }
- // Switch cache with the new one.
- appsMap = newAppsMap;
- updateTime = now;
- }
-
- return appsMap;
- }
-
- private boolean noNeedToUpdate(long now) {
- long secondsPassed = (now - updateTime)/1000;
- if(secondsPassed < cacheUpdateIntervalInSeconds){
- logger.debug(EELFLoggerDelegate.debugLogger, "no need to refresh yet, seconds since last refresh: " + secondsPassed + ", refresh interval (sec) = " + cacheUpdateIntervalInSeconds);
- return true; // no need to update cache
- }
- return false; // its time to update
- }
-
- @Override
- public String getAppEndpoint(Long appId) {
- refreshAppsMap();
- EPApp app = appsMap.get(appId);
- if(app != null)
- return app.getAppRestEndpoint();
- return null;
- }
-
- @Override
- public EPApp getApp(Long appId) {
- refreshAppsMap();
- EPApp app = appsMap.get(appId);
- if(app != null)
- return app;
- return null;
- }
-
-}
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
index 48f6d298..e0934713 100644
--- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
+++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal
* ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -79,18 +79,13 @@ public class SearchServiceImpl implements SearchService {
public String searchUsersInFnTable(String searchString) {
String orgUserId = null;
List<String> tokens = EcompPortalUtils.parsingByRegularExpression(searchString, " ");
- for (int i = 0; i < tokens.size(); i++) { // find userid if possible and remove it from tokens
- if (tokens.get(i).matches(".*\\d+.*")) {
- orgUserId = tokens.get(i);
- tokens.remove(i);
- }
- }
while (tokens.size() > 2) { // we use no more then first 2 tokens (userId is removed, see above)
tokens.remove(tokens.size() - 1);
}
EPUser attrUser = new EPUser();
attrUser.setOrgUserId(orgUserId);
- List<UserWithNameSurnameTitle> resultOfSearch = new ArrayList<UserWithNameSurnameTitle>(), resultOfAdditionalSearch = null;
+ List<UserWithNameSurnameTitle> resultOfSearch = new ArrayList<UserWithNameSurnameTitle>(), resultOfAdditionalSearch = null,
+ resultOfSearchUserId = new ArrayList<UserWithNameSurnameTitle>();
if (tokens.size() == 2) {
attrUser.setFirstName(tokens.get(0));
attrUser.setLastName(tokens.get(1));
@@ -107,6 +102,7 @@ public class SearchServiceImpl implements SearchService {
} else if (tokens.size() == 1) {
attrUser.setFirstName(tokens.get(0));
resultOfSearch = this.searchUsersByName(attrUser);
+ resultOfSearchUserId = this.searchUsersByUserId(attrUser);
resultOfSearch = this.removeWrongFirstNames(resultOfSearch, tokens.get(0));
if (resultOfSearch.size() < maxSizeOfSearchResult) {
attrUser.setFirstName(null);
@@ -114,12 +110,11 @@ public class SearchServiceImpl implements SearchService {
resultOfAdditionalSearch = this.searchUsersByName(attrUser);
resultOfAdditionalSearch = this.removeWrongLastNames(resultOfAdditionalSearch, tokens.get(0));
}
- } else if (orgUserId != null) {
- resultOfSearch = this.searchUsersByUserId(attrUser);
}
if (resultOfAdditionalSearch != null) {
resultOfSearch.addAll(resultOfAdditionalSearch);
}
+ resultOfSearch.addAll(resultOfSearchUserId);
resultOfSearch = this.cutSearchResultToMaximumSize(resultOfSearch);
ObjectMapper mapper = new ObjectMapper();
String result = "[]";
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java
index b5ccfc02..fccd4ff8 100644
--- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java
+++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java
@@ -159,9 +159,12 @@ public class UserServiceImpl implements UserService {
List list = null;
StringBuffer criteria = new StringBuffer();
- if (firstName != null)
+ if (firstName != null && lastName != null)
+ criteria.append(" where first_name = '").append(firstName).append("' and last_name = '")
+ .append(lastName).append("'");
+ else if (firstName != null)
criteria.append(" where first_name = '").append(firstName).append("'");
- if (lastName != null)
+ else if (lastName != null)
criteria.append(" where last_name = '").append(lastName).append("'");
list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null);
return (list == null || list.size() == 0) ? null : list;
diff --git a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java
index 6b24e96d..04234059 100644
--- a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java
+++ b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal
* ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -37,7 +37,8 @@
*/
package org.onap.portalapp.portal.service;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import java.util.List;
@@ -55,8 +56,6 @@ import org.mockito.MockitoAnnotations;
import org.onap.portalapp.portal.domain.EPUser;
import org.onap.portalapp.portal.framework.MockEPUser;
import org.onap.portalapp.portal.framework.MockitoTestSuite;
-import org.onap.portalapp.portal.service.SearchServiceImpl;
-import org.onap.portalapp.portal.service.UserService;
import org.onap.portalapp.portal.transport.UserWithNameSurnameTitle;
import org.onap.portalapp.portal.utils.EcompPortalUtils;
import org.powermock.api.mockito.PowerMockito;
@@ -105,19 +104,18 @@ public class SearchServiceImplTest {
PowerMockito.mockStatic(EcompPortalUtils.class);
List<String> list = new ArrayList<>();
String str = "Test";
- String str2 = "Test new";
- String str1 = "Test new1";
+ String str1 = "Testnew";
list.add(str);
list.add(str1);
- list.add(str2);
- Mockito.when(EcompPortalUtils.parsingByRegularExpression("Test", " ")).thenReturn(list);
+ Mockito.when(EcompPortalUtils.parsingByRegularExpression("Test Testnew", " ")).thenReturn(list);
+ @SuppressWarnings({ "unchecked", "rawtypes" })
List<EPUser> userList = new ArrayList();
EPUser user = mockUser.mockEPUser();
- user.setLastName("Test new");
+ user.setLastName("Testnew");
userList.add(user);
- Mockito.when( this.userService.getUserByFirstLastName("Test","Test new")).thenReturn(userList);
- String result = searchServiceImpl.searchUsersInPhoneBook("Test");
- assertEquals("[{\"orgUserId\":\"guestT\",\"firstName\":\"test\",\"lastName\":\"Test new\",\"jobTitle\":null}]" , result);
+ Mockito.when( this.userService.getUserByFirstLastName("Test","Testnew")).thenReturn(userList);
+ String result = searchServiceImpl.searchUsersInPhoneBook("Test Testnew");
+ assertEquals("[{\"orgUserId\":\"guestT\",\"firstName\":\"test\",\"lastName\":\"Testnew\",\"jobTitle\":null}]" , result);
}
diff --git a/ecomp-portal-FE-common/client/app/views/tabs/tabframe.html b/ecomp-portal-FE-common/client/app/views/tabs/tabframe.html
index c7034edd..79dd0928 100644
--- a/ecomp-portal-FE-common/client/app/views/tabs/tabframe.html
+++ b/ecomp-portal-FE-common/client/app/views/tabs/tabframe.html
@@ -2,7 +2,7 @@
============LICENSE_START==========================================
ONAP Portal
===================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -32,9 +32,9 @@
limitations under the License.
============LICENSE_END============================================
-
-
+
-->
<iframe id= "tabframe-{{tab.title.split(' ').join('-')}}" scrolling='yes' frameBorder='0' width='100%' class='tab-iframe'
-src='{{tab.content | trusted}}'
-></iframe> \ No newline at end of file
+src='' onLoad="loadFrame();"
+>
+</iframe> \ No newline at end of file
diff --git a/ecomp-portal-FE-common/client/app/views/tabs/tabs.controller.js b/ecomp-portal-FE-common/client/app/views/tabs/tabs.controller.js
index c4b31ef2..3e15144a 100644
--- a/ecomp-portal-FE-common/client/app/views/tabs/tabs.controller.js
+++ b/ecomp-portal-FE-common/client/app/views/tabs/tabs.controller.js
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal
* ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -77,6 +77,7 @@
}
// Add tab to the end of the array
var addTab = function (title, content) {
+
if($scope.tabs.length===tabLimit){
//alert
confirmBoxService.showInformation('You have reached your maximum limit of tabs allowed.').then(isConfirmed => {});
@@ -279,11 +280,18 @@
restrict: "E",
templateUrl: 'app/views/tabs/tabframe.html',
link: function(scope, element) {
-
- //var iframeId = "#tabframe-" + scope.$parent.tab.title.split(' ').join('-');
+
+ var iframeId = "tabframe-" + scope.$parent.tab.title.split(' ').join('-');
+ var iframeVal = scope.$parent.tab.content;// + "| trusted";
+ if(iframeId != 'tabframe-Home') {
+ sessionStorage.setItem("currentTabFrameId",iframeId);
+ sessionStorage.setItem("currentTabFrameVal",iframeVal);
+ }
+ //console.log(document.getElementById(sessionStorage.getItem("currentTabFrameId")));
+
// jQuery(iframeId).load(function() {
- // alert("hello");
- // }); //.attr("src",'{{tab.content | trusted}}' ); //src='{{tab.content | trusted}}'
+ // alert("hello");
+ // }); //.attr("src",'{{tab.content | trusted}}' ); //src='{{tab.content | trusted}}'
// jQuery(iframeId).attr('src', '{{tab.content | trusted}}');
//element.childNodes[0].on('load', function() {
@@ -350,3 +358,20 @@ function isCascadeFrame(ref) {
window.location = "unKnownError";
}
}
+
+function loadFrame() {
+
+ var interval = setInterval(function() {
+
+ if(sessionStorage.getItem("currentTabFrameId") == null && sessionStorage.getItem("currentTabFrameVal") == null)
+ clearInterval(interval);
+ else if(document.getElementById(sessionStorage.getItem("currentTabFrameId")).src != sessionStorage.getItem("currentTabFrameVal")) {
+ document.getElementById(sessionStorage.getItem("currentTabFrameId")).src = sessionStorage.getItem("currentTabFrameVal");
+ sessionStorage.removeItem("currentTabFrameId");
+ sessionStorage.removeItem("currentTabFrameVal");
+ clearInterval(interval);
+ }
+ },1000);
+
+
+ }
diff --git a/ecomp-portal-FE-os/client/src/directives/search-users/search-users.tpl.html b/ecomp-portal-FE-os/client/src/directives/search-users/search-users.tpl.html
index 874b2b5e..d8a476d2 100644
--- a/ecomp-portal-FE-os/client/src/directives/search-users/search-users.tpl.html
+++ b/ecomp-portal-FE-os/client/src/directives/search-users/search-users.tpl.html
@@ -2,7 +2,7 @@
============LICENSE_START==========================================
ONAP Portal
===================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -49,7 +49,7 @@
placeholder="Search"
ng-model="searchUsers.searchUserString"
ng-keyup="$event.keyCode===13 && searchUsersForm.searchString.$valid && searchUsers.searchUsers()"
- pattern="[a-zA-Z0-9-'\s]{1,}"
+ pattern="[a-zA-Z0-9-_'\s]{1,}"
maxlength="80"
required="true" auto-focus tabindex="0"/>
diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml
index 7c5a40e6..91dc4fd6 100644
--- a/ecomp-portal-widget-ms/widget-ms/pom.xml
+++ b/ecomp-portal-widget-ms/widget-ms/pom.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- This project must name Spring as parent; cannot name Portal -->
@@ -7,7 +8,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
- <relativePath/> <!-- lookup parent from repository -->
+ <relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>org.onap.portal</groupId>
diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java
index 7ae3c270..807067b2 100644
--- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java
@@ -37,8 +37,24 @@ public class RoleApp implements Serializable{
@JsonIgnore
@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy="widgetRoles")
- private transient Set<WidgetCatalog> widgets;
+ private Set<WidgetCatalog> widgets;
+ /*@PreRemove
+ private void removeGroupsFromUsers() {
+ for (WidgetCatalog w : widgets) {
+ w.getWidgetRoles().remove(this);
+ }
+ }*/
+
+ /*@ManyToOne
+ @JoinColumn(name = "WIDGET_ID", nullable = false)
+ WidgetCatalog widgetCatalog;*/
+
+ //@JsonIgnore
+ //@ManyToMany(mappedBy = "widgetRoles")
+ //@ManyToMany(fetch = FetchType.EAGER, mappedBy = "widgetRoles")
+ //private Set<WidgetCatalog> widgets = new HashSet<WidgetCatalog>();
+
public Long getRoleId() {
return roleId;
}
diff --git a/pom.xml b/pom.xml
index 3986bf4b..e7f3360b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
<version>1.2.0</version>
- <relativePath/>
+ <relativePath />
</parent>
<groupId>org.onap.portal</groupId>
@@ -124,7 +125,7 @@
</goals>
</pluginExecutionFilter>
<action>
- <ignore/>
+ <ignore />
</action>
</pluginExecution>
</pluginExecutions>