diff options
author | 2018-04-27 17:06:02 -0400 | |
---|---|---|
committer | 2018-04-27 17:06:02 -0400 | |
commit | 9acf56e5cdd1c7287753f7df1e99573b4d0fbd0f (patch) | |
tree | c9a3a337d4668debbe6a51a73122b5db2d957248 /ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java | |
parent | 62cdec31001fa97970548e7e6309efe3adc59772 (diff) |
pom, new modules changes
Issue-ID: PORTAL-254
portal/SDK release 2.3.0, domain, sdk aaf modules
Change-Id: I9634b902e6127e6b649d163146b5304f78a55b1c
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java')
-rw-r--r-- | ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java | 28 |
1 files changed, 18 insertions, 10 deletions
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 f550b919..8425f7da 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 @@ -137,11 +137,14 @@ public class UserApiServiceImpl implements UserApiService { && !role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME) .endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_OWNER) && EcompExternalAuthUtils.checkNameSpaceMatching(role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), - namespace) - && role.has(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION) - && EcompExternalAuthUtils.isJSONValid(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION))) { - ExternalRoleDescription desc = mapper.readValue( - role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION), ExternalRoleDescription.class); + namespace)) { + ExternalRoleDescription desc = new ExternalRoleDescription(); + if(role.has(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION) + && EcompExternalAuthUtils + .isJSONValid(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION))) { + desc = mapper.readValue(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION), + ExternalRoleDescription.class); + } if(role.has(EcompExternalAuthUtils.EXT_FIELD_PERMS)) { JSONArray perms = role.getJSONArray(EcompExternalAuthUtils.EXT_FIELD_PERMS); List<ExternalAccessPerms> permsList = mapper.readValue(perms.toString(), TypeFactory @@ -193,11 +196,16 @@ public class UserApiServiceImpl implements UserApiService { Role role = new Role(); Set roleFunctions = new TreeSet<>(); if (roleDesc != null) { - 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())); + if (roleDesc.getName() == null) { + role.setActive(true); + role.setName(userRoleDetail.getName().substring(namespace.length() + 1)); + } 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())); + } } for (ExternalAccessPerms extPerm : roleDesc.getPermissions()) { RoleFunction roleFunction = new RoleFunction(); |