Repair widget micro service, onboarding of widgets 53/6453/2
authorChristopher Lott (cl778h) <clott@research.att.com>
Mon, 31 Jul 2017 22:20:49 +0000 (18:20 -0400)
committerChristopher Lott (cl778h) <clott@research.att.com>
Mon, 31 Jul 2017 22:25:35 +0000 (18:25 -0400)
Issue: PORTAL-30, PORTAL-40, PORTAL-45, PORTAL-46, PORTAL-47
Change-Id: I97de4cc038f7167d5e368249f9ea5e47e8fc1b09
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
14 files changed:
deliveries/.gitignore
deliveries/new_stop.sh
deliveries/widget_ms_start.sh
ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java
ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java
ecomp-portal-BE-os/README.md
ecomp-portal-BE-os/pom.xml
ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java
ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java
ecomp-portal-BE-os/src/main/webapp/WEB-INF/jsp/login.jsp
ecomp-portal-FE-common/client/app/views/header/header.less
ecomp-portal-FE-os/client/configurations/dev.json

index f12ac3a..9966529 100644 (file)
@@ -1 +1,2 @@
 /PROJECT
+/etc_vm-ep-dev2.zip
index 7693c03..9193e28 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Establish environment variables
 source $(dirname $0)/os_settings.sh
index 5e51aeb..b5fbdc2 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Establish environment variables
 source $(dirname $0)/os_settings.sh
index 68e32a1..7faea5d 100644 (file)
@@ -20,6 +20,8 @@
 package org.openecomp.portalapp.portal.controller;
 
 import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalapp.controller.EPRestrictedBaseController;
 import org.openecomp.portalapp.portal.controller.DashboardController.WidgetCategory;
 import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse;
 import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum;
