Merge "test cases for the remaining lines of equal method"
authorManoop Talasila <talasila@research.att.com>
Tue, 9 Oct 2018 19:27:44 +0000 (19:27 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 9 Oct 2018 19:27:44 +0000 (19:27 +0000)
25 files changed:
deliveries/.env
deliveries/Apps_Users_OnBoarding_Script.sql
deliveries/Dockerfile.portal
deliveries/build_portalapps_dockers.sh
deliveries/docker-compose.yml
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepository.java
ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/model/PortalRestResponseTest.java [moved from ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheService.java with 57% similarity]
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java [deleted file]
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/SearchServiceImpl.java
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java
ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/SearchServiceImplTest.java
ecomp-portal-FE-common/client/app/views/tabs/tabframe.html
ecomp-portal-FE-common/client/app/views/tabs/tabs.controller.js
ecomp-portal-FE-os/client/src/directives/search-users/search-users.controller.js
ecomp-portal-FE-os/client/src/directives/search-users/search-users.tpl.html
ecomp-portal-widget-ms/widget-ms/pom.xml
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java
pom.xml

index 3b2fa14..d1cc7d6 100644 (file)
@@ -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.
index 74017a7..583238f 100644 (file)
@@ -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);
index 81eeb65..9b9f548 100644 (file)
@@ -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
index f7510ac..5092b40 100755 (executable)
@@ -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
index bba42aa..7753854 100644 (file)
@@ -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:
index 4197d23..a77b958 100644 (file)
@@ -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());
index a192ad9..c766106 100644 (file)
@@ -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);
                        }
