diff options
author | 2019-02-14 15:16:30 -0500 | |
---|---|---|
committer | 2019-02-14 15:16:30 -0500 | |
commit | 32f584718e108c192817863880941bd922c6575b (patch) | |
tree | aa9fd8dc1069d5fa996dbdf6c235092d3558ea38 /ecomp-sdk/epsdk-core/src/main/java/org/onap | |
parent | e8b5b88d6cbe36d62fad93ca696a09e06db0942a (diff) |
pom, upgrade script changes, AAF role desc fix
Issue-ID: PORTAL-356
portal/SDK release 2.5.1, POM, upgrade script
Change-Id: If71a1bbbcf31699ed424c86a8fead2e3c704373f
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kishore.reddy.gujja@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/onap')
-rw-r--r-- | ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java index 074419e6..fd05c695 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java @@ -1,5 +1,4 @@ - /*- * ============LICENSE_START========================================== * ONAP Portal SDK @@ -62,7 +61,6 @@ import org.onap.portalsdk.core.onboarding.util.CipherUtil; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.external.authorization.domain.ExternalAccessPerms; import org.onap.portalsdk.external.authorization.domain.ExternalAccessRole; -import org.onap.portalsdk.external.authorization.domain.ExternalAccessRoleDescription; import org.onap.portalsdk.external.authorization.domain.ExternalAccessUserRoleDetail; import org.onap.portalsdk.external.authorization.exception.UserNotFoundException; import org.onap.portalsdk.external.authorization.service.AAFRestServiceImpl; @@ -85,7 +83,6 @@ import com.fasterxml.jackson.databind.type.TypeFactory; @Service("userApiService") public class UserApiServiceImpl implements UserApiService { - private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserApiServiceImpl.class); @Autowired @@ -104,8 +101,7 @@ public class UserApiServiceImpl implements UserApiService { @Autowired private AppService appService; - - + private AAFService aafService = new AAFRestServiceImpl(); @Override @@ -114,7 +110,7 @@ public class UserApiServiceImpl implements UserApiService { try { String namespace = EcompExternalAuthProperties .getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_NAMESPACE); - + HttpHeaders headers = getBasicAuthHeaders(); String userRoles = aafService.getUser(orgUserId, request, headers); ObjectMapper mapper = new ObjectMapper(); @@ -148,12 +144,6 @@ public class UserApiServiceImpl implements UserApiService { .endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_ADMIN) && !role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME) .endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_OWNER)) { - ExternalAccessRoleDescription ecDesc = new ExternalAccessRoleDescription(); - if (role.has(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION) && EcompExternalAuthUtils - .isJSONValid(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION))) { - ecDesc = mapper.readValue(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION), - ExternalAccessRoleDescription.class); - } List<ExternalAccessPerms> ecPerms = new ArrayList<>(); if (role.has(EcompExternalAuthUtils.EXT_FIELD_PERMS)) { JSONArray perms = role.getJSONArray(EcompExternalAuthUtils.EXT_FIELD_PERMS); @@ -161,7 +151,7 @@ public class UserApiServiceImpl implements UserApiService { .constructCollectionType(List.class, ExternalAccessPerms.class)); } ExternalAccessRole ecRole = new ExternalAccessRole( - role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), ecPerms, ecDesc); + role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), ecPerms); userRoleDetail = new ExternalAccessUserRoleDetail(ecRole); userRoleDetailList.add(userRoleDetail); } @@ -203,21 +193,11 @@ public class UserApiServiceImpl implements UserApiService { Set userApps = new TreeSet(); for (ExternalAccessUserRoleDetail userRoleDetail : userRoleDetailList) { ExternalAccessRole ecRole = userRoleDetail.getRole(); - ExternalAccessRoleDescription roleDesc = ecRole.getDescription(); UserApp userApp = new UserApp(); Role role = new Role(); Set roleFunctions = new TreeSet<>(); - if (roleDesc.getName() == null) { - role.setActive(true); - role.setName(ecRole.getName()); - } else { - role.setActive(Boolean.valueOf(roleDesc.getActive())); - role.setId(Long.valueOf(roleDesc.getAppRoleId())); - role.setName(roleDesc.getName()); - if (!roleDesc.getPriority().equals(EcompExternalAuthUtils.EXT_NULL_VALUE)) { - role.setPriority(Integer.valueOf(roleDesc.getPriority())); - } - } + role.setActive(true); + role.setName(ecRole.getName()); for (ExternalAccessPerms extPerm : ecRole.getPerms()) { RoleFunction roleFunction = new RoleFunction(); roleFunction.setCode(extPerm.getInstance()); @@ -252,10 +232,10 @@ public class UserApiServiceImpl implements UserApiService { @Override public List<RoleFunction> getRoleFunctions(String orgUserId) throws Exception { HttpHeaders headers = getBasicAuthHeaders(); - return aafService.getRoleFunctions(orgUserId,headers); + return aafService.getRoleFunctions(orgUserId, headers); } - + @SuppressWarnings("unused") private ResponseEntity<String> getPermsFromExternalAuthSystem(HttpEntity<String> entity, String endPoint) { ResponseEntity<String> getResponse = template.exchange( EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_URL) + endPoint, @@ -283,14 +263,13 @@ public class UserApiServiceImpl implements UserApiService { result = CipherUtil.decryptPKC(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger,"decryptedPassword failed", e); + logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); throw e; } } return result; } - - + private SearchResult loadSearchResultData(PostSearchBean searchCriteria) throws NamingException { return ldapService.searchPost(searchCriteria.getUser(), searchCriteria.getSortBy1(), searchCriteria.getSortBy2(), searchCriteria.getSortBy3(), searchCriteria.getPageNo(), @@ -302,15 +281,13 @@ public class UserApiServiceImpl implements UserApiService { String encryptedPass = EcompExternalAuthProperties .getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_PASSWORD); String appPassword = decryptPass(encryptedPass); - return aafService.checkUserExists(username,password, appPassword); + return aafService.checkUserExists(username, password, appPassword); } - - @Override public List<ExternalAccessPerms> getIfUserPermsExists(String username) throws Exception { HttpHeaders headers = getBasicAuthHeaders(); - return aafService.getIfUserPermsExists(username,headers); + return aafService.getIfUserPermsExists(username, headers); } }
\ No newline at end of file |