chia7712 commented on code in PR #18989:
URL: https://github.com/apache/kafka/pull/18989#discussion_r1966700208
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -2603,15 +2641,58 @@ public static Map<String, ResolvedRegularExpression>
refreshRegularExpressions(
return result;
}
+ /**
+ * This method filters the topics in the resolved regexes
+ * that the member is authorized to describe.
+ *
+ * @param context The request context.
+ * @param authorizer The authorizer.
+ * @param resolvedRegexes The map of the regex pattern and its set of
matched topics.
+ */
+ private static void filterTopicDescribeAuthorizedTopics(
+ RequestContext context,
+ Optional<Authorizer> authorizer,
+ Map<String, Set<String>> resolvedRegexes
+ ) {
+ if (authorizer.isEmpty()) return;
+
+ Map<String, Integer> topicNameCount = new HashMap<>();
+ resolvedRegexes.values().forEach(topicNames ->
+ topicNames.forEach(topicName ->
+ topicNameCount.compute(topicName, Utils::incValue)
+ )
+ );
+
+ List<Action> actions = topicNameCount.entrySet().stream().map(entry ->
{
+ ResourcePattern resource = new ResourcePattern(TOPIC,
entry.getKey(), LITERAL);
+ return new Action(DESCRIBE, resource, entry.getValue(), true,
true);
Review Comment:
`logIfDenied` should be `false` due to regex pattern, right?
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -3771,6 +3852,7 @@ public
CoordinatorResult<ConsumerGroupHeartbeatResponseData, CoordinatorRecord>
} else {
// Otherwise, it is a regular heartbeat.
return consumerGroupHeartbeat(
+ context,
Review Comment:
it seems we can remove some arguments from `consumerGroupHeartbeat` after
passing whole `context`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]