Fixed Role Sync and changed pom version 99/105899/1
authorSudarshan Kumar <sudarshan.kumar@att.com>
Tue, 14 Apr 2020 09:42:40 +0000 (15:12 +0530)
committerSudarshan Kumar <sudarshan.kumar@att.com>
Tue, 14 Apr 2020 09:42:48 +0000 (15:12 +0530)
Fixed Role Sync and changed pom version

Issue-ID: PORTAL-875
Change-Id: I95f25a310601d1fba37f76663046e3af3223a040
Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
12 files changed:
.gitignore
ecomp-portal-BE-common/pom.xml
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
ecomp-portal-BE-os/pom.xml
ecomp-portal-FE-os/pom.xml
ecomp-portal-widget-ms/common-widgets/pom.xml
ecomp-portal-widget-ms/pom.xml
ecomp-portal-widget-ms/widget-ms/pom.xml
pom.xml
portal-FE-os/pom.xml
version.properties

index eb6bfe1..3087003 100644 (file)
@@ -16,3 +16,5 @@ kubernetes/.classpath/*
 kubernetes/.settings/*
 ecomp-portal-FE-att/client/bower*
 /.metadata/
+/bin
+/.classpath
index d36d740..19d3243 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>3.2.0</version>
+               <version>3.3.0</version>
        </parent>
 
        <artifactId>portal-be-common</artifactId>
index 4e83b92..241468c 100644 (file)
@@ -311,8 +311,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                        boolean isRoleNameChanged = false;
                                        if (!desc.equals(updateExtRole.getName())) {
                                                isRoleNameChanged = true;
+                                               addRole(updateExtRole, app.getUebKey()); //interchange 314 -315
                                                deleteRoleInExtSystem(mapper, name);
-                                               addRole(updateExtRole, app.getUebKey());
                                                // add partner functions to the global role in External
                                                // Auth System
                                                if (!list.isEmpty() && isGlobalRole) {
@@ -348,7 +348,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                                                roleFunc.getCode(), roleFunc.getAction());
                                                extAddRolePerms = new ExternalAccessRolePerms(extAddPerms,
                                                                app.getNameSpace() + "." + updateExtRole.getName().replaceAll(
-                                                                               EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
+                                                               EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"));
                                                response = addRoleFuncExtSysRestAPI(mapper, extAddRolePerms, headers);
                                        }
                                }
@@ -1973,14 +1973,29 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                                        .containsKey(extAuthrole.substring(app.getNameSpace().length() + 1))) {
                                                EPRole localAddFuntionRole = currentRolesInDB
                                                                .get(extAuthrole.substring(app.getNameSpace().length() + 1));
+                                               
+                                               String key = extAuthrole.substring(app.getNameSpace().length() + 1);
+                                               Boolean isaddAppRoleFuncRequired = true;
+                                               if(localAddFuntionRole == null && key.contains("-")) {
+                                                       key = key.replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_");
+                                                       localAddFuntionRole = currentRolesInDB.get(key);
+                                                       if(localAddFuntionRole !=null) {
+                                                               isaddAppRoleFuncRequired = false;
+                                                       }
+                                               }
+                                               
+                                               logger.info("key >>>>>"+key);
+                                               logger.info("localAddFuntionRole >>>>>"+localAddFuntionRole);
                                                if (localAddFuntionRole == null) {
                                                        checkAndAddRoleInDB(app, currentRolesInDB, roleFunctionList, extAuthrole);
                                                } else {
-                                                       EPAppRoleFunction addAppRoleFunc = new EPAppRoleFunction();
-                                                       addAppRoleFunc.setAppId(app.getId());
-                                                       addAppRoleFunc.setCode(roleFunctionList.get(0).getCode());
-                                                       addAppRoleFunc.setRoleId(localAddFuntionRole.getId());
-                                                       dataAccessService.saveDomainObject(addAppRoleFunc, null);
+                                                       if(isaddAppRoleFuncRequired) {
+                                                               EPAppRoleFunction addAppRoleFunc = new EPAppRoleFunction();
+                                                               addAppRoleFunc.setAppId(app.getId());
+                                                               addAppRoleFunc.setCode(roleFunctionList.get(0).getCode());
+                                                               addAppRoleFunc.setRoleId(localAddFuntionRole.getId());
+                                                               dataAccessService.saveDomainObject(addAppRoleFunc, null);
+                                                       }
                                                }
                                        }
                                        // This block is to save global role function if exists
@@ -2684,11 +2699,11 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        applicationRolesList = getAppRoles(app.getId());
                        List<String> applicationRoleIdList = new ArrayList<>();
                        for (EPRole applicationRole : applicationRolesList) {
-                               applicationRoleIdList.add(applicationRole.getName());
+                               applicationRoleIdList.add(applicationRole.getName().trim());
                        }
                        List<EPRole> roleListToBeAddInEcompDB = new ArrayList<>();
                        for (EPRole aafRole : finalRoleList) {
-                               if (!applicationRoleIdList.contains(aafRole.getName())) {
+                               if (!applicationRoleIdList.contains(aafRole.getName().trim())) {
                                        roleListToBeAddInEcompDB.add(aafRole);
                                }
                        }
@@ -2822,7 +2837,12 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        String name = extRole.getJSONObject(i).getString(ROLE_NAME);
                        String actualRoleName = name.substring(app.getNameSpace().length() + 1);
                        if (extRole.getJSONObject(i).has(EXTERNAL_AUTH_ROLE_DESCRIPTION)) {
-                               actualRoleName = extRole.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION);
+                               String description = extRole.getJSONObject(i).getString(EXTERNAL_AUTH_ROLE_DESCRIPTION);
+                                                               
+                               if(actualRoleName.replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS_EXCLUDE_HYPHEN,"_")
+                                       .equalsIgnoreCase(description.replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS_EXCLUDE_HYPHEN,"_"))){
+                                       actualRoleName = description;
+                               }
                        }
                        SortedSet<ExternalAccessPerms> externalAccessPermsOfRole = new TreeSet<>();
                        if (extRole.getJSONObject(i).has(EXTERNAL_AUTH_PERMS)) {
index 7c9aa76..e5543a3 100644 (file)
@@ -81,7 +81,8 @@ public class EcompPortalUtils {
 
        // It is a regular expression used for while creating a External Central Auth
        // Role
-       public static final String EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS = "([^A-Z^a-z^0-9^\\.^%^(^)^=^:])";
+       public static final String EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS = "([^A-Z^a-z^0-9^\\.^%^(^)^=^:^-])";
+       public static final String EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS_EXCLUDE_HYPHEN = "([^A-Z^a-z^0-9^\\.^%^(^)^=^:])";
 
        public static final String slash = "/";
 
index 7ab6cc4..4ad50df 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>3.2.0</version>
+               <version>3.3.0</version>
        </parent>
 
        <artifactId>portal-be-os</artifactId>
index d46ff56..735ce79 100644 (file)
@@ -5,7 +5,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>3.2.0</version>
+               <version>3.3.0</version>
        </parent>
 
        <artifactId>portal-FE-os</artifactId>
index 9e970ef..2fdc2f8 100644 (file)
@@ -6,7 +6,7 @@
         <parent>
                 <groupId>org.onap.portal</groupId>
                 <artifactId>widget-ms-parent</artifactId>
-                               <version>3.2.0</version>
+                               <version>3.3.0</version>
         </parent>
 
        <artifactId>common-widgets</artifactId>
index d2c5f89..553535d 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <groupId>org.onap.portal</groupId>
                <artifactId>onap-portal-parent</artifactId>
-               <version>3.2.0</version>
+               <version>3.3.0</version>
        </parent>
 
        <artifactId>widget-ms-parent</artifactId>
index 32ca033..4095388 100644 (file)
@@ -13,7 +13,7 @@
 
        <groupId>org.onap.portal</groupId>
        <artifactId>widget-ms</artifactId>
-       <version>3.2.0</version>
+       <version>3.3.0</version>
        <packaging>jar</packaging>
        <name>widget-microservice</name>
 
diff --git a/pom.xml b/pom.xml
index 76dc454..19d8c34 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
 
        <groupId>org.onap.portal</groupId>
        <artifactId>onap-portal-parent</artifactId>
-       <version>3.2.0</version>
+       <version>3.3.0</version>
 
        <packaging>pom</packaging>
        <name>portal</name>
index fd497e1..af265d0 100644 (file)
@@ -4,7 +4,7 @@
 
        <groupId>org.onap.portal</groupId>
        <artifactId>portal-FE-os</artifactId>
-       <version>3.2.0</version>
+       <version>3.3.0</version>
 
        <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
index f34034b..2640898 100644 (file)
@@ -3,7 +3,7 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major=3
-minor=2
+minor=3
 patch=0
 
 base_version=${major}.${minor}.${patch}