diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java index 18fe51d3d4..dd65627738 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java @@ -1,8 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 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========================================================= + * Modifications copyright (c) 2019 Nokia + * ================================================================================ + */ package org.openecomp.sdc.be.components.validation; import fj.data.Either; import org.apache.commons.lang3.StringUtils; -import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; +import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -38,7 +59,7 @@ public class UserValidations { } log.debug("User is not listed. userId {}", userId); BeEcompErrorManager.getInstance().logBeUserMissingError(ecompErrorContext, userId); - throw new ComponentException(status); + throw new ByActionStatusComponentException(status); } return eitherCreator.left().value(); } @@ -48,7 +69,7 @@ public class UserValidations { if (roles != null) { if (!roles.contains(userRole)) { log.debug("user is not in appropriate role to perform action"); - throw new ComponentException(ActionStatus.RESTRICTED_OPERATION); + throw new ByActionStatusComponentException(ActionStatus.RESTRICTED_OPERATION); } } } @@ -74,7 +95,7 @@ public class UserValidations { if (StringUtils.isEmpty(userId)) { log.debug("User header is missing "); BeEcompErrorManager.getInstance().logBeUserMissingError(ecompErrorContext, user.getUserId()); - throw new ComponentException(ActionStatus.MISSING_INFORMATION); + throw new ByActionStatusComponentException(ActionStatus.MISSING_INFORMATION); } return user; } |