Replace users list notification recipient group with current user id

This commit is contained in:
ViacheslavKlimov 2023-12-12 13:01:56 +02:00
parent f5bfec6115
commit 95cf5cf70a
2 changed files with 5 additions and 5 deletions

View File

@ -43,6 +43,9 @@ public class NotificationTargetExportService extends BaseEntityExportService<Not
CustomerUsersFilter customerUsersFilter = (CustomerUsersFilter) usersFilter;
customerUsersFilter.setCustomerId(getExternalIdOrElseInternal(ctx, new CustomerId(customerUsersFilter.getCustomerId())).getId());
break;
case USER_LIST:
// users list stays as is and is replaced with current user id on import (due to user entities not being supported by VC)
break;
}
}
}

View File

@ -41,7 +41,7 @@ import org.thingsboard.server.dao.service.ConstraintValidator;
import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.sync.vc.data.EntitiesImportCtx;
import java.util.stream.Collectors;
import java.util.List;
@Service
@TbCoreComponent
@ -66,10 +66,7 @@ public class NotificationTargetImportService extends BaseEntityImportService<Not
break;
case USER_LIST:
UserListFilter userListFilter = (UserListFilter) usersFilter;
userListFilter.setUsersIds(userListFilter.getUsersIds().stream()
.map(UserId::new).map(idProvider::getInternalId)
.map(UUIDBased::getId).collect(Collectors.toList())
);
userListFilter.setUsersIds(List.of(ctx.getUser().getUuidId())); // user entities are not supported by VC; replacing with current user id
break;
case TENANT_ADMINISTRATORS:
if (CollectionUtils.isNotEmpty(((TenantAdministratorsFilter) usersFilter).getTenantsIds()) ||