diff options
20 files changed, 201 insertions, 97 deletions
diff --git a/LICENSE.txt b/LICENSE.txt index 9532e5b8..43866ac9 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,19 +1,35 @@ -/* - * ============LICENSE_START=========================================================== - * ==================================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * ==================================================================================== - * 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. - * ============LICENSE_END============================================================= - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */
\ No newline at end of file +============LICENSE_START========================================== +ONAP Portal +=================================================================== +Copyright © 2017 AT&T Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the "License"); +you may not use this software 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. + +Unless otherwise specified, all documentation contained herein is licensed +under the Creative Commons License, Attribution 4.0 Intl. (the ¿License¿); +you may not use this documentation except in compliance with the License. +You may obtain a copy of the License at + + https://creativecommons.org/licenses/by/4.0/ + +Unless required by applicable law or agreed to in writing, documentation +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. + +============LICENSE_END============================================ + +ECOMP is a trademark and service mark of AT&T Intellectual Property. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java index 8d6b8e63..14ba94f2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java @@ -36,6 +36,8 @@ import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.logging.aop.EPEELFLoggerAdvice; import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; +import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalapp.portal.utils.PortalConstants; import org.openecomp.portalapp.util.EPUserUtils; @RestController @@ -83,7 +85,7 @@ public class AuditLogController extends EPRestrictedBaseController { * valid */ if (comment != null && !comment.equals("") && !comment.equals("undefined")) - auditLog.setComments(comment); + auditLog.setComments(EcompPortalUtils.truncateString(comment, PortalConstants.AUDIT_LOG_COMMENT_SIZE)); if (affectedAppId != null && !affectedAppId.equals("") && !affectedAppId.equals("undefined")) auditLog.setAffectedRecordId(affectedAppId); long userId = EPUserUtils.getUserId(request); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java index 81a61d57..1c22576d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java @@ -44,6 +44,7 @@ import org.openecomp.portalapp.portal.transport.CommonWidget; import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalapp.portal.utils.PortalConstants; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalsdk.core.domain.AuditLog; import org.openecomp.portalsdk.core.domain.support.CollaborateList; @@ -244,7 +245,7 @@ public class DashboardController extends EPRestrictedBaseController { AuditLog auditLog = new AuditLog(); auditLog.setUserId(user.getId()); auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_SEARCH); - auditLog.setComments(searchString); + auditLog.setComments(EcompPortalUtils.truncateString(searchString, PortalConstants.AUDIT_LOG_COMMENT_SIZE)); MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,EPEELFLoggerAdvice.getCurrentDateTimeUTC()); auditService.logActivity(auditLog, null); MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,EPEELFLoggerAdvice.getCurrentDateTimeUTC()); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java index b98a7cb4..7bb6c45d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java @@ -111,8 +111,11 @@ public class PortalAdminController extends EPRestrictedBaseController { auditLog.setUserId(user.getId()); auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_ADD_PORTAL_ADMIN); auditLog.setAffectedRecordId(userId); - auditService.logActivity(auditLog, null); - + try { + auditService.logActivity(auditLog, null); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "createPortalAdmin: failed for save audit log", e); + } MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); EcompPortalUtils.calculateDateTimeDifferenceForLog( @@ -164,7 +167,7 @@ public class PortalAdminController extends EPRestrictedBaseController { auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_DELETE_PORTAL_ADMIN); auditLog.setAffectedRecordId(sbcid); auditService.logActivity(auditLog, null); - + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); EcompPortalUtils.calculateDateTimeDifferenceForLog( diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java index 7bcd5845..4bb447d1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java @@ -52,6 +52,7 @@ import org.openecomp.portalapp.portal.transport.RoleInAppForUser; import org.openecomp.portalapp.portal.transport.UserApplicationRoles; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalapp.portal.utils.PortalConstants; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalsdk.core.domain.AuditLog; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -213,7 +214,7 @@ public class UserRolesController extends EPRestrictedBaseController { auditLog.setUserId(user.getId()); auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN); auditLog.setAffectedRecordId(newAppsListWithAdminRoles.orgUserId); - auditLog.setComments(newAppRoles.toString()); + auditLog.setComments(EcompPortalUtils.truncateString(newAppRoles.toString(), PortalConstants.AUDIT_LOG_COMMENT_SIZE)); auditService.logActivity(auditLog, null); MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); @@ -344,13 +345,15 @@ public class UserRolesController extends EPRestrictedBaseController { logger.info(EELFLoggerDelegate.applicationLogger, "putAppWithUserRoleStateForUser: succeeded for app {}, user {}", newAppRolesForUser.appId, newAppRolesForUser.orgUserId); + + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); AuditLog auditLog = new AuditLog(); auditLog.setUserId(user.getId()); auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_UPDATE_USER); auditLog.setAffectedRecordId(newAppRolesForUser.orgUserId); - auditLog.setComments(sbUserApps.toString()); - MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + auditLog.setComments(EcompPortalUtils.truncateString(sbUserApps.toString(), PortalConstants.AUDIT_LOG_COMMENT_SIZE)); auditService.logActivity(auditLog, null); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); EcompPortalUtils.calculateDateTimeDifferenceForLog( MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java index 62519530..eaac6edf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java @@ -186,7 +186,16 @@ public enum EPAppMessagesEnum { InternalUnexpectedFatal(EPErrorCodesEnum.INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, "ERR999F", "Unexpected error", "Details: {0}.", "Please check logs for more information."), - + + ExternalAuthAccessConnectionError(EPErrorCodesEnum.EXTERNALAUTHACCESS_CONNECTIONERROR, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR220E", "AAF Connection problem", "Details: {0}.", "Please check logs for more information."), + + ExternalAuthAccessAuthenticationError(EPErrorCodesEnum.EXTERNALAUTHACCESS_AUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR120E", "AAF authentication problem", "Details: {0}.", "Please check logs for more information."), + + ExternalAuthAccessGeneralError(EPErrorCodesEnum.EXTERNALAUTHACCESS_GENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR520E", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + ; ErrorTypeEnum eType; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java index 99a6c34a..ca4cdec1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java @@ -82,6 +82,10 @@ public enum EPErrorCodesEnum implements EELFResolvableErrorEnum { INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, + + EXTERNALAUTHACCESS_CONNECTIONERROR, + EXTERNALAUTHACCESS_AUTHENTICATIONERROR, + EXTERNALAUTHACCESS_GENERALERROR, ; /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java index ebda67e6..2c6b3300 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java @@ -29,6 +29,7 @@ import org.openecomp.portalsdk.core.logging.format.ErrorSeverityEnum; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.web.support.UserUtils; import org.slf4j.MDC; +import org.springframework.http.HttpStatus; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; @@ -282,4 +283,15 @@ public class EPLogUtil { return auditLogStoreAnalyticsMsg.toString(); } + public static void logExternalAuthAccessAlarm(EELFLoggerDelegate logger, HttpStatus res) { + if (res.equals(HttpStatus.UNAUTHORIZED) || res.equals(HttpStatus.FORBIDDEN)) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.ExternalAuthAccessAuthenticationError); + } else if (res.equals(HttpStatus.NOT_FOUND) || res.equals(HttpStatus.NOT_ACCEPTABLE) + || res.equals(HttpStatus.CONFLICT) || res.equals(HttpStatus.BAD_REQUEST)) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.ExternalAuthAccessConnectionError); + } else if (!res.equals(HttpStatus.ACCEPTED) && !res.equals(HttpStatus.OK)) { + EPLogUtil.logEcompError(logger, EPAppMessagesEnum.ExternalAuthAccessGeneralError); + } + } + } 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 491743f5..cddd1c29 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 @@ -24,6 +24,7 @@ import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.domain.EPUserApp; import org.openecomp.portalapp.portal.domain.ExternalRoleDetails; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; import org.openecomp.portalapp.portal.transport.BulkUploadRoleFunction; import org.openecomp.portalapp.portal.transport.BulkUploadUserRoles; import org.openecomp.portalapp.portal.transport.CentralApp; @@ -52,6 +53,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import com.fasterxml.jackson.core.JsonProcessingException; @@ -797,6 +799,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic + app.getNameSpace() + "." + checkType + "/" + roleFuncName + "/*", HttpMethod.GET, getSinglePermEntity, String.class); if (getResponse.getStatusCode().value() != 200) { + EPLogUtil.logExternalAuthAccessAlarm(logger, getResponse.getStatusCode()); throw new Exception(getResponse.getBody()); } logger.debug(EELFLoggerDelegate.debugLogger, "Connected to External Access system"); @@ -814,8 +817,11 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm", HttpMethod.POST, entity, String.class); logger.debug(EELFLoggerDelegate.debugLogger, "Connected to External Access system"); + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to add function in external central auth system", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "Failed to add fucntion in external central auth system", e); + logger.error(EELFLoggerDelegate.errorLogger, "Failed to add function in external central auth system", e); } } else { try{ @@ -830,8 +836,11 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm", HttpMethod.PUT, entity, String.class); logger.debug(EELFLoggerDelegate.debugLogger, "Connected to External Access system"); - } catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "Failed to add fucntion in external central auth system", e); + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to add function in external central auth system", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Failed to add function in external central auth system", e); } } @@ -875,6 +884,9 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic template.exchange( SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "perm?force=true", HttpMethod.DELETE, entity, String.class); + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to delete functions in External System", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); } catch(Exception e){ if(e.getMessage().equalsIgnoreCase("404 Not Found")){ logger.debug(EELFLoggerDelegate.debugLogger, " It seems like function is already deleted in external central auth system but exists in local DB", e.getMessage()); @@ -932,6 +944,7 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic + epRoleList.get(0).getName().replaceAll(" ", "_") + "\"}"; deleteResponse = deleteRoleInExternalSystem(deleteRoleKey); if (deleteResponse.getStatusCode().value() != 200) { + EPLogUtil.logExternalAuthAccessAlarm(logger, deleteResponse.getStatusCode()); throw new Exception("Failed to delete role in external access system!"); } logger.debug(EELFLoggerDelegate.debugLogger, "about to commit the transaction"); @@ -1038,7 +1051,10 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic transaction.commit(); logger.debug(EELFLoggerDelegate.debugLogger, "committed the transaction"); result = true; - } catch (Exception e) { + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to deleteRoleDependeciesRecord", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + }catch (Exception e) { EcompPortalUtils.rollbackTransaction(transaction, "deleteDependcyRoleRecord rollback, exception = " + e); logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); @@ -1174,7 +1190,10 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic addRoleFunctionInExternalSystem(cenRoleFunc, app); functionsAdded++; } - } catch (Exception e) { + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - bulkUploadFunctions failed", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + }catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e.getMessage(), e); } return functionsAdded; @@ -1212,7 +1231,10 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic template.exchange( SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "role", HttpMethod.POST, entity, String.class); - } catch(Exception e){ + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addRoleInExternalSystem", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + }catch(Exception e){ if (e.getMessage().equalsIgnoreCase("409 Conflict")) { logger.error(EELFLoggerDelegate.errorLogger, "Role already exits but does not break functionality"); } else { @@ -1238,6 +1260,9 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic } } } + } catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to bulkUploadRolesFunctions", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRolesFunctions failed", e); } @@ -1548,6 +1573,9 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic } logger.debug(EELFLoggerDelegate.debugLogger, "Finished SyncApplicationRolesWithEcompDB"); + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "Failed to SyncApplicationRolesWithEcompDB", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); }catch(Exception e){ logger.error(EELFLoggerDelegate.errorLogger, "Failed to SyncApplicationRolesWithEcompDB", e); } @@ -1597,7 +1625,10 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic template.exchange( SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL) + "userRole", HttpMethod.POST, entity, String.class); - } catch (Exception e) { + }catch(HttpClientErrorException e){ + logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to addUserRoleInExternalSystem", e); + EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); + }catch (Exception e) { if (e.getMessage().equalsIgnoreCase("409 Conflict")) { logger.error(EELFLoggerDelegate.errorLogger, "UserRole already exits but does not break functionality"); } else { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java index 0284452a..f29f9d91 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java @@ -414,4 +414,14 @@ public class EcompPortalUtils { return result; } + public static String truncateString(String originString, int size){ + if(originString.length()>=size){ + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(originString); + stringBuilder.setLength(size); + stringBuilder.append("..."); + return stringBuilder.toString(); + } + return originString; + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java index 57bb543f..56bb542a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java @@ -27,4 +27,5 @@ public interface PortalConstants { public static final Long SYS_ADMIN_ROLE_ID = 1L; public static final String ADMIN_ROLE = "Account Administrator"; public static final String PORTAL_ADMIN_ROLE = "System Administrator"; + public static final Integer AUDIT_LOG_COMMENT_SIZE = 990; } diff --git a/ecomp-portal-FE-common/README.md b/ecomp-portal-FE-common/README.md index c4ac1e87..e69e32aa 100644 --- a/ecomp-portal-FE-common/README.md +++ b/ecomp-portal-FE-common/README.md @@ -8,8 +8,6 @@ of the ECOMP Portal web application. Those specific versions are built using separate Maven projects that copy in ("overlay") the contents of this project at package time. -## Static files +Release Notes -Static files should be entered into the ecomp-portal-FE-common/home directory, -whereby home = the webserver html root directory. The files and directories -will be copied exactly as they are placed. + - PORTAL-86 remove "home" subdirectory with static files diff --git a/ecomp-portal-FE-common/client/app/views/role/role.html b/ecomp-portal-FE-common/client/app/views/role/role.html index 9febc978..63073aeb 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role.html +++ b/ecomp-portal-FE-common/client/app/views/role/role.html @@ -94,30 +94,7 @@ </div> <a id="manage-role" href="roleFunctions">Manage Role Functions</a><br><br> - - <div id="page-title-child" class="pageTitle"> - <label>Child Roles</label> - <a id="add-child-role" ng-click="addNewChildRoleModalPopup();" ng-style="{'cursor':'pointer'}" class="icon-primary-accordion-plus" size="small"></a> - </div> - - <div b2b-table table-data="role.childRoles" ng-hide="users.isLoadingTable" search-string="users.searchString" class="b2b-table-div"> - <table> - <thead b2b-table-row type="header"> - <tr > - <th id="table-header-name" b2b-table-header key="firstName" sortable="true" >Name</th> - <th id="table-header-remove" b2b-table-header key="lastName" sortable="true" >Remove</th> - </tr> - </thead> - <tbody b2b-table-row type="body" row-repeat="role in role.childRoles"> - <tr > - <td id="role-function-{{role.name}}" b2b-table-body id="rowheader_t1_{{$index}}" headers="col1" ng-bind="role.name"></td> - <td b2b-table-body headers="rowheader_t1_{{$index}} col4" id="{{$index}}-button-remove-role" > - <div ng-click="removeChildRole(role);" ><a href="javascript:void(0)" class="icon-misc-trash"></a></div> - </td> - </tr> - </tbody> - </table> - </div> + </div> </div> </div> diff --git a/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.controller.js b/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.controller.js index 81384ad0..366fb215 100644 --- a/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.controller.js +++ b/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.controller.js @@ -187,7 +187,7 @@ // // pre-processing if (!($scope.isEditMode)) { var validation = false; - if ($scope.isDateValid($scope.newNotifModel.startTime) && $scope.isDateValid($scope.newNotifModel.endTime) && $scope.newNotifModel.msgHeader != '' && $scope.newNotifModel.msgDescription != '' && ($scope.newNotifModel.startTime < $scope.newNotifModel.endTime)) { + if ($scope.isStartDateValidFromToday($scope.newNotifModel.startTime)&&$scope.isStartDateValidFromToday($scope.newNotifModel.endTime)&&$scope.isDateValid($scope.newNotifModel.startTime) && $scope.isDateValid($scope.newNotifModel.endTime) && $scope.newNotifModel.msgHeader != '' && $scope.newNotifModel.msgDescription != '' && ($scope.newNotifModel.startTime < $scope.newNotifModel.endTime)) { validation = true; if ($scope.newNotifModel.isForAllRoles == 'N') { validation = $scope.checkTreeSelect(); @@ -212,6 +212,8 @@ $scope.newNotifModel.endTime = $filter('date')($scope.endTime, 'medium'); } } + + /*To validate the manual entry of date in MM/DD/YYYY Format*/ $scope.isDateValid = function(time) { if (time == undefined) { @@ -228,10 +230,39 @@ var year = startDateformat[2]; if (year.length != 4) return false; var composedDate = new Date(year, month, day); - return composedDate.getDate() == day && - composedDate.getMonth() == month && - composedDate.getFullYear() == year; - + return composedDate.getDate() == day && + composedDate.getMonth() == month && + composedDate.getFullYear() == year; + }; + + /*The manual and drop down calendar should be consistent. + Start date must be greater than or equal to current date.The end dates are not allowed after the 3 months from current dates*/ + + $scope.isStartDateValidFromToday = function (time) { + if(time == undefined){ + return false; + } + if(typeof time == 'object'){ + return true; + } + var startDateformat =time.split('/'); + if (startDateformat.length != 3) return true; + var day = startDateformat[1]; + var month = startDateformat[0]; + month= parseInt(month)-1; + var year = startDateformat[2]; + if(year.length!=4) return true; + var composedDate = new Date(year, month, day); + /* As end dates are not allowed after the 3 months from current dates*/ + var x = 3; //or whatever offset + var CurrentDate = new Date(); + /*If composed date is less than the current date,error message should display*/ + if(composedDate<CurrentDate) + return false; + CurrentDate.setMonth(CurrentDate.getMonth() + x); + if(composedDate>CurrentDate) + return false; + return true; }; diff --git a/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.less b/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.less index 79c2bae2..17bbdab8 100644 --- a/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.less +++ b/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.less @@ -169,3 +169,16 @@ right: 10px; top: 8px; } + +.date-validation{ + top:185px; + color: #cf2a2a; + font-size: 10px; + position:absolute; +} +.endDate-validation{ + top:270px; + color: #cf2a2a; + font-size: 10px; + position:absolute; +}
\ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.page.html b/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.page.html index 57433c1c..5d1698e5 100644 --- a/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.page.html +++ b/ecomp-portal-FE-common/client/app/views/user-notifications-admin/user.notifications.modal.page.html @@ -131,10 +131,14 @@ ng-model="newNotifModel.startTime" b2b-datepicker min="minDate" max="maxDate" required /> </div> - <div id="user-startdate-required" ng-show="!isDateValid(newNotifModel.startTime)"> - <small class="mandatory-categories">Please enter valid date in MM/DD/YYYY format!</small> + <div style="{{( isEditMode )? 'opacity : 0; pointer-events: none;':' '}}"> + <div id="user-startdate-required" ng-show="!isDateValid(newNotifModel.startTime)"> + <small class="mandatory-categories">Please enter valid date in MM/DD/YYYY format!</small> + </div> + <div id="user-startdate-required" ng-show="!isStartDateValidFromToday(newNotifModel.startTime)"> + <small class="date-validation">Date should be greater than or equal to current date!</small> + </div> </div> - </div> <div ng-show="!isEditMode" ng-init="formatStartDate()"></div> </div> @@ -142,18 +146,23 @@ <div id="add-user-notif-enddate" class="add-widget-field" style="padding-bottom: 12px; width: 301px !important; {{( isEditMode )? 'opacity : 0.6; pointer-events: none;':' '}}"> <div id="user-notification-enddate-label" class="user-notif-label"> - <span runat="server" ID="required" class="notifcation-label-user-requiredId">*</span> End Date (Local Time) + <span runat="server" ID="required" class="notifcation-label-user-requiredId">*</span> EndDate (Local Time) </div> <div class="datepicker-container"> <input class="notif-input-calendar" type="text" id="datepicker-end" ng-model="newNotifModel.endTime" b2b-datepicker min="minDate" max="maxDate" required /> </div> - <div id="user-endDate-required" ng-show="!isDateValid(newNotifModel.endTime)"> + <div style="{{( isEditMode )? 'opacity : 0; pointer-events: none;':' '}}"> + <div id="user-endDate-required" ng-show="!isDateValid(newNotifModel.endTime)"> <small class="mandatory-categories">Please enter valid date in MM/DD/YYYY format!</small> </div> - <div id="user-enddate-error" ng-show="newNotifModel.endTime&&newNotifModel.startTime&&newNotifModel.startTime.getTime()>=newNotifModel.endTime.getTime()" class="user-enddate-error-txt"> - <small class="mandatory-categories">End Date must be greater than start Date</small> + <div id="user-startdate-required" ng-show="!isStartDateValidFromToday(newNotifModel.endTime)"> + <small class="endDate-validation">Date should be greater than or equal to current date!</small> + </div> + <div id="user-enddate-error" ng-show="newNotifModel.endTime&&newNotifModel.startTime&&newNotifModel.startTime.getTime()>=newNotifModel.endTime.getTime()" class="user-enddate-error-txt"> + <small class="mandatory-categories">End Date must be greater than start Date</small> + </div> </div> <div ng-show="!isEditMode" ng-init="formatEndDate()" ></div> </div> @@ -181,7 +190,7 @@ ng-model="newNotifModel.msgDescription" name="content"> </textarea> <div id="user-notif-message-required" ng-show="newNotifModel.msgDescription.length ==0 "> - <small class="mandatory-categories">Message is Required</small> + <small class="mandatory-categories">Message is Required</small> </div> </div> diff --git a/ecomp-portal-FE-common/home/ecompportal/applicationsHome b/ecomp-portal-FE-common/home/ecompportal/applicationsHome deleted file mode 100644 index e2a981e4..00000000 --- a/ecomp-portal-FE-common/home/ecompportal/applicationsHome +++ /dev/null @@ -1,9 +0,0 @@ -<html> -<body> -ECOMP Portal has moved to this new location <a href="https://www.e-access.att.com/ecomp_portal/"> https://www.e-access.att.com/ecomp_portal/ </a> -<p> -Please update your bookmarks. -</p> -</body> -</html> - diff --git a/ecomp-portal-FE-common/home/ecompportal/login.htm b/ecomp-portal-FE-common/home/ecompportal/login.htm deleted file mode 100644 index e2a981e4..00000000 --- a/ecomp-portal-FE-common/home/ecompportal/login.htm +++ /dev/null @@ -1,9 +0,0 @@ -<html> -<body> -ECOMP Portal has moved to this new location <a href="https://www.e-access.att.com/ecomp_portal/"> https://www.e-access.att.com/ecomp_portal/ </a> -<p> -Please update your bookmarks. -</p> -</body> -</html> - diff --git a/ecomp-portal-FE-common/home/index.html b/ecomp-portal-FE-common/home/index.html deleted file mode 100644 index 5e433099..00000000 --- a/ecomp-portal-FE-common/home/index.html +++ /dev/null @@ -1,3 +0,0 @@ -<script> -window.location.href = "ecompui/login.htm" -</script> diff --git a/ecomp-portal-FE-os/client/src/app.less b/ecomp-portal-FE-os/client/src/app.less index 6e7df2a4..bf7a96e5 100644 --- a/ecomp-portal-FE-os/client/src/app.less +++ b/ecomp-portal-FE-os/client/src/app.less @@ -92,4 +92,9 @@ body { z-index: 100; display: none; opacity: 0; +} + +.errorContent p{ + font-size: 28px; + margin-left: 120px; }
\ No newline at end of file |