ExtAccessRolesServiceImpl.class 99/70599/2
authorKishore Reddy, Gujja (kg811t) <kishore.reddy.gujja@att.com>
Tue, 16 Oct 2018 21:05:09 +0000 (17:05 -0400)
committerKishore Reddy, Gujja (kg811t) <kishore.reddy.gujja@att.com>
Wed, 17 Oct 2018 21:02:45 +0000 (17:02 -0400)
Issue-ID: PORTAL-389

Fixed AAF sync roles to onap portal

Change-Id: Ib75dd1aded3e3519662f61bbfd726cc2ddfc4af1
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kishore.reddy.gujja@att.com>
deliveries/.env
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
ecomp-portal-DB-common/PortalDMLMySql_2_1_Common.sql
version.properties

index d1cc7d6..d811815 100644 (file)
@@ -14,7 +14,7 @@ CLI_IMG_NAME=onap/cli
 
 # This is the first portion of the Docker image tag
 # that is published to the ONAP registry.
-PORTAL_VERSION=2.3.0
+PORTAL_VERSION=2.3.1
 
 # This is used during builds and in docker-compose;
 # it is never published to the ONAP registry.
index c528e55..29cd644 100644 (file)
@@ -2621,7 +2621,6 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        JSONArray extRole = getAppRolesJSONFromExtAuthSystem(app);
                        
                        logger.debug(EELFLoggerDelegate.debugLogger, "Entering into getExternalRoleDetailsList");
-                       //refactoring done
                        List<ExternalRoleDetails> externalRoleDetailsList = getExternalRoleDetailsList(app,
                                        mapper, extRole);
                        
@@ -2648,11 +2647,6 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        logger.debug(EELFLoggerDelegate.debugLogger, "Entering into inactiveRolesNotInExternalAuthSystem");
                        // Check if roles exits in external Access system and if not make inactive in DB
                        inactiveRolesNotInExternalAuthSystem(app, finalRoleList, applicationRolesList);
-
-                       logger.debug(EELFLoggerDelegate.debugLogger, "Entering into checkAndUpdateRoleInDB");
-                       // It checks properties in the external auth system app role description and updates role in local
-                       checkAndUpdateRoleInDB(app, finalRoleList);
-
                        logger.debug(EELFLoggerDelegate.debugLogger, "Entering into addNewRoleInEcompDBUpdateDescInExtAuthSystem");
                        // Add new roles in DB and updates role description in External Auth System 
                        addNewRoleInEcompDBUpdateDescInExtAuthSystem(app, roleListToBeAddInEcompDB);
@@ -2719,52 +2713,6 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                }
        }
 
-       /**
-        * 
-        * It checks description in External Auth System if found any changes updates in DB
-        * 
-        * @param app
-        * @param finalRoleList contains list of External Auth System roles list which is converted to EPRole
-        */
-       @SuppressWarnings("unchecked")
-       private void checkAndUpdateRoleInDB(EPApp app, List<EPRole> finalRoleList) {
-               for (EPRole roleItem : finalRoleList) {
-                       final Map<String, String> roleParams = new HashMap<>();
-                       List<EPRole> currentList = null;
-                       roleParams.put(APP_ROLE_NAME_PARAM, roleItem.getName());
-                       if (app.getId() == 1) {
-                               currentList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, roleParams, null);
-                       } else {
-                               roleParams.put(APP_ID, app.getId().toString());
-                               currentList = dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM, roleParams, null);
-                       }
-
-                       if (!currentList.isEmpty()) {
-                               try {
-                                       Boolean aafRoleActive;
-                                       Boolean localRoleActive;
-                                       boolean result;
-                                       aafRoleActive = Boolean.valueOf(roleItem.getActive());
-                                       localRoleActive = Boolean.valueOf(currentList.get(0).getActive());
-                                       result = aafRoleActive.equals(localRoleActive);
-                                       EPRole updateRole = currentList.get(0);
-
-                                       if (!result) {
-                                               updateRole.setActive(roleItem.getActive());
-                                               dataAccessService.saveDomainObject(updateRole, null);
-                                       }
-                                       if (roleItem.getPriority() != null
-                                                       && !currentList.get(0).getPriority().equals(roleItem.getPriority())) {
-                                               updateRole.setPriority(roleItem.getPriority());
-                                               dataAccessService.saveDomainObject(updateRole, null);
-                                       }
-                               } catch (Exception e) {
-                                       logger.error(EELFLoggerDelegate.errorLogger,
-                                                       "syncApplicationRolesWithEcompDB: Failed to update role ", e);
-                               }
-                       }
-               }
-       }
        /**
         * 
         * It de-activates application roles in DB if not present in External Auth system  
@@ -2785,7 +2733,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                final Map<String, String> extRoleParams = new HashMap<>();
                                List<EPRole> roleList = null;
                                extRoleParams.put(APP_ROLE_NAME_PARAM, role.getName());
-                               if (!checkRolesInactive.containsKey(role.getName())) {
+                               if (!checkRolesInactive.containsKey(role.getName().replaceAll(EcompPortalUtils.EXTERNAL_CENTRAL_AUTH_ROLE_HANDLE_SPECIAL_CHARACTERS, "_"))) {
                                        if (app.getId() == 1) {
                                                roleList = dataAccessService.executeNamedQuery(GET_PORTAL_APP_ROLES_QUERY, extRoleParams, null);
                                        } else {
index 6c60c50..6cd767b 100644 (file)
@@ -69,6 +69,12 @@ Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('apa','Add Portal Admi
 Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('dpa','Delete Portal Admin');
 Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('uaa','Update Account Admin');
 Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('uu','Update User');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('eaaf','External auth add function');                            
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('eaar','External auth add role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('eadf','External auth delete function');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('eadr','External auth delete role');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('eauf','External auth update function');
+Insert into fn_lu_activity (ACTIVITY_CD,ACTIVITY) values ('eaurf','External auth update role and function');
 
 -- FN_LU_MENU_SET
 Insert into fn_lu_menu_set (MENU_SET_CD,MENU_SET_NAME) values ('APP','Application Menu');
index c45e658..bc2c506 100644 (file)
@@ -3,8 +3,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major=2
-minor=2
-patch=0
+minor=3
+patch=1
 
 base_version=${major}.${minor}.${patch}