diff options
author | Kishore Reddy, Gujja (kg811t) <kishore.reddy.gujja@att.com> | 2018-10-16 17:05:09 -0400 |
---|---|---|
committer | Manoop Talasila <talasila@research.att.com> | 2018-10-18 16:00:59 +0000 |
commit | aab450cb23f956066cf57ae6ad0fc8cfb92efb3e (patch) | |
tree | cf2b8ca28ba8e0d591d4137a4397b8a4c678b0d9 | |
parent | 1c3cc6fb0e4d2f4f2278240ff0387596c776b9c9 (diff) |
ExtAccessRolesServiceImpl.class
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>
(cherry picked from commit d23be7aa6224274f8740437291416b40800ce571)
-rw-r--r-- | deliveries/.env | 2 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java | 54 | ||||
-rw-r--r-- | ecomp-portal-DB-common/PortalDMLMySql_2_1_Common.sql | 6 | ||||
-rw-r--r-- | 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<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); @@ -2721,52 +2715,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 * * @param app @@ -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 { 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} |