Fix tenant scope on retrieval of target groups (#2847)

* Fix tenant scope on retrieval of target groups

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* fix build

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

---------

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
Stanislav Trailov
2025-12-10 09:37:38 +02:00
committed by GitHub
parent e6367d0b0c
commit 3bc8a91883
4 changed files with 7 additions and 6 deletions

View File

@@ -381,8 +381,8 @@ public class JpaTargetManagement
}
@Override
public List<String> findGroups() {
return jpaRepository.findDistinctGroups();
public List<String> findGroups(String tenant) {
return jpaRepository.findDistinctGroups(tenant);
}
@Override

View File

@@ -102,6 +102,6 @@ public interface TargetRepository extends BaseEntityRepository<JpaTarget> {
* Finds all available distinct target groups
* @return all target groups
*/
@Query(value = "SELECT DISTINCT target_group FROM sp_target WHERE target_group IS NOT NULL", nativeQuery = true)
List<String> findDistinctGroups();
@Query(value = "SELECT DISTINCT target_group FROM sp_target WHERE tenant = ?1 AND target_group IS NOT NULL", nativeQuery = true)
List<String> findDistinctGroups(@Param("tenant") String tenant);
}