diff --git a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java index 1da7380b6d9f53b8b0c0909e50093a806ac5676a..9148422ff101a6e4ed42e141fb9fbf3d2f77a0cf 100644 --- a/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java +++ b/acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java @@ -130,8 +130,8 @@ public class PlainPermissionLoader { if (!ownedPermMap.containsKey(resource)) { // Check the default perm - byte ownedPerm = isGroup ? needCheckedAccess.getDefaultGroupPerm() : - needCheckedAccess.getDefaultTopicPerm(); + byte ownedPerm = isGroup ? ownedAccess.getDefaultGroupPerm() : + ownedAccess.getDefaultTopicPerm(); if (!Permission.checkPermission(neededPerm, ownedPerm)) { throw new AclException(String.format("No default permission for %s", PlainAccessResource.printStr(resource, isGroup))); } diff --git a/acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java b/acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java index ebbc4fd260cc7bf63862aedd23fb4a3f0ae1b786..575c9018743f3890c0e07e21b6e34c876861caf8 100644 --- a/acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java +++ b/acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java @@ -158,10 +158,10 @@ public class PlainPermissionLoaderTest { } @Test(expected = AclException.class) - public void checkErrorPerm() { + public void checkErrorPermDefaultValueNotMatch() { plainAccessResource = new PlainAccessResource(); - plainAccessResource.addResourceAndPerm("topicF", Permission.SUB); + plainAccessResource.addResourceAndPerm("topicF", Permission.PUB); plainPermissionLoader.checkPerm(plainAccessResource, SUBPlainAccessResource); } @Test(expected = AclException.class)