summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-core/src/main/java
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-08-23 15:46:44 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-08-23 15:47:54 -0400
commit1683d7929869d7d5f9bda1ffad0ace619c507ce0 (patch)
tree181df2305e7b1d5960b6e0fc2c65a36eaa554068 /ecomp-sdk/epsdk-core/src/main/java
parentf03552714077df2a3f11fe33a81342558dfe1705 (diff)
Repair role-centralization features in EPSDK
Issue: PORTAL-21 Change-Id: Icf276482609734d3aa24f04ae0a8135021a3d305 Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/main/java')
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java13
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java4
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java10
3 files changed, 18 insertions, 9 deletions
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 e5d380c9..bab2249c 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
@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.openecomp.portalsdk.core.command.LoginBean;
@@ -132,9 +133,21 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
User user = null;
String repsonse = restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid());
user = userService.userMapper(repsonse);
+ user.setId(getUserIdByOrgUserId(user.getOrgUserId()));
return user;
}
+ public Long getUserIdByOrgUserId(String orgUserId) {
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("orgUserId", orgUserId);
+ @SuppressWarnings("rawtypes")
+ List list = getDataAccessService().executeNamedQuery("getUserIdByorgUserId", params, null);
+ Long userId = null;
+ if (list != null && !list.isEmpty())
+ userId = (Long) list.get(0);
+ return userId;
+ }
+
public User findUser(String loginId, String password) {
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 00673682..52473608 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
@@ -98,7 +98,7 @@ public class RestApiRequestBuilder {
}
- public void deleteViaRest(String restEndPoint, boolean isBasicAuth, String content, String filter , String userId) throws Exception {
+ public void deleteViaRest(String restEndPoint, boolean isBasicAuth, String content, String userId) throws Exception {
String appName = "";
String requestId = "";
String appUserName = "";
@@ -128,7 +128,7 @@ public class RestApiRequestBuilder {
try {
RestWebServiceClient.getInstance().deletePortalContent(restEndPoint, userId, appName, requestId, appUserName,
- decryptedPwd, content_type, content, isBasicAuth, filter);
+ decryptedPwd, content_type, content, isBasicAuth);
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger, "DELETE response: {}", ex);
throw new Exception("Delete Failed");
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 eff02543..53f257bd 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
@@ -108,11 +108,9 @@ public class RoleServiceCentralizedAccess implements RoleService {
@Override
public void deleteRole(String loginId, Role domainRole) throws Exception {
- ObjectMapper mapper = new ObjectMapper();
- String role = mapper.writeValueAsString(domainRole);
String roleName = domainRole.getName().replaceAll(" ", "%20");
try {
- restApiRequestBuilder.deleteViaRest("/deleteRole/"+ roleName, true, role, null, loginId);
+ restApiRequestBuilder.deleteViaRest("/deleteRole/"+ roleName, true, null, loginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRole Failed", e);
throw new Exception(e.getMessage());
@@ -165,10 +163,8 @@ public class RoleServiceCentralizedAccess implements RoleService {
@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("/roleFunction/"+ code, true, roleFunction, null, requestedLoginId);
+ restApiRequestBuilder.deleteViaRest("/roleFunction/"+ code, true, null, requestedLoginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction Failed ", e);
throw new Exception(e.getMessage());
@@ -178,7 +174,7 @@ public class RoleServiceCentralizedAccess implements RoleService {
@Override
public void deleteDependcyRoleRecord(String requestedLoginId, Long id) {
try {
- restApiRequestBuilder.deleteViaRest("/deleteDependcyRoleRecord/" + id, true, null, null, requestedLoginId);
+ restApiRequestBuilder.deleteViaRest("/deleteDependcyRoleRecord/" + id, true, null, requestedLoginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "deleteDependcyRoleRecord Failed", e);
}