diff options
10 files changed, 158 insertions, 66 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) { diff --git a/ecomp-portal-BE-os/pom.xml b/ecomp-portal-BE-os/pom.xml index 22b13749..00e77c20 100644 --- a/ecomp-portal-BE-os/pom.xml +++ b/ecomp-portal-BE-os/pom.xml @@ -7,63 +7,50 @@ <version>1.1</version> <properties> + <portal.version>1.3.0-SNAPSHOT</portal.version> + <epsdk.version>1.3.0</epsdk.version> + <!-- Jenkins SHOULD invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} --> + <build.number>0</build.number> <springframework.version>4.2.0.RELEASE</springframework.version> <hibernate.version>4.3.11.Final</hibernate.version> <eelf.version>1.0.0</eelf.version> - <epsdk.version>1.3.0-SNAPSHOT</epsdk.version> - <portal.version>1.3.0-SNAPSHOT</portal.version> <encoding>UTF-8</encoding> - <!-- If Skiptests is false use mvn clean jacoco:prepare-agent install jacoco:report - to run jacoco report --> + <!-- If skipTests is false use this command to generate the report: + mvn clean jacoco:prepare-agent install jacoco:report --> <skipTests>false</skipTests> <skipCoverage>true</skipCoverage> - <!-- Jenkins SHOULD invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} --> - <build.number>0</build.number> + <jacoco.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec</jacoco.data.file> + <sonar-jacoco-listeners.version>3.8</sonar-jacoco-listeners.version> + <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> + <sonar.jacoco.reportPath>${project.build.directory}/code-coverage/jacoco.exec</sonar.jacoco.reportPath> + <sonar.jacoco.itReportPath>${project.build.directory}/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath> + <!-- Note: This list should match jacoco-maven-plugin's exclusion list below --> <sonar.exclusions>**.js</sonar.exclusions> <nexusproxy>https://nexus.onap.org</nexusproxy> <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath> + <stagingNexusPath>content/repositories/staging/</stagingNexusPath> <releaseNexusPath>content/repositories/releases/</releaseNexusPath> </properties> - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> - <configuration> - <failOnError>false</failOnError> - <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> - <docletArtifact> - <groupId>org.umlgraph</groupId> - <artifactId>umlgraph</artifactId> - <version>5.6</version> - </docletArtifact> - <additionalparam>-views</additionalparam> - <useStandardDocletOptions>true</useStandardDocletOptions> - </configuration> - </plugin> - - </plugins> - </reporting> - <distributionManagement> - <site> - <id>ecomp-site</id> - <url>dav:${nexusproxy}/content/sites/site/org/onap/portal/${project.version}</url> - </site> - </distributionManagement> <repositories> <repository> <id>onap-releases</id> + <name>ONAP - Release Repository</name> <url>${nexusproxy}/${releaseNexusPath}</url> </repository> <repository> + <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> <repository> <id>onap-public</id> - <url>https://nexus.onap.org/content/groups/public</url> + <url>${nexusproxy}/content/groups/public</url> </repository> </repositories> @@ -98,28 +85,25 @@ <target>1.8</target> </configuration> </plugin> - <plugin> + <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.5.201505241946</version> <executions> - <!-- Prepares the property pointing to the JaCoCo runtime agent which - is passed as VM argument when Maven the Surefire plugin is executed. --> + is passed as VM argument when Maven the Surefire plugin is executed. --> <execution> <id>pre-unit-test</id> <goals> <goal>prepare-agent</goal> </goals> <configuration> - <!-- Sets the path to the file which contains the execution data. --> - <destFile>${basedir}/target/coverage-reports/jacoco-ut.exec</destFile> - <!-- Sets the name of the property containing the settings for JaCoCo - runtime agent. --> + <!-- path to the file which contains the execution data. --> + <destFile>${jacoco.data.file}</destFile> + <!-- name of the property containing the settings for JaCoCo runtime agent. --> <propertyName>surefireArgLine</propertyName> <skip>${skipCoverage}</skip> </configuration> - </execution> <!-- Ensures that the code coverage report for unit tests is created after unit tests have been run. --> @@ -130,12 +114,11 @@ <goal>report</goal> </goals> <configuration> - <!-- Sets the path to the file which contains the execution data. --> - <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile> - <!-- Sets the output directory for the code coverage report. --> + <!-- path to the file which contains the execution data. --> + <dataFile>${jacoco.data.file}</dataFile> + <!-- output directory for the code coverage report. --> <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> <skip>${skipCoverage}</skip> - </configuration> </execution> <!-- Will see build errors while running the test cases because of dual @@ -800,4 +783,34 @@ </dependency> </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.10.4</version> + <configuration> + <failOnError>false</failOnError> + <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> + <docletArtifact> + <groupId>org.umlgraph</groupId> + <artifactId>umlgraph</artifactId> + <version>5.6</version> + </docletArtifact> + <additionalparam>-views</additionalparam> + <useStandardDocletOptions>true</useStandardDocletOptions> + </configuration> + </plugin> + + </plugins> + </reporting> + + <distributionManagement> + <site> + <id>ecomp-site</id> + <url>dav:${nexusproxy}/content/sites/site/org/onap/portal/${project.version}</url> + </site> + </distributionManagement> + </project> diff --git a/ecomp-portal-FE-common/client/app/router.js b/ecomp-portal-FE-common/client/app/router.js index 190ed579..7a3d3a71 100644 --- a/ecomp-portal-FE-common/client/app/router.js +++ b/ecomp-portal-FE-common/client/app/router.js @@ -241,7 +241,7 @@ angular.module('ecompApp') url: '/error404', views: { 'content@': { - templateUrl: 'app/views/errors/error.404.tpl.html', + templateUrl: 'app/views/errors/error.tpl.html', controller: 'ErrorCtrl', controllerAs: 'error' } diff --git a/ecomp-portal-FE-common/client/app/views/errors/error.controller.js b/ecomp-portal-FE-common/client/app/views/errors/error.controller.js new file mode 100644 index 00000000..5f4f410d --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/errors/error.controller.js @@ -0,0 +1,20 @@ +'use strict'; +(function () { + class ErrorCtrl { + constructor($log, $scope,$state) { + $scope.errorState = $state.current.name; + if($scope.errorState=='root.error404'){ + $scope.errorTitle="Page Not Found"; + $scope.errorMsg="The page you are looking for cannot be found"; + }else if($scope.errorState=='noUserError'){ + $scope.errorTitle="Authorization denied"; + $scope.errorMsg= "Please Contact Your Administrator for the page access"; + }else { + $scope.errorTitle="Something went wrong"; + $scope.errorMsg= "Please go back to the previous page"; + } + } + } + ErrorCtrl.$inject = ['$log','$scope','$state']; + angular.module('ecompApp').controller('ErrorCtrl', ErrorCtrl); +})();
\ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/errors/error.tpl.html b/ecomp-portal-FE-common/client/app/views/errors/error.tpl.html new file mode 100644 index 00000000..44b43ce4 --- /dev/null +++ b/ecomp-portal-FE-common/client/app/views/errors/error.tpl.html @@ -0,0 +1,31 @@ +<!-- + ================================================================================ + ECOMP Portal + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<div class="w-ecomp-admins-page-main"> + <div id="page-content"> + <div id="title" class="w-ecomp-main-view-title"> + <h1 class="heading-page">{{errorTitle}}</h1> + </div> + <div class="errorContent"> + <p>{{errorMsg}}</p> + </div> + + </div> + +</div> diff --git a/ecomp-portal-FE-os/pom.xml b/ecomp-portal-FE-os/pom.xml index aa853498..ae3921ad 100644 --- a/ecomp-portal-FE-os/pom.xml +++ b/ecomp-portal-FE-os/pom.xml @@ -22,8 +22,17 @@ <directory>${basedir}/client/app</directory> </fileset> <fileset> + <directory>${basedir}/dist</directory> + </fileset> + <fileset> <directory>${basedir}/.tmp</directory> </fileset> + <fileset> + <directory>${basedir}/node</directory> + </fileset> + <fileset> + <directory>${basedir}/node_modules</directory> + </fileset> </filesets> </configuration> </plugin> diff --git a/ecomp-portal-widget-ms/common-widgets/pom.xml b/ecomp-portal-widget-ms/common-widgets/pom.xml index a71c5ac5..6a6d54bd 100644 --- a/ecomp-portal-widget-ms/common-widgets/pom.xml +++ b/ecomp-portal-widget-ms/common-widgets/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.openecomp.portal</groupId> - <artifactId>widget-ms-widgets-os</artifactId> + <artifactId>common-widgets</artifactId> <version>1.3.0-SNAPSHOT</version> <packaging>pom</packaging> diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml index dcab5721..b421ebd5 100644 --- a/ecomp-portal-widget-ms/widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/widget-ms/pom.xml @@ -25,6 +25,13 @@ </properties> <dependencies> + <!-- This pom pulls in artifacts --> + <dependency> + <groupId>org.openecomp.portal</groupId> + <artifactId>common-widgets</artifactId> + <version>${project.version}</version> + <type>pom</type> + </dependency> <dependency> <!-- Setup Spring Data JPA Repository support --> <groupId>org.springframework.boot</groupId> |