summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-aaf
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-aaf')
-rw-r--r--ecomp-sdk/epsdk-aaf/pom.xml4
-rw-r--r--ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java28
2 files changed, 20 insertions, 12 deletions
diff --git a/ecomp-sdk/epsdk-aaf/pom.xml b/ecomp-sdk/epsdk-aaf/pom.xml
index ff735241..2e5fbf35 100644
--- a/ecomp-sdk/epsdk-aaf/pom.xml
+++ b/ecomp-sdk/epsdk-aaf/pom.xml
@@ -5,12 +5,12 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.3.0-SNAPSHOT</version>
+ <version>2.3.0</version>
</parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-aaf</artifactId>
- <version>2.3.0-SNAPSHOT</version>
+ <version>2.3.0</version>
<packaging>jar</packaging>
<name>ONAP Portal SDK AAF Authorization</name>
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();