From 13b38dbfdcc4f16bfe9e7179940304aa3a351076 Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Wed, 4 Oct 2017 12:32:47 +0300 Subject: get service models from SDC - Fix Change-Id: I936482305790ca9b01ad5d9c8c804cb8df814f91 Issue-ID: VID-74 Signed-off-by: Ofir Sonsino --- .../src/main/java/org/openecomp/vid/controller/VidController.java | 3 ++- .../src/main/java/org/openecomp/vid/roles/RoleProvider.java | 8 +++++--- .../src/main/java/org/openecomp/vid/roles/RoleValidator.java | 1 + .../webapp/app/vid/scripts/controller/ServiceModelController.js | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java index aac3a0b7..f21036eb 100755 --- a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java @@ -73,7 +73,8 @@ public class VidController extends RestrictedBaseController { Map requestParams = request.getParameterMap(); List roles = new RoleProvider().getUserRoles(request); secureServices.setServices(service.getServices(requestParams)); - secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles)); + //Disable roles until AAF integration finishes + //secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles)); return secureServices; } catch (AsdcCatalogException e) { LOG.error("Failed to retrieve service definitions from SDC", e); diff --git a/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleProvider.java b/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleProvider.java index 99645a10..2ed5bdbb 100644 --- a/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleProvider.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleProvider.java @@ -15,6 +15,7 @@ public class RoleProvider { private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(RoleProvider.class); final String readPermissionString = "read"; + final String roleStringDelimiter = "_"; public static List extractRoleFromSession(HttpServletRequest request) { @@ -24,7 +25,8 @@ public class RoleProvider { public List getUserRoles(HttpServletRequest request) { List roleList = new ArrayList<>(); - HashMap roles = UserUtils.getRoles(request); + //Disable roles until AAF integration finishes + /*HashMap roles = UserUtils.getRoles(request); for (Object role : roles.keySet()) { org.openecomp.portalsdk.core.domain.Role sdkRol = (org.openecomp.portalsdk.core.domain.Role) roles.get(role); try { @@ -36,13 +38,13 @@ public class RoleProvider { LOG.error("Failed to parse permission", e); } - } + }*/ return roleList; } public String[] splitRole(String roleAsString) { - return roleAsString.split("_"); + return roleAsString.split(roleStringDelimiter); } public boolean userPermissionIsReadOnly(List roles) { diff --git a/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java index a7085e59..9031524d 100644 --- a/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java +++ b/vid-app-common/src/main/java/org/openecomp/vid/roles/RoleValidator.java @@ -10,6 +10,7 @@ import java.util.Map; */ public class RoleValidator { + //Disable roles until AAF integration finishes private boolean disableRoles = true; private List userRoles; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js index a0030889..8844d40a 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js @@ -39,8 +39,8 @@ $http.get(pathQuery) .then(function successCallback(response) { $scope.services = []; - if (angular.isArray(response.data)) { - wholeData = response.data; + if (response.data && angular.isArray(response.data.services)) { + wholeData = response.data.services; $scope.services = $scope.filterDataWithHigerVersion(wholeData); $scope.viewPerPage=10; $scope.totalPage=$scope.services.length/$scope.viewPerPage; -- cgit 1.2.3-korg