-
Notifications
You must be signed in to change notification settings - Fork 15k
KAFKA-7006 - remove duplicate Scala ResourceNameType in preference to… #5152
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
Changes from all commits
b3110ad
cb2eab1
2729544
6524ead
269b948
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,17 +48,19 @@ trait Authorizer extends Configurable { | |
| * | ||
| * {code} | ||
| * // The following will add ACLs to the literal resource path 'foo', which will only affect the topic named 'foo': | ||
| * authorizer.addAcls(Set(acl1, acl2), Resource(Topic, "foo", Literal)) | ||
| * authorizer.addAcls(Set(acl1, acl2), Resource(Topic, "foo", LITERAL)) | ||
| * | ||
| * // The following will add ACLs to the special literal topic resource path '*', which affects all topics: | ||
| * authorizer.addAcls(Set(acl1, acl2), Resource(Topic, "*", Literal)) | ||
| * authorizer.addAcls(Set(acl1, acl2), Resource(Topic, "*", LITERAL)) | ||
| * | ||
| * // The following will add ACLs to the prefixed resource path 'foo', which affects all topics whose name begins with 'foo': | ||
| * authorizer.addAcls(Set(acl1, acl2), Resource(Topic, "foo", Prefixed)) | ||
| * authorizer.addAcls(Set(acl1, acl2), Resource(Topic, "foo", PREFIXED)) | ||
| * {code} | ||
| * | ||
| * @param acls set of acls to add to existing acls | ||
| * @param resource the resource path to which these acls should be attached | ||
| * @param resource the resource path to which these acls should be attached. | ||
| * the supplied resource will have a specific resource name type, | ||
| * i.e. the resource name type will not be ``ResourceNameType.ANY`` or ``ResourceNameType.UNKNOWN``. | ||
| */ | ||
| def addAcls(acls: Set[Acl], resource: Resource): Unit | ||
|
|
||
|
|
@@ -67,17 +69,19 @@ trait Authorizer extends Configurable { | |
| * | ||
| * {code} | ||
| * // The following will remove ACLs from the literal resource path 'foo', which will only affect the topic named 'foo': | ||
| * authorizer.removeAcls(Set(acl1, acl2), Resource(Topic, "foo", Literal)) | ||
| * authorizer.removeAcls(Set(acl1, acl2), Resource(Topic, "foo", LITERAL)) | ||
| * | ||
| * // The following will remove ACLs from the special literal topic resource path '*', which affects all topics: | ||
| * authorizer.removeAcls(Set(acl1, acl2), Resource(Topic, "*", Literal)) | ||
| * authorizer.removeAcls(Set(acl1, acl2), Resource(Topic, "*", LITERAL)) | ||
| * | ||
| * // The following will remove ACLs from the prefixed resource path 'foo', which affects all topics whose name begins with 'foo': | ||
| * authorizer.removeAcls(Set(acl1, acl2), Resource(Topic, "foo", Prefixed)) | ||
| * authorizer.removeAcls(Set(acl1, acl2), Resource(Topic, "foo", PREFIXED)) | ||
| * {code} | ||
| * | ||
| * @param acls set of acls to be removed. | ||
| * @param resource resource path from which the acls should be removed. | ||
| * the supplied resource will have a specific resource name type, | ||
| * i.e. the resource name type will not be ``ResourceNameType.ANY`` or ``ResourceNameType.UNKNOWN``. | ||
| * @return true if some acl got removed, false if no acl was removed. | ||
| */ | ||
| def removeAcls(acls: Set[Acl], resource: Resource): Boolean | ||
|
|
@@ -87,16 +91,18 @@ trait Authorizer extends Configurable { | |
| * | ||
| * {code} | ||
| * // The following will remove all ACLs from the literal resource path 'foo', which will only affect the topic named 'foo': | ||
| * authorizer.removeAcls(Resource(Topic, "foo", Literal)) | ||
| * authorizer.removeAcls(Resource(Topic, "foo", LITERAL)) | ||
| * | ||
| * // The following will remove all ACLs from the special literal topic resource path '*', which affects all topics: | ||
| * authorizer.removeAcls(Resource(Topic, "*", Literal)) | ||
| * authorizer.removeAcls(Resource(Topic, "*", LITERAL)) | ||
| * | ||
| * // The following will remove all ACLs from the prefixed resource path 'foo', which affects all topics whose name begins with 'foo': | ||
| * authorizer.removeAcls(Resource(Topic, "foo", Prefixed)) | ||
| * authorizer.removeAcls(Resource(Topic, "foo", PREFIXED)) | ||
| * {code} | ||
| * | ||
| * @param resource the resource path from which these acls should be removed. | ||
| * the supplied resource will have a specific resource name type, | ||
| * i.e. the resource name type will not be ``ResourceNameType.ANY`` or ``ResourceNameType.UNKNOWN``. | ||
| * @return | ||
| */ | ||
| def removeAcls(resource: Resource): Boolean | ||
|
|
@@ -106,16 +112,18 @@ trait Authorizer extends Configurable { | |
| * | ||
| * {code} | ||
| * // The following will get all ACLs from the literal resource path 'foo', which will only affect the topic named 'foo': | ||
| * authorizer.removeAcls(Resource(Topic, "foo", Literal)) | ||
| * authorizer.removeAcls(Resource(Topic, "foo", LITERAL)) | ||
| * | ||
| * // The following will get all ACLs from the special literal topic resource path '*', which affects all topics: | ||
| * authorizer.removeAcls(Resource(Topic, "*", Literal)) | ||
| * authorizer.removeAcls(Resource(Topic, "*", LITERAL)) | ||
| * | ||
| * // The following will get all ACLs from the prefixed resource path 'foo', which affects all topics whose name begins with 'foo': | ||
| * authorizer.removeAcls(Resource(Topic, "foo", Prefixed)) | ||
| * authorizer.removeAcls(Resource(Topic, "foo", PREFIXED)) | ||
| * {code} | ||
| * | ||
| * @param resource the resource path to which the acls belong. | ||
| * the supplied resource will have a specific resource name type, | ||
| * i.e. the resource name type will not be ``ResourceNameType.ANY`` or ``ResourceNameType.UNKNOWN``. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this true? I thought the current implementation allows you to pass in ResourceNameType.ANY to retrieve ACLs specified on either LITERAL or PREFIX?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is true. SimpleAclAuthorizer expects a concrete Resource, not something which could match multiple resources. The code is here: The messiness here is that this constraint is not expressed in the type system. We use the same enum to describe the name types a concrete resource can have vs. a resource filter.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. The enum has ANY and UNKNOWN values, but the code won't allow them to be passed to the authorizer. I documented so that people implementing their own would know they aren't going to get these values. It's part of the downside to standardizing on the Java ResourceNameType. |
||
| * @return empty set if no acls are found, otherwise the acls for the resource. | ||
| */ | ||
| def getAcls(resource: Resource): Set[Acl] | ||
|
|
||
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.
Took the opportunity to fix the compiler warnings in this test file, as the PR was small...