@@ -33,7 +35,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 @RestController
-public class CommonWidgetController implements BasicAuthenticationController{
+public class CommonWidgetController extends EPRestrictedBaseController implements BasicAuthenticationController{
        
        
        private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CommonWidgetController.class);
@@ -63,7 +65,7 @@ public class CommonWidgetController implements BasicAuthenticationController{
         *            Request parameter.
         * @return Rest response wrapped around a CommonWidgetMeta object.
         */
-       @RequestMapping(value = "/widgetData", method = RequestMethod.GET, produces = "application/json")
+       @RequestMapping(value = "/commonWidgets", method = RequestMethod.GET, produces = "application/json")
        public PortalRestResponse<CommonWidgetMeta> getWidgetData(HttpServletRequest request,
                        @RequestParam String resourceType) {
                if (!isValidResourceType(resourceType)){
index 6b9a441..ff8ee42 100644 (file)
@@ -108,6 +108,8 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService {
                        HttpHeaders headers = new HttpHeaders();
                        headers.add("Authorization", "Basic " + base64Creds);
                        headers.setContentType(MediaType.APPLICATION_JSON);
+                       String rawCookie = request.getHeader("Cookie");
+                       headers.add("Cookie", rawCookie);
                        HttpEntity<String> entity = new HttpEntity<String>(headers);
 
                        String url = microserviceUrlConverter(data, params);
index aaadfa1..520bef9 100644 (file)
@@ -24,6 +24,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.crypto.BadPaddingException;
+
 import org.hibernate.criterion.Criterion;
 import org.hibernate.criterion.Restrictions;
 import org.openecomp.portalapp.portal.domain.MicroserviceData;
@@ -82,7 +84,11 @@ public class MicroserviceServiceImpl implements MicroserviceService {
                List<MicroserviceData> list = (List<MicroserviceData>) dataAccessService.getList(MicroserviceData.class, null);
                for (int i = 0; i < list.size(); i++) {
                        if (list.get(i).getPassword() != null)
-                               list.get(i).setPassword(decryptedPassword(list.get(i).getPassword()));
+                               try{
+                                       list.get(i).setPassword(decryptedPassword(list.get(i).getPassword()));
+                               } catch(BadPaddingException bpe){
+                                       logger.error(EELFLoggerDelegate.errorLogger, "Couldn't decrypt - Check decryption key in system.properties - looks wrong. Still going ahead with list population though", bpe);
+                               }
                        list.get(i).setParameterList(getServiceParameters(list.get(i).getId()));
                }
                return list;
index 8040895..5880921 100644 (file)
@@ -1242,7 +1242,7 @@ public class UserRolesCommonServiceImpl  {
        
        protected EPUser getUser(String userId, EPApp app, ApplicationsRestClientService applicationsRestClientService)
                        throws HTTPException {
-               return applicationsRestClientService.get(EPUser.class, app.getId(), String.format("/user/%s", userId), true);
+               return applicationsRestClientService.get(EPUser.class, app.getId(), String.format("/user/%s", userId));
 
        }
        
index 829fd86..be584cb 100644 (file)
@@ -17,6 +17,9 @@ https://www.eclipse.org/m2e-wtp/
 Version 1.1.?, July 2017
 - [Portal-30] Failed to communicate with the widget microservice: Fixed
 - [Portal-35] Replaced the portal logo with onap logo on the login screen.
+- [Portal-40] Fix to add user roles 
+- [Portal-47] Fix to eliminate duplicate roles on Users page
+- [Portal-45] Fix to save on an application Onboarding
 
 Version 1.1.0, July 2017
 - [Portal-7] Improvements added as part of the rebasing process
index 1e4b492..2cf1af2 100644 (file)
                                                </manifestEntries>
                                        </archive>
                                        <overlays>
-                                               <!-- specify the order in which these should be applied -->
-                                               <overlay>
-                                                       <groupId>org.openecomp.ecompsdkos</groupId>
-                                                       <artifactId>epsdk-app-overlay</artifactId>
-                                               </overlay>
+                                               <!-- specify the order in which these should be applied -->                                             
                                                <overlay>
                                                        <groupId>org.openecomp.portal</groupId>
                                                        <artifactId>ecompportal-be-common</artifactId>
                                                </overlay>
+                                               <overlay>
+                                                       <groupId>org.openecomp.ecompsdkos</groupId>
+                                                       <artifactId>epsdk-app-overlay</artifactId>
+                                               </overlay>
                                        </overlays>
                                </configuration>
                        </plugin>
index 4626b17..f3fda34 100644 (file)
@@ -48,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.stereotype.Service;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonDeserializationContext;
@@ -71,6 +72,8 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient
        private AppsCacheService appsCacheService;
        Gson gson = null;
        
+       private final ObjectMapper mapper = new ObjectMapper();
+       
        @PostConstruct
        private void init(){
                logger.debug(EELFLoggerDelegate.debugLogger, "initializing");
@@ -185,7 +188,9 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient
                        verifyResponse(response);
                        String str = response.readEntity(String.class);
                        EcompPortalUtils.logAndSerializeObject(restPath, "GET result =", str);
-                   try { t = gson.fromJson(str, clazz); } catch(Exception e) {
+                   try { 
+                       t = mapper.readValue(str, clazz); 
+                   } catch(Exception e) {
                        logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e));
                        EPLogUtil.logEcompError(EPAppMessagesEnum.BeInvalidJsonInput); 
                        }
index 4c97a52..f953634 100644 (file)
@@ -26,6 +26,8 @@ public class OnboardingApp {
        public String name;
 
        public String imageUrl;
+       
+       public String imageLink;
 
        public String description;
 
index c37d6d6..1b269d8 100644 (file)
                                font-family: Verdana,Arial,Helvetica, sans-serif;
                                font-size: 9px;
                        }
+                       .login-tbl {
+                               border: 0px;
+                       }
+                       .login-txt {
+                           font-family: Arial;
+                           font-size: 14px;
+                           text-decoration: none;
+                       }
+                       .login-input-text {
+                               width: 140px;
+                               height:25px;
+                               border-radius:7px;
+                               padding-left:5px;                       
+                           font-family: Arial;
+                               font-size: 14px;
+                       }
                        .login-btn {
                            cursor: pointer;
                            background: #d97b34;
     %>
        <div ng-controller="externalLoginController">
                <div class="centered style="-webkit-transform: translateZ(0);background:white, z-index:0;">
-                       <div align="center" id="errorInfo" style="display:none;float:left;font-size:12px;margin-left:5px"><span style="color:red">Invaild username or password, Please try again</span></div>
+                       <div align="center" id="errorInfo" style="display:none; float:left; font-family: Arial; font-size:12px; margin-left:5px">
+                               <span style="color:red">Invalid username or password. Please try again.</span>
+                       </div>
                        <br/>
                        <div align="center" style="margin-left:auto;margin-right:auto;width:40%;padding:6px;background-color:white">
                        <img src="static/fusion/images/onap-portal-logo.png" height="250"/>
                                <br>
                                <div style="opacity: 0.7;">
-                                       <label>
-                                               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="form-field__label">Login ID:</label>
-                                       </label>
-                                       <input  type="text" class="fn-ebz-text" ng-model="loginId" style="width: 140px;height:25px;border-radius:7px;font-size:18px;padding-left:5px;"
-                                               maxlength="30" />
-                                       <br/>
-                                       <br/>
-                                       <label >&nbsp;Password:</label>
-                                       <input type="password" class="span3" ng-model="password" style="width: 140px;height:25px;border-radius:7px;font-size:18px;padding-left:5px;"
-                                               maxlength="30" onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/> 
-                                       <br />
+                                       <table class="login-tbl">
+                                               <tr>
+                                                       <td>    
+                                                               <label class="login-txt">Login ID:</label>
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" class="login-input-text" ng-model="loginId" maxlength="30" />
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <label class="login-txt">Password:</label>
+                                                       </td>
+                                                       <td>
+                                                               <input type="password" class="login-input-text" ng-model="password" maxlength="30" 
+                                                                       onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/>
+                                                       </td>
+                                               </tr>
+                                       </table> 
                                        <br />
-                                       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a class="login-btn" id="loginBtn" ng-click="loginExternal();">LOGIN</a>
                                </div>
                                <br>
index b553ceb..e10e9ed 100644 (file)
@@ -14,6 +14,7 @@
   font-weight: 400;
   font-family: "Omnes-ECOMP-W02",Arial !important;
   font-size: 18px;
+  margin-left: 10px;
   //.c18b;
 }
 
index a037deb..38142f7 100644 (file)
@@ -83,8 +83,8 @@
                "UpdateUserAppsSortManual": "http://localhost:8080/ecompportal/portalApi/UpdateUserAppsSortManual",
                "widgetCatalogSelection": "http://localhost:8080/ecompportal/portalApi/widgetCatalogSelection",
                "widgetCommon": "http://localhost:8080/ecompportal/portalApi/microservices",
-               "basicAuthAccount": "http://www.ecomp.att.com:8080/ecompportal-att/portalApi/basicAuthAccount",
-               "microserviceProxy": "http://www.ecomp.att.com:8080/ecompportal-att/portalApi/microservice/proxy",
+               "basicAuthAccount": "http://localhost:8080/ecompportal/portalApi/basicAuthAccount",
+               "microserviceProxy": "http://localhost:8080/ecompportal/portalApi/microservice/proxy",
                "getWidthThresholdLeftMenu":"http://localhost:8080/ecompportal/portalApi/dashboard/windowWidthThresholdLeftMenu",
                "getWidthThresholdRightMenu":"http://localhost:8080/ecompportal/portalApi/dashboard/windowWidthThresholdRightMenu",
                "appCatalogRoles" : "http://localhost:8080/ecompportal/portalApi/appCatalogRoles",