Skip to content
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

Fix typo in operations parsing #220

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum AclOperationType {
All(org.apache.kafka.common.acl.AclOperation.ALL),
Read(org.apache.kafka.common.acl.AclOperation.READ),
Write(org.apache.kafka.common.acl.AclOperation.WRITE),
Create1(org.apache.kafka.common.acl.AclOperation.CREATE),
Create(org.apache.kafka.common.acl.AclOperation.CREATE),
Delete(org.apache.kafka.common.acl.AclOperation.DELETE),
Alter(org.apache.kafka.common.acl.AclOperation.ALTER),
Describe(org.apache.kafka.common.acl.AclOperation.DESCRIBE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,12 @@ public final void parseWrongOperations() {
final var jsonReader = new AclJsonReader(path);
assertThrows(JsonParseException.class, jsonReader::read);
}

@Test
public final void parseAllOperations() {
final var path = new File(this.getClass().getResource("/acl_all_operations.json").getPath()).toPath();
final var jsonReader = new AclJsonReader(path);
final var acls = jsonReader.read();
assertThat(acls).isNotEmpty();
}
}
128 changes: 128 additions & 0 deletions src/test/resources/acl_all_operations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
[
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Alter"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Alter"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["AlterConfigs"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["AlterConfigs"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["ClusterAction"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Create"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Create"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["CreateTokens"],
"resource": "^User:user2$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Delete"],
"resource": "^Group:group1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Delete"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe"],
"resource": "^DelegationToken:foobar$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe", "Read"],
"resource": "^Group:group1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Describe", "Write"],
"resource": "^TransactionalId:foobar$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["DescribeConfigs"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["DescribeConfigs"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["DescribeConfigs"],
"resource": "^User:user2$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["IdempotentWrite"],
"resource": "^Cluster:kafka-cluster$"
},
{
"principal_type": "User",
"principal": "^user1$",
"operations": ["Read", "Write"],
"resource": "^Topic:topic1$"
},
{
"principal_type": "User",
"principal": "^all$",
"operations": ["All"],
"resource": "^Topic:topic1$"
}
]
Loading