Skip to content

Commit 304c880

Browse files
committed
Fix ACL problem in BrokersCOntroller (#556)
1 parent f803510 commit 304c880

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

api/src/main/java/io/kafbat/ui/controller/BrokersController.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import javax.annotation.Nullable;
1717
import lombok.RequiredArgsConstructor;
1818
import lombok.extern.slf4j.Slf4j;
19+
import org.jetbrains.annotations.NotNull;
1920
import org.springframework.http.ResponseEntity;
2021
import org.springframework.web.bind.annotation.RestController;
2122
import org.springframework.web.server.ServerWebExchange;
@@ -94,8 +95,14 @@ public Mono<ResponseEntity<Flux<BrokerConfigDTO>>> getBrokerConfig(String cluste
9495
.operationParams(Map.of(BROKER_ID, id))
9596
.build();
9697

98+
return validateAccess(context).thenReturn(
99+
getBrokerConfigIml(id, clusterName)
100+
).doOnEach(sig -> audit(context, sig));
101+
}
102+
103+
private @NotNull ResponseEntity<Flux<BrokerConfigDTO>> getBrokerConfigIml(Integer id, String clusterName) {
97104
var kafkaCluster = getCluster(clusterName);
98-
Flux<BrokerConfigDTO> brokerConfigs = brokerService.getBrokerConfig(kafkaCluster, id)
105+
var brokerConfigs = brokerService.getBrokerConfig(kafkaCluster, id)
99106
.map(clusterMapper::toBrokerConfig);
100107

101108
if (kafkaCluster.isReadOnly()) {
@@ -105,10 +112,7 @@ public Mono<ResponseEntity<Flux<BrokerConfigDTO>>> getBrokerConfig(String cluste
105112
});
106113
}
107114

108-
return validateAccess(context).thenReturn(
109-
ResponseEntity.ok(
110-
brokerConfigs)
111-
).doOnEach(sig -> audit(context, sig));
115+
return ResponseEntity.ok(brokerConfigs);
112116
}
113117

114118
@Override

0 commit comments

Comments
 (0)