diff options
author | Sudarshan Kumar <sudarshan.kumar@att.com> | 2020-04-14 15:12:40 +0530 |
---|---|---|
committer | Sudarshan Kumar <sudarshan.kumar@att.com> | 2020-04-14 15:12:48 +0530 |
commit | 25b97739e0a702b18321fda93add927909152e5e (patch) | |
tree | 73fff5afc1864297f9ebf0931c473820d70c8b37 | |
parent | 64937f93f1a09eeafa80e8bb33c4a42c1cdadaf1 (diff) |
Fixed Role Sync and changed pom version
Fixed Role Sync and changed pom version
Issue-ID: PORTAL-875
Change-Id: I95f25a310601d1fba37f76663046e3af3223a040
Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | ecomp-portal-BE-common/pom.xml | 2 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java | 40 | ||||
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java | 3 | ||||
-rw-r--r-- | ecomp-portal-BE-os/pom.xml | 2 | ||||
-rw-r--r-- | ecomp-portal-FE-os/pom.xml | 2 | ||||
-rw-r--r-- | ecomp-portal-widget-ms/common-widgets/pom.xml | 2 | ||||
-rw-r--r-- | ecomp-portal-widget-ms/pom.xml | 2 | ||||
-rw-r--r-- | ecomp-portal-widget-ms/widget-ms/pom.xml | 2 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | portal-FE-os/pom.xml | 2 | ||||
-rw-r--r-- | version.properties | 2 |
12 files changed, 43 insertions, 20 deletions
@@ -16,3 +16,5 @@ kubernetes/.classpath/* kubernetes/.settings/* ecomp-portal-FE-att/client/bower* /.metadata/ +/bin +/.classpath diff --git a/ecomp-portal-BE-common/pom.xml b/ecomp-portal-BE-common/pom.xml index d36d740b..19d32431 100644 --- a/ecomp-portal-BE-common/pom.xml +++ b/ecomp-portal-BE-common/pom.xml @@ -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> 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 4e83b921..241468c3 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 @@ -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)) { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java index 7c9aa76b..e5543a36 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java @@ -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 = "/"; diff --git a/ecomp-portal-BE-os/pom.xml b/ecomp-portal-BE-os/pom.xml index 7ab6cc4a..4ad50dfd 100644 --- a/ecomp-portal-BE-os/pom.xml +++ b/ecomp-portal-BE-os/pom.xml @@ -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> diff --git a/ecomp-portal-FE-os/pom.xml b/ecomp-portal-FE-os/pom.xml index d46ff56d..735ce79e 100644 --- a/ecomp-portal-FE-os/pom.xml +++ b/ecomp-portal-FE-os/pom.xml @@ -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> diff --git a/ecomp-portal-widget-ms/common-widgets/pom.xml b/ecomp-portal-widget-ms/common-widgets/pom.xml index 9e970efc..2fdc2f82 100644 --- a/ecomp-portal-widget-ms/common-widgets/pom.xml +++ b/ecomp-portal-widget-ms/common-widgets/pom.xml @@ -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> diff --git a/ecomp-portal-widget-ms/pom.xml b/ecomp-portal-widget-ms/pom.xml index d2c5f893..553535d5 100644 --- a/ecomp-portal-widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/pom.xml @@ -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> diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml index 32ca033a..4095388c 100644 --- a/ecomp-portal-widget-ms/widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/widget-ms/pom.xml @@ -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> @@ -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> diff --git a/portal-FE-os/pom.xml b/portal-FE-os/pom.xml index fd497e17..af265d06 100644 --- a/portal-FE-os/pom.xml +++ b/portal-FE-os/pom.xml @@ -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> diff --git a/version.properties b/version.properties index f34034bc..2640898e 100644 --- a/version.properties +++ b/version.properties @@ -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} |