summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-aaf/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src')
-rw-r--r--ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java28
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();