-
Notifications
You must be signed in to change notification settings - Fork 533
[#7570] feat(authz): Support topic authorization #7580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@PathParam("catalog") @AuthorizationMetadata(type = MetadataObject.Type.CATALOG) | ||
String catalog, | ||
@PathParam("schema") @AuthorizationMetadata(type = MetadataObject.Type.SCHEMA) | ||
String schema) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list interface does not require AuthorizationMetadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USE_CATALOG and USE_SCHEMA is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USE_CATALOG and USE_SCHEMA is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -92,10 +107,16 @@ public Response listTopics( | |||
@Produces("application/vnd.gravitino.v1+json") | |||
@Timed(name = "create-topic." + MetricNames.HTTP_PROCESS_DURATION, absolute = true) | |||
@ResponseMetered(name = "create-topic", absolute = true) | |||
@AuthorizationExpression( | |||
expression = | |||
"METALAKE::CREATE_TOPIC || CATALOG::CREATE_TOPIC || SCHEMA::CREATE_TOPIC || METALAKE::OWNER || CATALOG::OWNER || SCHEMA::OWNER", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
@@ -161,11 +188,17 @@ public Response loadTopic( | |||
@Produces("application/vnd.gravitino.v1+json") | |||
@Timed(name = "alter-topic." + MetricNames.HTTP_PROCESS_DURATION, absolute = true) | |||
@ResponseMetered(name = "alter-topic", absolute = true) | |||
@AuthorizationExpression( | |||
expression = | |||
"METALAKE::PRODUCE_TOPIC || CATALOG::PRODUCE_TOPIC || SCHEMA::PRODUCE_TOPIC || TOPIC::PRODUCE_TOPIC || METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -195,11 +228,17 @@ public Response alterTopic( | |||
@Produces("application/vnd.gravitino.v1+json") | |||
@Timed(name = "drop-topic." + MetricNames.HTTP_PROCESS_DURATION, absolute = true) | |||
@ResponseMetered(name = "drop-topic", absolute = true) | |||
@AuthorizationExpression( | |||
expression = | |||
"METALAKE::OWNERSHIP || CATALOG::OWNERSHIP || SCHEMA::OWNERSHIP || TOPIC::OWNERSHIP", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
PHAL @jerqi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, wait for CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### What changes were proposed in this pull request? Support topic authorization. ### Why are the changes needed? Fixes apache#7570 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? `org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT` --------- Co-authored-by: yangyang zhong <[email protected]> Co-authored-by: [email protected] <[email protected]>
### What changes were proposed in this pull request? Support topic authorization. ### Why are the changes needed? Fixes apache#7570 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? `org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT` --------- Co-authored-by: yangyang zhong <[email protected]> Co-authored-by: [email protected] <[email protected]>
### What changes were proposed in this pull request? Support topic authorization. ### Why are the changes needed? Fixes apache#7570 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? `org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT` --------- Co-authored-by: yangyang zhong <[email protected]> Co-authored-by: [email protected] <[email protected]>
### What changes were proposed in this pull request? Support topic authorization. ### Why are the changes needed? Fixes #7570 ### Does this PR introduce any user-facing change? No. ### How was this patch tested? `org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT` --------- Co-authored-by: yangyang zhong <[email protected]> Co-authored-by: [email protected] <[email protected]>
What changes were proposed in this pull request?
Support topic authorization.
Why are the changes needed?
Fixes #7570
Does this PR introduce any user-facing change?
No.
How was this patch tested?
org.apache.gravitino.client.integration.test.authorization.TopicAuthorizationIT