diff options
author | Christopher Lott (cl778h) <clott@research.att.com> | 2017-07-07 07:21:10 -0400 |
---|---|---|
committer | Christopher Lott (cl778h) <clott@research.att.com> | 2017-07-07 07:22:13 -0400 |
commit | 3e7145fc12ed8475ba10bb2a3c63004d41aa42bc (patch) | |
tree | c205d84c80e4786708caa705683a56de37c5ed2d /ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java | |
parent | 952895873b6179857c6773086a4d2b55f086bd61 (diff) |
[PORTAL-25] Role Centralization
Bump EP SDK version to 1.3.0-SNAPSHOT
Support Role Centralization & Common Set of Roles across All ONAP On-Boarded Applications
Change-Id: Icfc1bbfddaf2c7c7176b4cf7bb7017d853c63100
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java')
-rw-r--r-- | ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java new file mode 100644 index 00000000..e01abfbb --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java @@ -0,0 +1,48 @@ +package org.openecomp.portalsdk.core.service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.domain.UrlsAccessible; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; + +public class UrlAccessImpl implements UrlAccessService{ + + @Autowired + DataAccessService dataAccessService; + + + + @Override + public boolean isUrlAccessible(HttpServletRequest request, String currentUrl) { + boolean isAccessible = false; + Map<String, String> params = new HashMap<>(); + params.put("current_url", currentUrl); + List list = dataAccessService.executeNamedQuery("restrictedUrls", params, null); + + // loop through the list of restricted URL's + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + /* + * Object[] restrictedUrl = (Object[])list.get(i); + * + * String url = (String)restrictedUrl[0]; String functionCd = + * (String)restrictedUrl[1]; + */ + UrlsAccessible urlFunctions = (UrlsAccessible) list.get(i); + // String url = (String) urlFunctions.getUrl(); + String functionCd = (String) urlFunctions.getFunctionCd(); + if (UserUtils.isAccessible(request, functionCd)) { + isAccessible = true; + } + } + return isAccessible; + } + return true; + } + +} |