summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-core
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-08-07 11:42:04 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-08-07 11:43:08 -0400
commit49dddf03895dcfa2998489eb384181aa142fe0ac (patch)
tree1a40bd3fc61d890b3c03b10e2f57877bf7d03ebb /ecomp-sdk/epsdk-core
parentac05129bf7c8fbe62f17647f6233ce01a58ca1a3 (diff)
Remove icons; revise role centralization.
Some icons & images are being removed due to restricted use. Made enhancements to the Role centralization code to allow multiple urls for one function code. This replaces the previous commit by Sunder Tattavarada. Issue: PORTAL-17, PORTAL-21 Change-Id: I1d9dc4f1ae20aeb26af00bb0d6384cca926f2115 Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core')
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java4
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java29
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java11
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java9
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java79
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java3
6 files changed, 31 insertions, 104 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
index 040c9d26..2face03a 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
@@ -23,6 +23,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+
import org.openecomp.portalsdk.core.domain.Menu;
import org.openecomp.portalsdk.core.domain.MenuData;
import org.openecomp.portalsdk.core.domain.RoleFunction;
@@ -40,7 +42,7 @@ public interface FnMenuService {
List<Long> getParentId(String label);
@SuppressWarnings("rawtypes")
List<List> getParentList();
- List<RoleFunction> getFunctionCDList();
+ List<RoleFunction> getFunctionCDList(HttpServletRequest request);
void removeMenuItem(Menu domainFnMenu);
Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> menuResult) throws Exception;
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
index ca73339d..9b16aabb 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
@@ -21,21 +21,20 @@ package org.openecomp.portalsdk.core.service;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
-import org.openecomp.portalsdk.core.domain.FnMenu;
+import javax.servlet.http.HttpServletRequest;
+
import org.openecomp.portalsdk.core.domain.Menu;
import org.openecomp.portalsdk.core.domain.MenuData;
-import org.openecomp.portalsdk.core.domain.Role;
import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -46,9 +45,14 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
public class FnMenuServiceImpl implements FnMenuService{
+
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnMenuServiceImpl.class);
@Autowired
private DataAccessService dataAccessService;
+ @Autowired
+ private RoleService roleService;
+
@SuppressWarnings("unchecked")
public List<MenuData> getFnMenuItems() {
//List msgDB = getDataAccessService().getList(Profile.class, null);
@@ -100,14 +104,11 @@ public class FnMenuServiceImpl implements FnMenuService{
@SuppressWarnings("unchecked")
@Override
- public List<RoleFunction> getFunctionCDList() {
- // TODO Auto-generated method stub
- //List<String> functioCDlist = new ArrayList<String>();
- //functioCDlist.add("Mahdy1");
- //functioCDlist.add("Mahdy2");
- return getDataAccessService().executeNamedQuery("functionCDlist", null, null);
-
- //return null;
+ public List<RoleFunction> getFunctionCDList(HttpServletRequest request) {
+ Set roleFunctionList = new HashSet<>();
+ roleFunctionList = UserUtils.getRoleFunctions(request);
+ List roleFunctionFinalList = new ArrayList<>(roleFunctionList);
+ return roleFunctionFinalList;
}
@Override
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java
index 1bfe2aba..270369c5 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java
@@ -139,8 +139,13 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
HashSet<RoleFunction> rolefun = null;
String repsonse = restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid());
+
user = mapper.readValue(repsonse, User.class);
+
+ Set<RoleFunction> roleFunctionListNew = new HashSet<>();
+ Set<RoleFunction> roleFunctionList = new HashSet<>();
+ SortedSet<UserApp> UserAppSet = new TreeSet<>();
@SuppressWarnings("unchecked")
Set<UserApp> setAppsObj = user.getUserApps();
@@ -153,8 +158,8 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
rolefun = new HashSet<>();
Role role = nextApp.getRole();
- Set<RoleFunction> roleFunctionList = role.getRoleFunctions();
- Set<RoleFunction> roleFunctionListNew = new HashSet<>();
+ roleFunctionList = role.getRoleFunctions();
+
Iterator<RoleFunction> itetaror = roleFunctionList.iterator();
while (itetaror.hasNext()) {
Object nextValue = itetaror.next();
@@ -165,7 +170,7 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
role.setRoleFunctions(roleFunctionListNew);
nextApp.setRole(role);
nextApp.getRole().getRoleFunctions();
- SortedSet<UserApp> UserAppSet = new TreeSet<>();
+
UserAppSet.add(nextApp);
user.setUserApps(UserAppSet);
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java
index f7a9cbec..94ecfaf4 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java
@@ -52,9 +52,9 @@ public class RestApiRequestBuilder {
decryptedPwd, isBasicAuth);
} catch (Exception ex) {
response = "Failed to perform GET " + ex.toString();
- throw new Exception(ex.getMessage());
+ throw new Exception("get Failed"+ ex);
}
- logger.debug(EELFLoggerDelegate.debugLogger, "getRoles response: {}", response);
+ logger.debug(EELFLoggerDelegate.errorLogger, "getRoles response: {}", response);
return response;
}
@@ -90,7 +90,8 @@ public class RestApiRequestBuilder {
RestWebServiceClient.getInstance().postPortalContent(restEndPoint, userId, appName, requestId, appUserName,
decryptedPwd, content_type, content, isBasicAuth);
} catch (Exception ex) {
- logger.error(EELFLoggerDelegate.debugLogger, "POST response: {}", ex);
+ logger.error(EELFLoggerDelegate.errorLogger, "POST response: {}", ex);
+
throw new Exception("Save Failed");
}
logger.debug(EELFLoggerDelegate.debugLogger, "POST response: {}");
@@ -129,7 +130,7 @@ public class RestApiRequestBuilder {
RestWebServiceClient.getInstance().deletePortalContent(restEndPoint, userId, appName, requestId, appUserName,
decryptedPwd, content_type, content, isBasicAuth, filter);
} catch (Exception ex) {
- logger.error(EELFLoggerDelegate.debugLogger, "DELETE response: {}", ex);
+ logger.error(EELFLoggerDelegate.errorLogger, "DELETE response: {}", ex);
throw new Exception("Delete Failed");
}
logger.debug(EELFLoggerDelegate.debugLogger, "DELETE response: {}");
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java
deleted file mode 100644
index 528f1bbb..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.openecomp.portalsdk.core.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.exception.SessionExpiredException;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.AppUtils;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional
-public class UrlAccessCentalizedImpl implements UrlAccessService {
-
- @Autowired
- AppService appService;
-
- @Autowired
- RoleService roleService;
-
-
- @Override
- public boolean isUrlAccessible(HttpServletRequest request, String currentUrl) {
-
- boolean isAccessible = false;
- User user = UserUtils.getUserSession(request);
-
-
- HttpSession session = AppUtils.getSession(request);
-
- if (session == null) {
- throw new SessionExpiredException();
- }
-
- @SuppressWarnings("unchecked")
- List<RoleFunction> allRoleFunctionsList = (List<RoleFunction>) session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTION_LIST));
-
- List<String> allUrls = new ArrayList<String>();
-
- for (int i = 0; i < allRoleFunctionsList.size(); i++) {
- if (allRoleFunctionsList.get(i).getCode() != null && ((String) allRoleFunctionsList.get(i).getCode()).substring(0, 4).toUpperCase().equals("url_".toUpperCase())) {
- String functionCd = ((String) allRoleFunctionsList.get(i).getCode()).substring(4).toUpperCase();
- allUrls.add(functionCd);
- }
- }
-
- @SuppressWarnings("unchecked")
- Set<RoleFunction> roleFunction = UserUtils.getRoleFunctions(request);
- List list = new ArrayList<>(roleFunction);
- List<String> UserURLlist = new ArrayList<String>();
-
- if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- if (list.get(i) != null && ((String) list.get(i)).substring(0, 4).toUpperCase().equals("url_".toUpperCase())) {
- String functionCd = ((String) list.get(i)).substring(4).toUpperCase();
- UserURLlist.add(functionCd);
- }
- }
- }
-
- if((!UserURLlist.contains(currentUrl) && !allUrls.contains(currentUrl)) || (UserURLlist.contains(currentUrl) && allUrls.contains(currentUrl)))
- {
- isAccessible = true;
- }else {
- isAccessible = false;
- }
- return isAccessible;
-
- }
-
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
index ea26b969..a7850e34 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
@@ -154,9 +154,6 @@ public class UserUtils {
session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME),
roleFunctions);
}
-
-
-
return roleFunctions;
}