@Test public void checkPermissionTest() { boolean boo = Permission.checkPermission(Permission.DENY, Permission.DENY); Assert.assertFalse(boo); boo = Permission.checkPermission(Permission.PUB, Permission.PUB); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.SUB, Permission.SUB); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.PUB, (byte) (Permission.PUB|Permission.SUB)); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.SUB, (byte) (Permission.PUB|Permission.SUB)); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.ANY, (byte) (Permission.PUB|Permission.SUB)); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.ANY, Permission.SUB); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.ANY, Permission.PUB); Assert.assertTrue(boo); boo = Permission.checkPermission(Permission.DENY, Permission.ANY); Assert.assertFalse(boo); boo = Permission.checkPermission(Permission.DENY, Permission.PUB); Assert.assertFalse(boo); boo = Permission.checkPermission(Permission.DENY, Permission.SUB); Assert.assertFalse(boo); }
public static boolean checkPermission(byte neededPerm, byte ownedPerm) { if ((ownedPerm & DENY) > 0) { return false; } if ((neededPerm & ANY) > 0) { return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0); } return (neededPerm & ownedPerm) > 0; }
Permission { public static boolean checkPermission(byte neededPerm, byte ownedPerm) { if ((ownedPerm & DENY) > 0) { return false; } if ((neededPerm & ANY) > 0) { return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0); } return (neededPerm & ownedPerm) > 0; } }
Permission { public static boolean checkPermission(byte neededPerm, byte ownedPerm) { if ((ownedPerm & DENY) > 0) { return false; } if ((neededPerm & ANY) > 0) { return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0); } return (neededPerm & ownedPerm) > 0; }  }
Permission { public static boolean checkPermission(byte neededPerm, byte ownedPerm) { if ((ownedPerm & DENY) > 0) { return false; } if ((neededPerm & ANY) > 0) { return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0); } return (neededPerm & ownedPerm) > 0; }  static boolean checkPermission(byte neededPerm, byte ownedPerm); static byte parsePermFromString(String permString); static void parseResourcePerms(PlainAccessResource plainAccessResource, Boolean isTopic,
        List<String> resources); static boolean needAdminPerm(Integer code); }
Permission { public static boolean checkPermission(byte neededPerm, byte ownedPerm) { if ((ownedPerm & DENY) > 0) { return false; } if ((neededPerm & ANY) > 0) { return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0); } return (neededPerm & ownedPerm) > 0; }  static boolean checkPermission(byte neededPerm, byte ownedPerm); static byte parsePermFromString(String permString); static void parseResourcePerms(PlainAccessResource plainAccessResource, Boolean isTopic,
        List<String> resources); static boolean needAdminPerm(Integer code); static final byte DENY; static final byte ANY; static final byte PUB; static final byte SUB; static final Set<Integer> ADMIN_CODE; }