From d2d889f0113cef1003bc92976c04c583a6600787 Mon Sep 17 00:00:00 2001 From: amentis Date: Fri, 21 Jun 2024 16:27:29 +0300 Subject: [PATCH 1/2] small fix --- .../main/java/org/opencdmp/service/user/UserServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java index 548909b83..94f88743e 100644 --- a/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java @@ -1011,6 +1011,9 @@ public class UserServiceImpl implements UserService { } this.addUserToTenant(tenantEntity, userInviteToTenantRequest); + action.setStatus(ActionConfirmationStatus.Accepted); + this.entityManager.merge(action); + } private void addUserToTenant(TenantEntity tenant, UserInviteToTenantRequestEntity userInviteToTenantRequest) throws InvalidApplicationException { @@ -1023,7 +1026,7 @@ public class UserServiceImpl implements UserService { if (contactInfoEntity != null){ userId = contactInfoEntity.getUserId(); } - + if (userId != this.userScope.getUserId()) throw new MyApplicationException("Cannot confirm invitation for different User"); if (userId != null) { UserCredentialEntity userCredential = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(userId).first(); if (userCredential == null) throw new MyApplicationException(); From 18a2818f4fd2d1c47d4aa9e052fa346beecfd5d2 Mon Sep 17 00:00:00 2001 From: amentis Date: Fri, 21 Jun 2024 16:40:41 +0300 Subject: [PATCH 2/2] small fix --- .../main/java/org/opencdmp/service/user/UserServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java index 94f88743e..45082de90 100644 --- a/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java @@ -1026,8 +1026,8 @@ public class UserServiceImpl implements UserService { if (contactInfoEntity != null){ userId = contactInfoEntity.getUserId(); } - if (userId != this.userScope.getUserId()) throw new MyApplicationException("Cannot confirm invitation for different User"); if (userId != null) { + if (!userId.equals(this.userScope.getUserId())) throw new MyApplicationException("Cannot confirm invitation for different User"); UserCredentialEntity userCredential = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(userId).first(); if (userCredential == null) throw new MyApplicationException();