dongnuo123 commented on code in PR #18989:
URL: https://github.com/apache/kafka/pull/18989#discussion_r1968016833
##########
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:
Yes right since it's filtering on authorized resources
--
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]