@Test public void fromStringGetPermissionTest() { byte perm = Permission.parsePermFromString("PUB"); Assert.assertEquals(perm, Permission.PUB); perm = Permission.parsePermFromString("SUB"); Assert.assertEquals(perm, Permission.SUB); perm = Permission.parsePermFromString("PUB|SUB"); Assert.assertEquals(perm, Permission.PUB|Permission.SUB); perm = Permission.parsePermFromString("SUB|PUB"); Assert.assertEquals(perm, Permission.PUB|Permission.SUB); perm = Permission.parsePermFromString("DENY"); Assert.assertEquals(perm, Permission.DENY); perm = Permission.parsePermFromString("1"); Assert.assertEquals(perm, Permission.DENY); perm = Permission.parsePermFromString(null); Assert.assertEquals(perm, Permission.DENY); }
public static byte parsePermFromString(String permString) { if (permString == null) { return Permission.DENY; } switch (permString.trim()) { case "PUB": return Permission.PUB; case "SUB": return Permission.SUB; case "PUB|SUB": return Permission.PUB | Permission.SUB; case "SUB|PUB": return Permission.PUB | Permission.SUB; case "DENY": return Permission.DENY; default: return Permission.DENY; } }
Permission { public static byte parsePermFromString(String permString) { if (permString == null) { return Permission.DENY; } switch (permString.trim()) { case "PUB": return Permission.PUB; case "SUB": return Permission.SUB; case "PUB|SUB": return Permission.PUB | Permission.SUB; case "SUB|PUB": return Permission.PUB | Permission.SUB; case "DENY": return Permission.DENY; default: return Permission.DENY; } } }
Permission { public static byte parsePermFromString(String permString) { if (permString == null) { return Permission.DENY; } switch (permString.trim()) { case "PUB": return Permission.PUB; case "SUB": return Permission.SUB; case "PUB|SUB": return Permission.PUB | Permission.SUB; case "SUB|PUB": return Permission.PUB | Permission.SUB; case "DENY": return Permission.DENY; default: return Permission.DENY; } }  }
Permission { public static byte parsePermFromString(String permString) { if (permString == null) { return Permission.DENY; } switch (permString.trim()) { case "PUB": return Permission.PUB; case "SUB": return Permission.SUB; case "PUB|SUB": return Permission.PUB | Permission.SUB; case "SUB|PUB": return Permission.PUB | Permission.SUB; case "DENY": return Permission.DENY; default: return Permission.DENY; } }  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 byte parsePermFromString(String permString) { if (permString == null) { return Permission.DENY; } switch (permString.trim()) { case "PUB": return Permission.PUB; case "SUB": return Permission.SUB; case "PUB|SUB": return Permission.PUB | Permission.SUB; case "SUB|PUB": return Permission.PUB | Permission.SUB; case "DENY": return Permission.DENY; default: return Permission.DENY; } }  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; }