summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-common')
-rw-r--r--ecomp-portal-BE-common/pom.xml22
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java18
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java8
3 files changed, 30 insertions, 18 deletions
diff --git a/ecomp-portal-BE-common/pom.xml b/ecomp-portal-BE-common/pom.xml
index af828cf2..79968b3a 100644
--- a/ecomp-portal-BE-common/pom.xml
+++ b/ecomp-portal-BE-common/pom.xml
@@ -12,27 +12,31 @@
<hibernate.version>4.3.11.Final</hibernate.version>
<eelf.version>1.0.0</eelf.version>
<fasterxml.version>2.7.4</fasterxml.version>
- <epsdk.version>1.3.0-SNAPSHOT</epsdk.version>
+ <epsdk.version>1.3.0</epsdk.version>
<encoding>UTF-8</encoding>
<!-- Tests usually require some setup that maven cannot do, so skip. -->
<skipTests>true</skipTests>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
+ <stagingNexusPath>content/repositories/staging/</stagingNexusPath>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
</properties>
<repositories>
<repository>
- <!-- Releases repository has ECOMP release artifacts -->
- <id>ecomp-releases</id>
- <name>OpenECOMP - Release Repository</name>
- <url>${nexusproxy}/${releaseNexusPath}</url>
+ <id>onap-releases</id>
+ <name>ONAP - Release Repository</name>
+ <url>${nexusproxy}/${releaseNexusPath}</url>
</repository>
<repository>
- <!-- Snapshots repository has ECOMP snapshot artifacts -->
- <id>ecomp-snapshots</id>
- <name>OpenECOMP - Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
+ <id>onap-staging</id>
+ <name>ONAP - Staging Repository</name>
+ <url>${nexusproxy}/${stagingNexusPath}</url>
+ </repository>
+ <repository>
+ <id>onap-snapshots</id>
+ <name>ONAP - Snapshot Repository</name>
+ <url>${nexusproxy}/${snapshotNexusPath}</url>
</repository>
</repositories>
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
index 17d9ceb0..491743f5 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
@@ -444,15 +444,15 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
List <EPRole> getRoleCreated = null;
if (!app.getId().equals(PortalConstants.PORTAL_APP_ID)) {
List<EPRole> roleCreated = dataAccessService.getList(EPRole.class,
- " where role_name = '" + addRoleInDB.getName() +"'", null, null);
+ " where role_name = '" + addRoleInDB.getName() +"' and app_id = "+ app.getId(), null, null);
EPRole epUpdateRole = roleCreated.get(0);
epUpdateRole.setAppRoleId(epUpdateRole.getId());
dataAccessService.saveDomainObject(epUpdateRole, null);
getRoleCreated = dataAccessService.getList(EPRole.class,
- " where role_name = '" + addRoleInDB.getName() +"'", null, null);
+ " where role_name = '" + addRoleInDB.getName() +"' and app_id = "+ app.getId() , null, null);
} else{
getRoleCreated = dataAccessService.getList(EPRole.class,
- " where role_name = '" + addRoleInDB.getName() +"'", null, null);
+ " where role_name = '" + addRoleInDB.getName() +"' and app_id is null", null, null);
}
// Add role in External Access system
boolean response = addNewRoleInExternalSystem(getRoleCreated, app);
@@ -611,7 +611,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
if (((epApp.getId().equals(app.getId()))
&& (!userApp.getRole().getId().equals(PortalConstants.ACCOUNT_ADMIN_ROLE_ID)))
|| ((epApp.getId().equals(PortalConstants.PORTAL_APP_ID))
- && (globalRole.startsWith("global_")))) {
+ && (globalRole.toLowerCase().startsWith("global_")))) {
CentralUserApp cua = new CentralUserApp();
cua.setUserId(null);
CentralApp cenApp = new CentralApp(1L, epApp.getCreated(), epApp.getModified(),
@@ -633,7 +633,13 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
roleFunc.getCode(), roleFunc.getName(), null, null);
roleFunctionSet.add(cenRoleFunc);
}
- CentralRole cenRole = new CentralRole(userApp.getRole().getAppRoleId(),
+ Long userRoleId = null;
+ if(globalRole.toLowerCase().startsWith("global_") && epApp.getId().equals(PortalConstants.PORTAL_APP_ID)){
+ userRoleId = userApp.getRole().getId();
+ } else{
+ userRoleId = userApp.getRole().getAppRoleId();
+ }
+ CentralRole cenRole = new CentralRole(userRoleId,
userApp.getRole().getCreated(), userApp.getRole().getModified(),
userApp.getRole().getCreatedId(), userApp.getRole().getModifiedId(),
userApp.getRole().getRowNum(), userApp.getRole().getName(),
@@ -750,7 +756,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunction failed", e);
- throw new Exception("getRoleFunction failed");
+ throw new Exception("getRoleFunction failed", e);
}
return getRoleFuncList.get(0);
}
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java
index 1315c5e9..7e7a55a1 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java
@@ -771,9 +771,10 @@ public class UserRolesCommonServiceImpl {
* @param mapper
* @param searchService
* @param applicationsRestClientService
+ * @return
* @throws Exception
*/
- private void addRemoteUser(List<RoleInAppForUser> roleInAppForUserList, String userId, EPApp app, ObjectMapper mapper, SearchService searchService, ApplicationsRestClientService applicationsRestClientService) throws Exception{
+ private EPUser addRemoteUser(List<RoleInAppForUser> roleInAppForUserList, String userId, EPApp app, ObjectMapper mapper, SearchService searchService, ApplicationsRestClientService applicationsRestClientService) throws Exception{
EPUser addRemoteUser = null;
if (remoteUserShouldBeCreated(roleInAppForUserList)) {
@@ -787,6 +788,7 @@ public class UserRolesCommonServiceImpl {
// return null;
}
}
+ return addRemoteUser;
}
/**
@@ -882,7 +884,7 @@ public class UserRolesCommonServiceImpl {
remoteAppUser = checkIfRemoteUserExits(userId, app, applicationsRestClientService);
if (remoteAppUser == null) {
- addRemoteUser(roleInAppForUserList, userId, app, mapper, searchService, applicationsRestClientService);
+ remoteAppUser = addRemoteUser(roleInAppForUserList, userId, app, mapper, searchService, applicationsRestClientService);
}
if (remoteAppUser != null) {
Set<EcompRole> userRolesInRemoteApp = postUsersRolesToRemoteApp(roleInAppForUserList, mapper,
@@ -1336,7 +1338,7 @@ public class UserRolesCommonServiceImpl {
EPUser remoteAppUser = null;
remoteAppUser = checkIfRemoteUserExits(userId.getOrgUserId(), app, applicationsRestClientService);
if (remoteAppUser == null) {
- addRemoteUser(roleInAppForUserList, userId.getOrgUserId(), app, mapper, searchService, applicationsRestClientService);
+ remoteAppUser = addRemoteUser(roleInAppForUserList, userId.getOrgUserId(), app, mapper, searchService, applicationsRestClientService);
reqMessage = "Saved Successfully";
}
if (remoteAppUser != null) {