Compare commits

...

1 Commits

Author SHA1 Message Date
Roman Acevedo
c07dcbb9ca fix(iam): tenant deletion raised error about mandatory tenantID in request context 2025-07-04 19:47:12 +02:00
6 changed files with 63 additions and 0 deletions

View File

@@ -24,6 +24,8 @@ public interface DashboardRepositoryInterface {
List<Dashboard> findAll(String tenantId);
List<Dashboard> findAllWithNoAcl(String tenantId);
default Dashboard save(Dashboard dashboard, String source) {
return this.save(null, dashboard, source);
}

View File

@@ -103,6 +103,8 @@ public interface FlowRepositoryInterface {
List<FlowWithSource> findAllWithSource(String tenantId);
List<FlowWithSource> findAllWithSourceWithNoAcl(String tenantId);
List<Flow> findAllForAllTenants();
List<FlowWithSource> findAllWithSourceForAllTenants();

View File

@@ -12,6 +12,8 @@ public interface TemplateRepositoryInterface {
List<Template> findAll(String tenantId);
List<Template> findAllWithNoAcl(String tenantId);
List<Template> findAllForAllTenants();
ArrayListTotal<Template> find(

View File

@@ -107,6 +107,25 @@ public abstract class AbstractJdbcDashboardRepository extends AbstractJdbcReposi
});
}
@Override
public List<Dashboard> findAllWithNoAcl(String tenantId) {
return this.jdbcRepository
.getDslContextWrapper()
.transactionResult(configuration -> {
DSLContext context = DSL.using(configuration);
SelectConditionStep<Record1<Object>> select = context
.select(
field("value")
)
.hint(context.configuration().dialect().supports(SQLDialect.MYSQL) ? "SQL_CALC_FOUND_ROWS" : null)
.from(jdbcRepository.getTable())
.where(this.defaultFilterWithNoACL(tenantId));
return this.jdbcRepository.fetch(select);
});
}
@Override
public Dashboard save(Dashboard previousDashboard, Dashboard dashboard, String source) throws ConstraintViolationException {
dashboard = dashboard.toBuilder().sourceCode(source).build();

View File

@@ -360,6 +360,29 @@ public abstract class AbstractJdbcFlowRepository extends AbstractJdbcRepository
});
}
@Override
public List<FlowWithSource> findAllWithSourceWithNoAcl(String tenantId) {
return this.jdbcRepository
.getDslContextWrapper()
.transactionResult(configuration -> {
var select = DSL
.using(configuration)
.select(
field("value"),
field("source_code"),
field("namespace"),
field("tenant_id")
)
.from(fromLastRevision(true))
.where(this.noAclDefaultFilter(tenantId));
return select.fetch().map(record -> FlowWithSource.of(
(Flow)jdbcRepository.map(record),
record.get(SOURCE_FIELD)
));
});
}
@Override
public List<FlowWithSource> findAllWithSourceForAllTenants() {
return this.jdbcRepository

View File

@@ -64,6 +64,21 @@ public abstract class AbstractJdbcTemplateRepository extends AbstractJdbcReposit
});
}
@Override
public List<Template> findAllWithNoAcl(String tenantId) {
return this.jdbcRepository
.getDslContextWrapper()
.transactionResult(configuration -> {
SelectConditionStep<Record1<Object>> select = DSL
.using(configuration)
.select(field("value"))
.from(this.jdbcRepository.getTable())
.where(this.defaultFilterWithNoACL(tenantId));
return this.jdbcRepository.fetch(select);
});
}
@Override
public List<Template> findAllForAllTenants() {
return this.jdbcRepository