提交 1c36c991 编写于 作者: H Hu Zongtang 提交者: Zhendong Liu

[issue#790]fix defaultTopicPerm and defaultGroupPerm values which are in yaml...

[issue#790]fix defaultTopicPerm and defaultGroupPerm values which are in yaml config file dosen't work. (#798)

* [issue#790]fix defaultTopicPerm and defaultGroupPerm values which are in the yaml config file doesn't work.

* [issue#790]fix defaultTopicPerm and defaultGroupPerm doesn't work,fix the unit test.
上级 6a573a77
...@@ -130,8 +130,8 @@ public class PlainPermissionLoader { ...@@ -130,8 +130,8 @@ public class PlainPermissionLoader {
if (!ownedPermMap.containsKey(resource)) { if (!ownedPermMap.containsKey(resource)) {
// Check the default perm // Check the default perm
byte ownedPerm = isGroup ? needCheckedAccess.getDefaultGroupPerm() : byte ownedPerm = isGroup ? ownedAccess.getDefaultGroupPerm() :
needCheckedAccess.getDefaultTopicPerm(); ownedAccess.getDefaultTopicPerm();
if (!Permission.checkPermission(neededPerm, ownedPerm)) { if (!Permission.checkPermission(neededPerm, ownedPerm)) {
throw new AclException(String.format("No default permission for %s", PlainAccessResource.printStr(resource, isGroup))); throw new AclException(String.format("No default permission for %s", PlainAccessResource.printStr(resource, isGroup)));
} }
......
...@@ -158,10 +158,10 @@ public class PlainPermissionLoaderTest { ...@@ -158,10 +158,10 @@ public class PlainPermissionLoaderTest {
} }
@Test(expected = AclException.class) @Test(expected = AclException.class)
public void checkErrorPerm() { public void checkErrorPermDefaultValueNotMatch() {
plainAccessResource = new PlainAccessResource(); plainAccessResource = new PlainAccessResource();
plainAccessResource.addResourceAndPerm("topicF", Permission.SUB); plainAccessResource.addResourceAndPerm("topicF", Permission.PUB);
plainPermissionLoader.checkPerm(plainAccessResource, SUBPlainAccessResource); plainPermissionLoader.checkPerm(plainAccessResource, SUBPlainAccessResource);
} }
@Test(expected = AclException.class) @Test(expected = AclException.class)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册