summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-core
diff options
context:
space:
mode:
authorst782s <statta@research.att.com>2017-07-27 09:57:46 -0400
committerst782s <statta@research.att.com>2017-07-27 12:37:10 -0400
commitac05129bf7c8fbe62f17647f6233ce01a58ca1a3 (patch)
tree305fe715730297eaa9a6d12ba40ee19c00c0bb8c /ecomp-sdk/epsdk-core
parentcb02f8fc9b1d6233fc75fe37db313abd32edf6cb (diff)
Role centralization
Adding functionality to account for global roles across all applications which will be added at portal level Issue: [PORTAL-21] Change-Id: I4cdee652aaaa124abddb63410e1e45257b5bb6e0 Signed-off-by: st782s <statta@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/AccessConfiguration.java21
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java24
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java2
6 files changed, 17 insertions, 36 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java
index 8b83b389..6b00d3fb 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java
@@ -97,27 +97,6 @@ public class AccessConfiguration {
return new ProfileServiceCentralizedImpl();
}
- /**
- *
- * @return returns UrlAccessCentalizedImpl bean if CentralAccessCondition is true
- */
- @Bean
- @Conditional(CentralAccessCondition.class)
- public UrlAccessService userUtilsCentalizedImpl() {
- return new UrlAccessCentalizedImpl();
- }
-
-
- /**
- *
- * @return returns UrlAccessImpl bean if LocalAccessCondition is true
- */
- @Bean
- @Conditional(LocalAccessCondition.class)
- public UrlAccessService urlAccessImpl() {
- return new UrlAccessImpl();
- }
-
/**
*
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 6d723afa..1bfe2aba 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
@@ -138,7 +138,7 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
ObjectMapper mapper = new ObjectMapper();
HashSet<RoleFunction> rolefun = null;
- String repsonse = restApiRequestBuilder.getViaREST("/getUser/" + bean.getUserid(), true, bean.getUserid());
+ String repsonse = restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid());
user = mapper.readValue(repsonse, User.class);
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java
index e0b97254..dd4b16f9 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java
@@ -51,7 +51,7 @@ public class ProfileServiceCentralizedImpl implements ProfileService{
public User getUser(String id) throws Exception{
ObjectMapper mapper = new ObjectMapper();
User user = new User();
- String responseString =restApiRequestBuilder.getViaREST("/getUser/" + id, true,id);
+ String responseString =restApiRequestBuilder.getViaREST("/user/" + id, true,id);
user = mapper.readValue(responseString, User.class);
return user;
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java
index c7445b60..eff02543 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java
@@ -31,7 +31,7 @@ public class RoleServiceCentralizedAccess implements RoleService {
List<RoleFunction> roleFunctionList = null;
String role_function_list = "";
- role_function_list = restApiRequestBuilder.getViaREST("/getAllRoleFunctions", true, loginId);
+ role_function_list = restApiRequestBuilder.getViaREST("/functions", true, loginId);
ObjectMapper mapper = new ObjectMapper();
roleFunctionList = mapper.readValue(role_function_list,
TypeFactory.defaultInstance().constructCollectionType(List.class, RoleFunction.class));
@@ -74,7 +74,7 @@ public class RoleServiceCentralizedAccess implements RoleService {
public Role getRole(String loginId, Long id) throws Exception {
ObjectMapper mapper = new ObjectMapper();
String roleString = restApiRequestBuilder.getViaREST("/role/" + id, true, loginId);
- Role role = null;
+ Role role = new Role();
role = mapper.readValue(roleString, Role.class);
if (role.getRoleFunctions() != null) {
@SuppressWarnings("unchecked")
@@ -99,7 +99,7 @@ public class RoleServiceCentralizedAccess implements RoleService {
ObjectMapper mapper = new ObjectMapper();
String role = mapper.writeValueAsString(domainRole);
try {
- restApiRequestBuilder.postViaREST("/saveRole", true, role, loginId);
+ restApiRequestBuilder.postViaREST("/role", true, role, loginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "saveRole Failed", e);
throw new Exception(e.getMessage());
@@ -110,19 +110,18 @@ public class RoleServiceCentralizedAccess implements RoleService {
public void deleteRole(String loginId, Role domainRole) throws Exception {
ObjectMapper mapper = new ObjectMapper();
String role = mapper.writeValueAsString(domainRole);
- String filter = " where active_yn = 'Y' ";
+ String roleName = domainRole.getName().replaceAll(" ", "%20");
try {
- restApiRequestBuilder.deleteViaRest("/deleteRole", true, role, filter, loginId);
+ restApiRequestBuilder.deleteViaRest("/deleteRole/"+ roleName, true, role, null, loginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRole Failed", e);
throw new Exception(e.getMessage());
}
}
-
@Override
public List<Role> getAvailableRoles(String requestedLoginId) throws Exception {
ObjectMapper mapper = new ObjectMapper();
- String roleList = restApiRequestBuilder.getViaREST("/getRoles", true, requestedLoginId);
+ String roleList = restApiRequestBuilder.getViaREST("/roles", true, requestedLoginId);
List<Role> roles = null;
roles = mapper.readValue(roleList,
TypeFactory.defaultInstance().constructCollectionType(List.class, Role.class));
@@ -143,7 +142,7 @@ public class RoleServiceCentralizedAccess implements RoleService {
@Override
public RoleFunction getRoleFunction(String requestedLoginId, String code) throws Exception {
ObjectMapper mapper = new ObjectMapper();
- String responseString = restApiRequestBuilder.getViaREST("/getRoleFunction/" + code, true, requestedLoginId);
+ String responseString = restApiRequestBuilder.getViaREST("/function/" + code, true, requestedLoginId);
RoleFunction roleFunction = new RoleFunction();
if (!responseString.isEmpty()) {
roleFunction = mapper.readValue(responseString, RoleFunction.class);
@@ -156,21 +155,22 @@ public class RoleServiceCentralizedAccess implements RoleService {
ObjectMapper mapper = new ObjectMapper();
String roleFunction = mapper.writeValueAsString(domainRoleFunction);
try{
- restApiRequestBuilder.postViaREST("/saveRoleFunction", true, roleFunction, requestedLoginId);
+ restApiRequestBuilder.postViaREST("/roleFunction", true, roleFunction, requestedLoginId);
}catch(Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, "deleteDependcyRoleRecord Failed", e);
+ logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction Failed", e);
throw new Exception(e.getMessage());
}
}
@Override
public void deleteRoleFunction(String requestedLoginId, RoleFunction domainRoleFunction) throws Exception {
+ String code = domainRoleFunction.getCode();
ObjectMapper mapper = new ObjectMapper();
String roleFunction = mapper.writeValueAsString(domainRoleFunction);
try {
- restApiRequestBuilder.deleteViaRest("/deleteRoleFunction", true, roleFunction, null, requestedLoginId);
+ restApiRequestBuilder.deleteViaRest("/roleFunction/"+ code, true, roleFunction, null, requestedLoginId);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction Failed", e);
+ logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction Failed ", e);
throw new Exception(e.getMessage());
}
}
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
index 7074f512..02cb7807 100644
--- 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
@@ -9,9 +9,11 @@ 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;
+import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
+@Service("urlAccessService")
public class UrlAccessImpl implements UrlAccessService{
@Autowired
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
index 17691908..879b2a9a 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
@@ -48,7 +48,7 @@ public class UserServiceCentalizedImpl implements UserService {
User user = new User();
HashSet<RoleFunction> rolefun = null;
String orgUserId = getUserByProfileId(id);
- String responseString = restApiRequestBuilder.getViaREST("/getUser/" + orgUserId, true, id);
+ String responseString = restApiRequestBuilder.getViaREST("/user/" + orgUserId, true, id);
user = mapper.readValue(responseString, User.class);
@SuppressWarnings("unchecked")