hdygxsj commented on code in PR #7580:
URL: https://github.com/apache/gravitino/pull/7580#discussion_r2188780811
##########
server/src/main/java/org/apache/gravitino/server/web/rest/TopicOperations.java:
##########
@@ -78,6 +87,12 @@ public Response listTopics(
LOG.info("Listing topics under schema: {}.{}.{}", metalake,
catalog, schema);
Namespace topicNS = NamespaceUtil.ofTopic(metalake, catalog,
schema);
NameIdentifier[] topics = dispatcher.listTopics(topicNS);
+ topics =
+ MetadataFilterHelper.filterByExpression(
+ metalake,
+ "METALAKE::CONSUME_TOPIC || CATALOG::CONSUME_TOPIC ||
SCHEMA::CONSUME_TOPIC || TOPIC::CONSUME_TOPIC || METALAKE::PRODUCE_TOPIC
||CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC ||
METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP ||
TOPIC::OWNERSHIP",
Review Comment:
USE_CATALOG and USE_SCHEMA is required.
##########
server/src/main/java/org/apache/gravitino/server/web/rest/TopicOperations.java:
##########
@@ -66,10 +71,14 @@ public TopicOperations(TopicDispatcher dispatcher) {
@GET
@Produces("application/vnd.gravitino.v1+json")
@Timed(name = "list-topic." + MetricNames.HTTP_PROCESS_DURATION, absolute =
true)
+ @ResponseMetered(name = "list-topic", absolute = true)
public Response listTopics(
- @PathParam("metalake") String metalake,
- @PathParam("catalog") String catalog,
- @PathParam("schema") String schema) {
+ @PathParam("metalake") @AuthorizationMetadata(type =
MetadataObject.Type.METALAKE)
+ String metalake,
+ @PathParam("catalog") @AuthorizationMetadata(type =
MetadataObject.Type.CATALOG)
+ String catalog,
+ @PathParam("schema") @AuthorizationMetadata(type =
MetadataObject.Type.SCHEMA)
+ String schema) {
Review Comment:
The list interface does not require AuthorizationMetadata.
##########
server/src/main/java/org/apache/gravitino/server/web/rest/TopicOperations.java:
##########
@@ -133,11 +154,17 @@ public Response createTopic(
@Produces("application/vnd.gravitino.v1+json")
@Timed(name = "load-topic." + MetricNames.HTTP_PROCESS_DURATION, absolute =
true)
@ResponseMetered(name = "load-topic", absolute = true)
+ @AuthorizationExpression(
+ expression =
+ "METALAKE::CONSUME_TOPIC || CATALOG::CONSUME_TOPIC ||
SCHEMA::CONSUME_TOPIC || TOPIC::CONSUME_TOPIC || METALAKE::PRODUCE_TOPIC ||
CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC ||
METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP ||
TOPIC::OWNERSHIP",
Review Comment:
USE_CATALOG and USE_SCHEMA is required.
--
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]