summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-aaf/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/main')
-rw-r--r--ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java5
-rw-r--r--ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java11
2 files changed, 10 insertions, 6 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java
index a0eee23d..d2ccfc2e 100644
--- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java
+++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java
@@ -48,6 +48,8 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.command.LoginBean;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.menu.MenuBuilder;
import org.onap.portalsdk.core.service.DataAccessService;
@@ -55,8 +57,6 @@ import org.onap.portalsdk.core.service.LoginServiceCentralizedImpl;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.portalsdk.core.web.support.AppUtils;
import org.onap.portalsdk.core.web.support.UserUtils;
-import org.onap.portalsdk.core.domain.Role;
-import org.onap.portalsdk.core.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -211,6 +211,7 @@ public class LoginExternalAuthServiceImpl implements LoginExternalAuthService {
private User findUser(LoginBean bean, HttpServletRequest request) throws Exception {
User user = userApiService.getUser(bean.getUserid(), request);
user.setId(getUserIdByOrgUserId(user.getOrgUserId()));
+ user.setLoginId(bean.getUserid());
logger.debug(EELFLoggerDelegate.debugLogger, "findUser: Returning final user roles and permissions", user.toString());
return user;
}
diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java
index cecab472..f550b919 100644
--- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java
+++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java
@@ -142,10 +142,12 @@ public class UserApiServiceImpl implements UserApiService {
&& EcompExternalAuthUtils.isJSONValid(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION))) {
ExternalRoleDescription desc = mapper.readValue(
role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION), ExternalRoleDescription.class);
- JSONArray perms = role.getJSONArray(EcompExternalAuthUtils.EXT_FIELD_PERMS);
- List<ExternalAccessPerms> permsList = mapper.readValue(perms.toString(), TypeFactory
- .defaultInstance().constructCollectionType(List.class, ExternalAccessPerms.class));
- desc.setPermissions(permsList);
+ if(role.has(EcompExternalAuthUtils.EXT_FIELD_PERMS)) {
+ JSONArray perms = role.getJSONArray(EcompExternalAuthUtils.EXT_FIELD_PERMS);
+ List<ExternalAccessPerms> permsList = mapper.readValue(perms.toString(), TypeFactory
+ .defaultInstance().constructCollectionType(List.class, ExternalAccessPerms.class));
+ desc.setPermissions(permsList);
+ }
userRoleDetail = new ExternalAccessUserRoleDetail(
role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), desc);
userRoleDetailList.add(userRoleDetail);
@@ -179,6 +181,7 @@ public class UserApiServiceImpl implements UserApiService {
postSearchBean.setSearchResult(loadSearchResultData(postSearchBean));
user = (User) postSearchBean.getSearchResult().get(0);
user.setActive(true);
+ user.setLoginId(orgUserId);
dataAccessService.saveDomainObject(user, null);
}
App app = appService.getApp(1l);