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..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 @@ -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,8 +1026,8 @@ public class UserServiceImpl implements UserService { if (contactInfoEntity != null){ userId = contactInfoEntity.getUserId(); } - 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();