From 5768f2e5a056df6b23f7f8a87529d5ca00063c68 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Mon, 15 May 2023 11:26:46 +0100 Subject: Fix error in userId handling Signed-off-by: MichaelMorris Issue-ID: SDC-4468 Change-Id: Iccc61e54876fea732d82334d0bf21bc485b9e1bb --- .../java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java | 2 +- .../org/openecomp/sdc/be/components/validation/UserValidations.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index 8b18346bdd..de0f791eda 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -375,7 +375,7 @@ public abstract class BaseBusinessLogic { } // verify component last update user is the current user String lastUpdaterUserId = component.getLastUpdaterUserId(); - if (!userId.equals(lastUpdaterUserId)) { + if (!userValidations.isSameUser(userId, lastUpdaterUserId)) { log.debug("Current user is not last updater, last updater userId: {}, current user userId: {}", lastUpdaterUserId, userId); throw new ByActionStatusComponentException(actionStatus); } 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 cf4f84884f..3d148f64c1 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 @@ -82,4 +82,8 @@ public class UserValidations { public User validateUserExists(final User user) { return validateUserExists(user.getUserId()); } + + public boolean isSameUser(final String userId1, final String userId2) { + return validateUserExists(userId1).getUserId().equals(validateUserExists(userId2).getUserId()); + } } -- cgit 1.2.3-korg