summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2023-05-15 11:26:46 +0100
committerMichaelMorris <michael.morris@est.tech>2023-05-15 22:40:08 +0100
commit5768f2e5a056df6b23f7f8a87529d5ca00063c68 (patch)
tree20b5679279a5987913f91f69ad0fd6b0885ca065 /catalog-be/src/main
parentf21f1b1b1f474e311409693f5a49780101cb5bc5 (diff)
Fix error in userId handling
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4468 Change-Id: Iccc61e54876fea732d82334d0bf21bc485b9e1bb
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java4
2 files changed, 5 insertions, 1 deletions
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());
+ }
}