From d23be7aa6224274f8740437291416b40800ce571 Mon Sep 17 00:00:00 2001 From: "Kishore Reddy, Gujja (kg811t)" Date: Tue, 16 Oct 2018 17:05:09 -0400 Subject: [PATCH] ExtAccessRolesServiceImpl.class Issue-ID: PORTAL-389 Fixed AAF sync roles to onap portal Change-Id: Ib75dd1aded3e3519662f61bbfd726cc2ddfc4af1 Signed-off-by: Kishore Reddy, Gujja (kg811t) --- deliveries/.env | 2 +- .../service/ExternalAccessRolesServiceImpl.java | 54 +--------------------- .../PortalDMLMySql_2_1_Common.sql | 6 +++ version.properties | 4 +- 4 files changed, 10 insertions(+), 56 deletions(-) diff --git a/deliveries/.env b/deliveries/.env index d1cc7d61..d8118158 100644 --- a/deliveries/.env +++ b/deliveries/.env @@ -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. diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java index c528e55e..29cd6444 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java @@ -2621,7 +2621,6 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic JSONArray extRole = getAppRolesJSONFromExtAuthSystem(app); logger.debug(EELFLoggerDelegate.debugLogger, "Entering into getExternalRoleDetailsList"); - //refactoring done List 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 finalRoleList) { - for (EPRole roleItem : finalRoleList) { - final Map roleParams = new HashMap<>(); - List 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 extRoleParams = new HashMap<>(); List 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 { diff --git a/ecomp-portal-DB-common/PortalDMLMySql_2_1_Common.sql b/ecomp-portal-DB-common/PortalDMLMySql_2_1_Common.sql index 6c60c50f..6cd767b4 100644 --- a/ecomp-portal-DB-common/PortalDMLMySql_2_1_Common.sql +++ b/ecomp-portal-DB-common/PortalDMLMySql_2_1_Common.sql @@ -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'); diff --git a/version.properties b/version.properties index c45e6580..bc2c506d 100644 --- a/version.properties +++ b/version.properties @@ -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} -- 2.16.6