index a4b6cc2..f8d1116 100644 (file)
@@ -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
@@ -90,7 +86,7 @@ public class EcompPortalUtils {
         *         otherwise
         */
        public static boolean legitimateUserId(String orgUserId) {
-               return orgUserId.matches("^[a-zA-Z0-9]+$");
+               return orgUserId.matches("^[a-zA-Z0-9/_/-/@]+$");
        }
 
        /**
index 75c6616..988b97a 100644 (file)
@@ -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;
index becfe7c..e4b8144 100644 (file)
@@ -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;
index d081b80..f99c80b 100644 (file)
@@ -4,6 +4,8 @@
  * ===================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ===================================================================
+ *  Modifications Copyright Â© 2018 IBM.
+ * ================================================================================
  *
  * Unless otherwise specified, all software contained herein is licensed
  * under the Apache License, Version 2.0 (the "License");
@@ -51,58 +53,68 @@ import org.onap.portalsdk.core.restful.domain.EcompRoleFunction;
 
 public class EPRoleTest {
 
-       
-       @Test
-       public void testEpRole() {
-               EPRole role=new EPRole();
-               role.setActive(true);
-               role.setAppId(1l);
-               role.setAppRoleId(2l);
-               role.setId(3l);
-               role.setName("TEST_ADMIN");
-               SortedSet<EPRole> childRoles = new TreeSet<EPRole>();
-               EPRole child=new EPRole();
-               child.setActive(true);
-               child.setAppId(1l);
-               child.setAppRoleId(3l);
-               child.setId(6l);
-               child.setName("TEST_USER");
-               childRoles.add(child);
-               role.setChildRoles(childRoles);
-               SortedSet<EPRole> parentRoles = new TreeSet<EPRole>();
-               EPRole parent=new EPRole();
-               parent.setActive(true);
-               parent.setAppId(1l);
-               parent.setAppRoleId(3l);
-               parent.setId(6l);
-               parent.setName("TEST_USER");
-               parentRoles.add(parent);
-               role.setParentRoles(parentRoles);
-               
-               SortedSet<RoleFunction> rolefunction = new TreeSet<RoleFunction>();
-               RoleFunction function=new RoleFunction();
-               function.setAction("Test");;
-               function.setCode("code");
-               rolefunction.add(function);
-               role.setRoleFunctions(rolefunction);
-               role.setPriority(5);
-               role.setAppRoleId(3l);
-               assertEquals(3l, role.getAppRoleId().longValue());
-               assertNotNull(role.getChildRoles());
-               assertNotNull(role.getParentRoles());
-               assertNotNull(role.getRoleFunctions());
-               role.compareTo(role);
-               assertEquals(1l, role.getAppId().longValue());
-               assertEquals("TEST_ADMIN",role.getName());
-               role.removeChildRole(6l);
-               role.removeParentRole(6l);
-               assertEquals(role.toString(), "[Id = 3, name = TEST_ADMIN]");
-               role.removeRoleFunction("code");
-               role.addChildRole(child);
-               role.addParentRole(parent);
-               role.addRoleFunction(function);
-               
-       }
-       
+    
+    @Test
+    public void testEpRole() {
+        EPRole role=new EPRole();
+        role.setActive(true);
+        role.setAppId(1l);
+        role.setAppRoleId(2l);
+        role.setId(3l);
+        role.setName("TEST_ADMIN");
+        SortedSet<EPRole> childRoles = new TreeSet<EPRole>();
+        EPRole child=new EPRole();
+        child.setActive(true);
+        child.setAppId(1l);
+        child.setAppRoleId(3l);
+        child.setId(6l);
+        child.setName("TEST_USER");
+        childRoles.add(child);
+        role.setChildRoles(childRoles);
+        SortedSet<EPRole> parentRoles = new TreeSet<EPRole>();
+        EPRole parent=new EPRole();
+        parent.setActive(true);
+        parent.setAppId(1l);
+        parent.setAppRoleId(3l);
+        parent.setId(6l);
+        parent.setName("TEST_USER");
+        parentRoles.add(parent);
+        role.setParentRoles(parentRoles);
+        
+        SortedSet<RoleFunction> rolefunction = new TreeSet<RoleFunction>();
+        RoleFunction function=new RoleFunction();
+        function.setAction("Test");;
+        function.setCode("code");
+        rolefunction.add(function);
+        role.setRoleFunctions(rolefunction);
+        role.setPriority(5);
+        role.setAppRoleId(3l);
+        assertEquals(3l, role.getAppRoleId().longValue());
+        assertNotNull(role.getChildRoles());
+        assertNotNull(role.getParentRoles());
+        assertNotNull(role.getRoleFunctions());
+        role.compareTo(role);
+        assertEquals(1l, role.getAppId().longValue());
+        assertEquals("TEST_ADMIN",role.getName());
+        role.removeChildRole(6l);
+        role.removeParentRole(6l);
+        assertEquals(role.toString(), "[Id = 3, name = TEST_ADMIN]");
+        role.removeRoleFunction("code");
+        role.addChildRole(child);
+        role.addParentRole(parent);
+        role.addRoleFunction(function);
+        
+        parent.setAppId(null);
+        child.setAppId((long) 1234);
+        assertEquals(parent.compareTo(child), -1);
+        
+        child.setAppId(null);
+        parent.setAppId((long) 1234);
+        assertEquals(parent.compareTo(child), 1);
+        
+        
+        
+    }
+    
 }
 
index bc4c6f3..c856b5a 100644 (file)
@@ -4,6 +4,8 @@
  * ===================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ===================================================================
+ * Modifications Copyright Â© 2018 IBM.
+ * ================================================================================
  *
  * Unless otherwise specified, all software contained herein is licensed
  * under the Apache License, Version 2.0 (the "License");
@@ -37,7 +39,7 @@
  */
 package org.onap.portalapp.portal.domain;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
 
 import java.util.Date;
 
@@ -46,106 +48,111 @@ import org.onap.portalapp.portal.domain.EPUser;
 
 public class EPUserTest {
 
-       public EPUser mockEPUser(){
-               
-               EPUser epUser = new EPUser();
-               
-               epUser.setId((long)1);
-               epUser.setManagerId((long) 1234);
-               epUser.setFirstName("test");
-               epUser.setLastName("test");
-               epUser.setMiddleInitial("test");
-               epUser.setPhone("test");
-               epUser.setFax("test");
-               epUser.setCellular("test");
-               epUser.setEmail("test");
-               epUser.setAddressId((long) 123); 
-               epUser.setAlertMethodCd("test");
-               epUser.setHrid("test");
-               epUser.setOrgUserId("test");
-               epUser.setOrgCode("test");
-               epUser.setAddress1("test");
-               epUser.setAddress2("test");
-               epUser.setCity("test");
-               epUser.setState("test");
-               epUser.setZipCode("test");
-               epUser.setCountry("test");
-               epUser.setOrgManagerUserId("test");
-               epUser.setLocationClli("test");
-               epUser.setBusinessCountryCode("test");
-               epUser.setBusinessCountryName("test");
-               epUser.setBusinessUnit("test");
-               epUser.setBusinessUnitName("test");
-               epUser.setDepartment("test");
-               epUser.setDepartmentName("test");
-               epUser.setCompanyCode("test");
-               epUser.setCompany("test");
-               epUser.setZipCodeSuffix("test");
-               epUser.setJobTitle("test");
-               epUser.setCommandChain("test");
-               epUser.setSiloStatus("test");
-               epUser.setCostCenter("test");
-               epUser.setFinancialLocCode("test");
-               epUser.setLoginId("test");
-               epUser.setLoginPwd("test");
-               epUser.setLastLoginDate(new Date());
-               epUser.setActive(false);
-               epUser.setInternal(false);
-               epUser.setSelectedProfileId((long) 12345);
-               epUser.setTimeZoneId((long) 12345);
-               epUser.setOnline(false);
-               epUser.setChatId("test");
-               return epUser;
-                                   
-       }
-       
-       @Test
-       public void userTest(){
-               EPUser user = mockEPUser();
-               
-               assertEquals(user.getId(), new Long(1));
-               assertEquals(user.getManagerId(), new Long(1234));
-               assertEquals(user.getFirstName(), "test");
-               assertEquals(user.getLastName(), "test");
-               assertEquals(user.getMiddleInitial(), "test");
-               assertEquals(user.getPhone(), "test");
-               assertEquals(user.getFax(), "test");
-               assertEquals(user.getCellular(), "test");               
-               assertEquals(user.getEmail(), "test");
-               assertEquals(user.getAddressId(), new Long(123) );
-               assertEquals(user.getAlertMethodCd(), "test");
-               assertEquals(user.getHrid(), "test");
-               assertEquals(user.getOrgUserId(), "test");
-               assertEquals(user.getOrgCode(), "test");
-               assertEquals(user.getAddress1(), "test");
-               assertEquals(user.getAddress2(), "test");
-               assertEquals(user.getState(), "test");
-               assertEquals(user.getZipCode(), "test");
-               assertEquals(user.getCountry(), "test");
-               assertEquals(user.getOrgManagerUserId(), "test");
-               assertEquals(user.getLocationClli(), "test");
-               assertEquals(user.getBusinessCountryCode(), "test");
-               assertEquals(user.getBusinessCountryName(), "test");
-               assertEquals(user.getBusinessUnit(), "test");
-               assertEquals(user.getBusinessUnitName(), "test");
-               assertEquals(user.getDepartment(), "test");
-               assertEquals(user.getDepartmentName(), "test");
-               assertEquals(user.getCompanyCode(), "test");
-               assertEquals(user.getCompany(), "test");
-               assertEquals(user.getZipCodeSuffix(), "test");
-               assertEquals(user.getJobTitle(), "test");
-               assertEquals(user.getCommandChain(), "test");
-               assertEquals(user.getSiloStatus(), "test");
-               assertEquals(user.getFinancialLocCode(), "test");
-               assertEquals(user.getLoginId(), "test");
-               assertEquals(user.getLoginPwd(), "test");
-               assertEquals(user.getActive(), false);
-               assertEquals(user.getInternal(), false);
-               assertEquals(user.getSelectedProfileId(), new Long (12345));
-               assertEquals(user.getTimeZoneId(), new Long (12345));
-               assertEquals(user.getChatId(), "test");
-               
-               //assertEquals(user.toString(), "EPUser [orgId=null, managerId=1234, firstName=test, middleInitial=test, lastName=test, phone=test, fax=test, cellular=test, email=test, addressId=123, alertMethodCd=test, hrid=test, orgUserId=test, orgCode=test, address1=test, address2=test, city=test, state=test, zipCode=test, country=test, orgManagerUserId=test, locationClli=test, businessCountryCode=test, businessCountryName=test, businessUnit=test, businessUnitName=test, department=test, departmentName=test, companyCode=test, company=test, zipCodeSuffix=test, jobTitle=test, commandChain=test, siloStatus=test, costCenter=test, financialLocCode=test, loginId=test, loginPwd=test, lastLoginDate=Tue Sep 05 11:04:49 EDT 2017, active=false, internal=false, selectedProfileId=12345, timeZoneId=12345, online=false, chatId=test, isGuest=false, userApps=[], pseudoRoles=[]]");
-       }
-       
+    public EPUser mockEPUser(){
+        
+        EPUser epUser = new EPUser();
+        
+        epUser.setId((long)1);
+        epUser.setManagerId((long) 1234);
+        epUser.setFirstName("test");
+        epUser.setLastName("test");
+        epUser.setMiddleInitial("test");
+        epUser.setPhone("test");
+        epUser.setFax("test");
+        epUser.setCellular("test");
+        epUser.setEmail("test");
+        epUser.setAddressId((long) 123); 
+        epUser.setAlertMethodCd("test");
+        epUser.setHrid("test");
+        epUser.setOrgUserId("test");
+        epUser.setOrgCode("test");
+        epUser.setAddress1("test");
+        epUser.setAddress2("test");
+        epUser.setCity("test");
+        epUser.setState("test");
+        epUser.setZipCode("test");
+        epUser.setCountry("test");
+        epUser.setOrgManagerUserId("test");
+        epUser.setLocationClli("test");
+        epUser.setBusinessCountryCode("test");
+        epUser.setBusinessCountryName("test");
+        epUser.setBusinessUnit("test");
+        epUser.setBusinessUnitName("test");
+        epUser.setDepartment("test");
+        epUser.setDepartmentName("test");
+        epUser.setCompanyCode("test");
+        epUser.setCompany("test");
+        epUser.setZipCodeSuffix("test");
+        epUser.setJobTitle("test");
+        epUser.setCommandChain("test");
+        epUser.setSiloStatus("test");
+        epUser.setCostCenter("test");
+        epUser.setFinancialLocCode("test");
+        epUser.setLoginId("test");
+        epUser.setLoginPwd("test");
+        epUser.setLastLoginDate(new Date());
+        epUser.setActive(false);
+        epUser.setInternal(false);
+        epUser.setSelectedProfileId((long) 12345);
+        epUser.setTimeZoneId((long) 12345);
+        epUser.setOnline(false);
+        epUser.setChatId("test");
+        return epUser;
+                    
+    }
+    
+    @Test
+    public void userTest(){
+        EPUser user = mockEPUser();
+        
+        assertEquals(user.getId(), new Long(1));
+        assertEquals(user.getManagerId(), new Long(1234));
+        assertEquals(user.getFirstName(), "test");
+        assertEquals(user.getLastName(), "test");
+        assertEquals(user.getMiddleInitial(), "test");
+        assertEquals(user.getPhone(), "test");
+        assertEquals(user.getFax(), "test");
+        assertEquals(user.getCellular(), "test");        
+        assertEquals(user.getEmail(), "test");
+        assertEquals(user.getAddressId(), new Long(123) );
+        assertEquals(user.getAlertMethodCd(), "test");
+        assertEquals(user.getHrid(), "test");
+        assertEquals(user.getOrgUserId(), "test");
+        assertEquals(user.getOrgCode(), "test");
+        assertEquals(user.getAddress1(), "test");
+        assertEquals(user.getAddress2(), "test");
+        assertEquals(user.getState(), "test");
+        assertEquals(user.getZipCode(), "test");
+        assertEquals(user.getCountry(), "test");
+        assertEquals(user.getOrgManagerUserId(), "test");
+        assertEquals(user.getLocationClli(), "test");
+        assertEquals(user.getBusinessCountryCode(), "test");
+        assertEquals(user.getBusinessCountryName(), "test");
+        assertEquals(user.getBusinessUnit(), "test");
+        assertEquals(user.getBusinessUnitName(), "test");
+        assertEquals(user.getDepartment(), "test");
+        assertEquals(user.getDepartmentName(), "test");
+        assertEquals(user.getCompanyCode(), "test");
+        assertEquals(user.getCompany(), "test");
+        assertEquals(user.getZipCodeSuffix(), "test");
+        assertEquals(user.getJobTitle(), "test");
+        assertEquals(user.getCommandChain(), "test");
+        assertEquals(user.getSiloStatus(), "test");
+        assertEquals(user.getFinancialLocCode(), "test");
+        assertEquals(user.getLoginId(), "test");
+        assertEquals(user.getLoginPwd(), "test");
+        assertEquals(user.getActive(), false);
+        assertEquals(user.getInternal(), false);
+        assertEquals(user.getSelectedProfileId(), new Long (12345));
+        assertEquals(user.getTimeZoneId(), new Long (12345));
+        assertEquals(user.getChatId(), "test");
+        
+        EPUser another = mockEPUser();
+        assertTrue(user.compareTo(another) == 0);
+        another.setLastName("otherlastname");
+        assertTrue(user.compareTo(another) == 5);
+        
+        //assertEquals(user.toString(), "EPUser [orgId=null, managerId=1234, firstName=test, middleInitial=test, lastName=test, phone=test, fax=test, cellular=test, email=test, addressId=123, alertMethodCd=test, hrid=test, orgUserId=test, orgCode=test, address1=test, address2=test, city=test, state=test, zipCode=test, country=test, orgManagerUserId=test, locationClli=test, businessCountryCode=test, businessCountryName=test, businessUnit=test, businessUnitName=test, department=test, departmentName=test, companyCode=test, company=test, zipCodeSuffix=test, jobTitle=test, commandChain=test, siloStatus=test, costCenter=test, financialLocCode=test, loginId=test, loginPwd=test, lastLoginDate=Tue Sep 05 11:04:49 EDT 2017, active=false, internal=false, selectedProfileId=12345, timeZoneId=12345, online=false, chatId=test, isGuest=false, userApps=[], pseudoRoles=[]]");
+    }
+    
 }
@@ -4,6 +4,8 @@
  * ===================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ===================================================================
+ *  Modifications Copyright Â© 2018 IBM.
+ * ================================================================================
  *
  * Unless otherwise specified, all software contained herein is licensed
  * under the Apache License, Version 2.0 (the "License");
  *
  * 
  */
+package org.onap.portalapp.portal.model;
 
-package org.onap.portalapp.portal.service;
+import static org.junit.Assert.*;
 
-import org.onap.portalapp.portal.domain.EPApp;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
+import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
 
-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);
+public class PortalRestResponseTest {
+
+    PortalRestResponse<String> portalRestResponse1 = new PortalRestResponse<String>();
+    PortalRestResponse<String> portalRestResponse2 = new PortalRestResponse<String>();
+        
+    @Before
+    public void setup(){
+       portalRestResponse1.setMessage("test");
+        portalRestResponse1.setResponse(new String("testResponse"));
+        portalRestResponse1.setStatus(PortalRestStatusEnum.OK);
+        
+        portalRestResponse2.setMessage("test");
+        portalRestResponse2.setResponse(new String("testResponse"));
+        portalRestResponse2.setStatus(PortalRestStatusEnum.OK);
+    }
+   
+    @Test
+    public void testHashCode(){
+        assertEquals(portalRestResponse1.hashCode(), portalRestResponse2.hashCode());
+    }
+    
+    @Test
+    public void testEquals(){
+       assertTrue(portalRestResponse1.equals(portalRestResponse2));
+    }
 }
