small fixes for confirm invite user

This commit is contained in:
amentis 2024-06-21 15:04:45 +03:00
parent 17256dff39
commit 78d6fdd3db
1 changed files with 12 additions and 10 deletions

View File

@ -1028,16 +1028,18 @@ public class UserServiceImpl implements UserService {
UserCredentialEntity userCredential = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(userId).first();
if (userCredential == null) throw new MyApplicationException();
TenantUserEntity tenantUserEntity = new TenantUserEntity();
tenantUserEntity.setId(UUID.randomUUID());
tenantUserEntity.setUserId(userId);
tenantUserEntity.setIsActive(IsActive.Active);
if (tenant != null) tenantUserEntity.setTenantId(tenant.getId());
else tenantUserEntity.setTenantId(null);
tenantUserEntity.setCreatedAt(Instant.now());
tenantUserEntity.setUpdatedAt(Instant.now());
this.entityManager.persist(tenantUserEntity);
this.eventBroker.emit(new UserAddedToTenantEvent(tenantUserEntity.getUserId(), tenantUserEntity.getTenantId()));
if (tenant != null){
TenantUserEntity tenantUserEntity = new TenantUserEntity();
tenantUserEntity.setId(UUID.randomUUID());
tenantUserEntity.setUserId(userId);
tenantUserEntity.setIsActive(IsActive.Active);
tenantUserEntity.setTenantId(tenant.getId());
tenantUserEntity.setCreatedAt(Instant.now());
tenantUserEntity.setUpdatedAt(Instant.now());
this.entityManager.persist(tenantUserEntity);
this.eventBroker.emit(new UserAddedToTenantEvent(tenantUserEntity.getUserId(), tenantUserEntity.getTenantId()));
}
for (String role: userInviteToTenantRequest.getRoles()) {
UserRoleEntity item = new UserRoleEntity();