index ee53eba..e9c4825 100644 (file)
@@ -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/AppsCacheServiceImple.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java
deleted file mode 100644 (file)
index e6306c9..0000000
+++ /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;            
-       }
-
-}
index 48f6d29..0e9932e 100644 (file)
@@ -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
@@ -39,12 +39,10 @@ package org.onap.portalapp.portal.service;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
-import org.onap.portalapp.portal.service.SearchService;
-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.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -75,22 +73,16 @@ public class SearchServiceImpl implements SearchService {
                return searchUsersInFnTable(searchString);
        }
        
+       
        @Override
        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));
@@ -106,7 +98,9 @@ public class SearchServiceImpl implements SearchService {
                        }
                } else if (tokens.size() == 1) {
                        attrUser.setFirstName(tokens.get(0));
+                       attrUser.setOrgUserId(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 +108,12 @@ 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.stream().distinct().collect(Collectors.toList());
                resultOfSearch = this.cutSearchResultToMaximumSize(resultOfSearch);
                ObjectMapper mapper = new ObjectMapper();
                String result = "[]";
@@ -131,7 +125,6 @@ public class SearchServiceImpl implements SearchService {
                return result;
        }
 
-       
        @SuppressWarnings("rawtypes")
        public List<UserWithNameSurnameTitle> searchUsersByUserId(EPUser attrUser) {
                List<UserWithNameSurnameTitle> foundUsers = new ArrayList<UserWithNameSurnameTitle>();
index b5ccfc0..fccd4ff 100644 (file)
@@ -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;
index 6b24e96..0423405 100644 (file)
@@ -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);
        }
        
        
index c7034ed..79dd092 100644 (file)
@@ -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
index c4b31ef..3e15144 100644 (file)
@@ -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 => {});
             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);
+
+       
+       }
index c2067cc..fc7fd7c 100644 (file)
                           var warningMsg = "Passwords do not match, please try again.";
                           confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});
                           return;
+                  } else if(/[^a-zA-Z0-9\-\@\_]/.test(this.newUser.loginId)){
+                          var warningMsg = "Login ID should not contain special characters except '@', '-', and '_'.";
+                          confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});
+                          return;
                   }
                   else {
                           // check password length complexity.
index 874b2b5..ff8d86e 100644 (file)
@@ -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
   
   -->
 <div class="search-users-directive">
-    <form name="searchUsersForm" novalidate method="post">
-        <div class="title" ng-bind="searchUsers.searchTitle"></div>
-        <div class="main">
-           <div ng-show="searchUsers.showSearch">
-                   <div class="search-instructions">Enter first name, last name or User ID</div>
-                   <div class="search">
-                       <input id="input-user-search"
-                              autocomplete="off"
-                              type="text"
-                              name="searchString"
-                              placeholder="Search"
-                              ng-model="searchUsers.searchUserString"
-                              ng-keyup="$event.keyCode===13 && searchUsersForm.searchString.$valid && searchUsers.searchUsers()"
-                              pattern="[a-zA-Z0-9-'\s]{1,}"
-                              maxlength="80"
-                              required="true" auto-focus tabindex="0"/>
-                      
-                       <button class="btn btn-alt btn-small" tabindex="2" id="button-search-users"
-                               ng-class="{disabled: searchUsersForm.searchString.$invalid || searchUsers.searchUsersInProgress}"
-                               ng-click="searchUsersForm.searchString.$valid && searchUsers.searchUsers()">Search
-                       </button>
-                       
-                       <button class="btn btn-alt btn-small" id="Create-New-User-button" ng-click="searchUsers.showAddUserSection()">
-                               <i class="icon-people-userbookmark" aria-hidden="true"></i>&nbsp;New User
-                       </button> 
-                       
-                   </div>
-       
-                   <span class="ecomp-spinner" ng-show="searchUsers.isLoading"></span>
-                   <div ng-show="UserSearchsIsNull===false">
-                       <div class="search-results"
-                            ng-show="!searchUsers.isLoading
+       <form name="searchUsersForm" novalidate method="post">
+               <div class="title" ng-bind="searchUsers.searchTitle"></div>
+               <div class="main">
+                       <div ng-show="searchUsers.showSearch">
+                               <div class="search-instructions">Enter first name, last name
+                                       or User ID</div>
+                               <div class="search">
+                                       <input id="input-user-search" autocomplete="off" type="text"
+                                               name="searchString" placeholder="Search"
+                                               ng-model="searchUsers.searchUserString"
+                                               ng-keyup="$event.keyCode===13 && searchUsersForm.searchString.$valid && searchUsers.searchUsers()"
+                                               pattern="[a-zA-Z0-9-_'\s]{1,}" maxlength="80" required="true"
+                                               auto-focus tabindex="0" />
+
+                                       <button class="btn btn-alt btn-small" tabindex="2"
+                                               id="button-search-users"
+                                               ng-class="{disabled: searchUsersForm.searchString.$invalid || searchUsers.searchUsersInProgress}"
+                                               ng-click="searchUsersForm.searchString.$valid && searchUsers.searchUsers()">Search
+                                       </button>
+
+                                       <button class="btn btn-alt btn-small" id="Create-New-User-button"
+                                               ng-click="searchUsers.showAddUserSection()">
+                                               <i class="icon-people-userbookmark" aria-hidden="true"></i>&nbsp;New
+                                               User
+                                       </button>
+
+                               </div>
+
+                               <span class="ecomp-spinner" ng-show="searchUsers.isLoading"></span>
+                               <div ng-show="UserSearchsIsNull===false">
+                                       <div class="search-results"
+                                               ng-show="!searchUsers.isLoading
                             && searchUsers.searchUsersResults
                             && searchUsers.searchUsersResults.length">
-                           <div id="search-results" ng-show="UserSearchsIsNull===false"
-                                class="results-title"
-                                ng-bind="'Showing ' + searchUsers.searchUsersResults.length + ' results'"></div>
-                           <div class="results-container" scroll-top="searchUsers.scrollApi">
-                               <div id="search-result-{{$index}}"
-                                    class="user"
-                                    ng-repeat="user in (searchUsers.searchUsersResults | orderBy:['firstName','lastName','orgUserId']) | limitTo: 100 track by $index"
-                                    ng-click="searchUsers.setSelectedUser(user)"
-                                    ng-class="{selected: user.orgUserId === searchUsers.selectedUser.orgUserId}">
-                                   <div id="main-name-{{$index}}" class="main-name">
-                                       <span id="result-first-name-{{$index}}" ng-bind="::user.firstName"></span>
-                                       <span id="result-last-name-{{$index}}"  ng-bind="::user.lastName"></span>
-                                       <span id="result-uuid-{{$index}}" ng-bind="::user.orgUserId"></span></div>
-                                   <div id="job-title-{{$index}}" class="sub-job-title" ng-bind="::user.jobTitle"></div>
-                                   <br/>
-                               </div>
-                           </div>
-                       </div>
-                   </div>
-                   
-                   <div class="error-text"
-                        id="user-search-error-403"
-                        ng-show="UserSearchsIsNull===true">
-                       No match found.
-                   </div>
-                   
-                   <div id="no-user-found"
-                        class="no-user-found"
-                        ng-show="searchUsers.searchUsersResults && searchUsers.searchUsersResults.length===0 && !searchUsers.searchUsersInProgress">
-                        No users found
-                   </div>
-            </div>
+                                               <div id="search-results" ng-show="UserSearchsIsNull===false"
+                                                       class="results-title"
+                                                       ng-bind="'Showing ' + searchUsers.searchUsersResults.length + ' results'"></div>
+                                               <div class="results-container" scroll-top="searchUsers.scrollApi">
+                                                       <div id="search-result-{{$index}}" class="user"
+                                                               ng-repeat="user in (searchUsers.searchUsersResults | orderBy:['firstName','lastName','orgUserId']) | limitTo: 100 track by $index"
+                                                               ng-click="searchUsers.setSelectedUser(user)"
+                                                               ng-class="{selected: user.orgUserId === searchUsers.selectedUser.orgUserId}">
+                                                               <div id="main-name-{{$index}}" class="main-name">
+                                                                       <span id="result-first-name-{{$index}}"
+                                                                               ng-bind="::user.firstName"></span> <span
+                                                                               id="result-last-name-{{$index}}" ng-bind="::user.lastName"></span>
+                                                                       <span id="result-uuid-{{$index}}" ng-bind="::user.orgUserId"></span>
+                                                               </div>
+                                                               <div id="job-title-{{$index}}" class="sub-job-title"
+                                                                       ng-bind="::user.jobTitle"></div>
+                                                               <br />
+                                                       </div>
+                                               </div>
+                                       </div>
+                               </div>
+
+                               <div class="error-text" id="user-search-error-403"
+                                       ng-show="UserSearchsIsNull===true">No match found.</div>
 
-            
-            <div id="addWidget" class="add-user-section" ng-show="searchUsers.showAddUser">
-                               <div>           
-                                       <div class="input-new-user-div" >
-                                                 <div  class="">*First Name</div>
-                                                 <input  type="text"  ng-model="searchUsers.newUser.firstName"/>                                                           
+                               <div id="no-user-found" class="no-user-found"
+                                       ng-show="searchUsers.searchUsersResults && searchUsers.searchUsersResults.length===0 && !searchUsers.searchUsersInProgress">
+                                       No users found</div>
+                       </div>
+
+
+                       <div id="addWidget" class="add-user-section"
+                               ng-show="searchUsers.showAddUser">
+                               <div>
+                                       <div class="input-new-user-div">
+                                               <div class="">*First Name</div>
+                                               <input type="text" ng-model="searchUsers.newUser.firstName" />
                                        </div>
-                                       <div class="input-new-user-div" >
-                                                 <div  class="">Middle Name</div>
-                                                 <input  type="text"  ng-model="searchUsers.newUser.middleName"/>                                                          
+                                       <div class="input-new-user-div">
+                                               <div class="">Middle Name</div>
+                                               <input type="text" ng-model="searchUsers.newUser.middleName" />
                                        </div>
-                                       <div class="input-new-user-div" >
-                                                 <div class="">*Last Name</div>
-                                                 <input  type="text" ng-model="searchUsers.newUser.lastName"/>
+                                       <div class="input-new-user-div">
+                                               <div class="">*Last Name</div>
+                                               <input type="text" ng-model="searchUsers.newUser.lastName" />
                                        </div>
-                                       <div class="input-new-user-div" >
-                                                 <div class="">*Email Address ID</div>
-                                                 <input  type="text" ng-model="searchUsers.newUser.emailAddress"/>
+                                       <div class="input-new-user-div">
+                                               <div class="">*Email Address ID</div>
+                                               <input type="text" ng-model="searchUsers.newUser.emailAddress" />
                                        </div>
-                                       <div class="input-new-user-div" >
-                                                 <div class="">*Login ID</div>
-                                                 <input  type="text" ng-model="searchUsers.newUser.loginId"/>
+                                       <div class="input-new-user-div">
+                                               <div class="">*Login ID</div>
+                                               <input type="text" ng-model="searchUsers.newUser.loginId" />
                                        </div>
-                                       <div class="input-new-user-div" >
-                                                 <div class="">*Login Password</div>
-                                                 <input  type="password" ng-model="searchUsers.newUser.loginPwd"    autocomplete="off"/>
+                                       <div class="input-new-user-div">
+                                               <div class="">*Login Password</div>
+                                               <input type="password" ng-model="searchUsers.newUser.loginPwd"
+                                                       autocomplete="off" />
                                        </div>
-                                       <div class="input-new-user-div" >
-                                                 <div class="">*Confirm Login Password</div>
-                                                 <input  type="password" ng-model="searchUsers.newUser.loginPwdCheck"  autocomplete="off"/>
+                                       <div class="input-new-user-div">
+                                               <div class="">*Confirm Login Password</div>
+                                               <input type="password"
+                                                       ng-model="searchUsers.newUser.loginPwdCheck" autocomplete="off" />
                                        </div>
-                               <div ng-show="searchUsers.newUser.loginPwdCheck.length>=searchUsers.newUser.loginPwd.length&&searchUsers.newUser.loginPwdCheck.length>0&&searchUsers.newUser.loginPwd!=searchUsers.newUser.loginPwdCheck"
+                                       <div
+                                               ng-show="searchUsers.newUser.loginPwdCheck.length>=searchUsers.newUser.loginPwd.length&&searchUsers.newUser.loginPwdCheck.length>0&&searchUsers.newUser.loginPwd!=searchUsers.newUser.loginPwdCheck"
                                                style="color: #cf2a2a; font-size: 12px;">
-                                               <small
-                                                       style="position: absolute; margin-top: -6px;">The passwords do not match. Try again.
-                                               </small>
-                   </div>
-                   <div ng-show="userExist==true"
+                                               <small style="position: absolute; margin-top: -6px;">The
+                                                       passwords do not match. Try again. </small>
+                                       </div>
+                                       <div ng-show="userExist==true"
                                                style="color: #cf2a2a; font-size: 12px;">
-                                               <small
-                                                       style="position: absolute; margin-top: -6px;">User with same loginId already exists. Try again.
-                                               </small>
-                   </div>
-                               </div>
-                <div class="add-new-user-btn">
-                       <button class="btn btn-alt btn-small" ng-click="searchUsers.addNewUserFun()">Add New User</button>
+                                               <small style="position: absolute; margin-top: -6px;">User
+                                                       with same loginId already exists. Try again. </small>
+                                       </div>
+                                       <div class="search-instructions">
+                                               <strong style="color: red">Note:</strong> Login ID should not
+                                               contain special characters except '@', '-', and '_'.
+                                       </div>
                                </div>
+                               <div class="add-new-user-btn">
+                                       <button class="btn btn-alt btn-small"
+                                               ng-click="searchUsers.addNewUserFun()">Add New User</button>
                                </div>
-                                                                                                                                               
+                       </div>
 
-                   </div>
-            
-        </div>
 
-    </form>
+               </div>
+</div>
+
+</form>
 </div>
index 7c5a40e..91dc4fd 100644 (file)
@@ -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>
index 7ae3c27..807067b 100644 (file)
@@ -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 3986bf4..e7f3360 100644 (file)
--- 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>
                                                                                </goals>
                                                                        </pluginExecutionFilter>
                                                                        <action>
-                                                                               <ignore/>
+                                                                               <ignore />
                                                                        </action>
                                                                </pluginExecution>
                                                        </pluginExecutions>